GNOME Bugzilla – Bug 396645
Import certificate dialogs aren't filtering by mime-type
Last modified: 2007-04-20 05:26:20 UTC
These dialogs should be able to filter files based on their mime-type so that the user is presented only the files he can import Other information: I'll post a preliminary patch in a minute
Created attachment 80266 [details] [review] evolution-2.8.2.1-certificate-manager-filtering.patch this patch modifies the 3 import dialogs to filter the content based on the mime-type it is supposed to handle. It works very well for PKCS#12 files but x509-ca-cert and x509-email-cert aren't shown, so it might be a bug in the chooser. Anyway those 2 needs more testing.
Created attachment 82558 [details] [review] evolution-2.8.2.1-certificate-manager-filter.patch Ok, this one works for all certificates evolution supports. It was a simple typo.
The patch looks neat and clean. But Im not sure about all the mime types. Is this all about or are there any more formats too? If some one can confirm the mime types, this patch can be committed. Thanks
looking on the web I found 4 type of certifitcates but the present mimetypes I selected are those evolution takes care of according to the sources (by searching in the same file).
ok much details: look in evolution/smime/lib/e-cert-db.c at function: gboolean e_cert_db_import_certs_from_file (ECertDB *cert_db, const char *file_path, ECertType cert_type, GError **error) you will find switch (cert_type) { case E_CERT_CA: rv = e_cert_db_import_certs (cert_db, buf, bytes_read, cert_type, error); break; case E_CERT_SITE: rv = e_cert_db_import_server_cert (cert_db, buf, bytes_read, error); break; case E_CERT_CONTACT: rv = e_cert_db_import_email_cert (cert_db, buf, bytes_read, error); break; default: rv = FALSE; break; } and then on http://www.sfsu.edu/training/mimetype.htm, you will find : type application/x-x509-ca-cert cacert type application/x-x509-server-cert scert type application/x-x509-user-cert ucert type application/x-x509-email-cert ecert As evolution didn't let me import a PEM encoded user certificate, I thought it would only take pkcs12 formated user certificates but maybe I did something wrong with the pem file. The pkcs12 stuff has function /e_cert_db_import_pkcs12_file/ anf finaly for E_CERT_SITE, looking at the fonction, there is no UI for it that's why it's not present here. Anyway, that's how I came to write this patch. Hope I'm clear enough.
Commit to HEAD only.
Gilles, do you have commit rights?
no I don't.
Fixed.