GNOME Bugzilla – Bug 674032
application/x-pkcs7-signature not handled correctly
Last modified: 2012-08-05 17:14:21 UTC
In method pkcs7_get_signature_protocol in gmime-pkcs7-context.c (line 249), only application/pkcs7-signature is mentioned. These two content types should be treated identically (See RFC 2311, appendix C.1). Many MUAs actually use application/x-pkcs7-signature instead of (the better suited) application/pkcs7-signature. If there is any way to work around this bug client-side, please inform us :)
Just to confirm: is the protocol value in the multipart/signed part's Content-Type header application/x-pkcs7-signature? And the Content-Type of the signature part is also application/x-pkcs7-signature? I suspect that both are the same, but I just want to confirm that they match.
Created attachment 212536 [details] [review] 674032.patch This patch should fix it. Can you verify?
This patch does not fix the issue for me. This appears to be due to at least a typo: the variable "supported" is compared with protocol twice, when the second call should compare to "xsupported". For the mail in my corpus, both the content-type of the signature part and multipart/signed protocol have the "x-" prefix. I'm currently working around this with the following preprocessing callback passed to g_mime_message_foreach(): void smime_fix_part(GMimeObject *parent, GMimeObject *part, gpointer user_data) { GMimeContentType *content_type = g_mime_object_get_content_type (part); const char *subtype = g_mime_content_type_get_media_subtype (content_type); const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol"); if (!strcmp(subtype, "x-pkcs7-signature")) { g_mime_content_type_set_media_subtype (content_type, "pkcs7-signature"); } if (protocol && !strcmp(protocol, "application/x-pkcs7-signature")) { g_mime_content_type_set_parameter (content_type, "protocol","application/pkcs7-signature"); } }
fixed in git master by comparing against xsupported