How to OpenSSL decrypt smime.p7m

Posted by tntu on Super User See other posts from Super User or by tntu
Published on 2013-10-29T21:36:59Z Indexed on 2013/10/29 22:00 UTC
Read the original article Hit count: 3812

Filed under:
|
|
|

I have received an email that has no content, just a file called smime.p7m attached.

I was looking into the OpenSSL and it's smime module but I cannot figure out exactly how. I must be doing something wrong.

I extracted the certificate chain form the p7m file.

# openssl pkcs7 -inform DER -in smime.p7m -out pkcs7.pem
# openssl pkcs7 -in pkcs7.pem -print_certs -out certs.pem

Then I tried to decrypt:

# openssl smime -decrypt -in smime.p7m -signer certs.pem -out smime.eml
No recipient certificate or key specified

And also with my server's SSL cert:

# openssl smime -decrypt -in smime.p7m -recip server.nopass.key.crt.ca.pem -out smime.eml
Error reading S/MIME message
140078540371784:error:0D0D40D1:asn1 encoding routines:SMIME_read_ASN1:no content type:asn_mime.c:447:

Can anyone shed some light on what steps I need to take to extract the email?

© Super User or respective owner

Related posts about email

Related posts about encryption