[openssl-users] SMIME_read_CMS and binary signature

etc at coderhacks.com etc at coderhacks.com
Thu Feb 15 05:29:23 UTC 2018


I need a little hint for parsing SMIME into a CMS_ContentInfo.

Here is an shortend example of my SMIME to make clear the structure of 
my content.

Content-Type: multipart/signed; protocol="application/pkcs7-signature"; 
micalg=sha1; boundary="----=_Part_abcde"

Content-Type: application/text; name=abc.txt
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=abc.txt


Content-Type: application/pkcs7-signature; name=smime.p7s; 
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature



If I try SMIME_read_CMS it is working well if the signature (the 2nd 
MIME-part with smime-type=singed-data)
has a Content-Transfer-Encodeing of "base64" (as it is in my example)

But It is not working if the CTE is "binary" and also the content is.

If I manually convert the signature to base64 and change the CTE to 
base64 the SMIME_read_CMS is working again.

Is there another way of handling that? Maybe another function?
Thanks for help!

Best regards,

More information about the openssl-users mailing list