I have an encrypted .eml file and a private key. I've looked it up a lot on the internet but couldn't find a way to decrypt the email using OpenSSL. I've tried this command:
smime -decrypt -in encrypted.eml -inkey privatekey.key -out decrypted.eml
and each time I get this error:

OpenSSL> smime -decrypt -in encrypted.eml -inkey privatekey.key -out decrypted.eml
No recipient certificate or key specified
smime: Use -help for summary.

I have also tried converting the private key to a .pem file but it still displays the same message. both files are in the same folder as the openssl.exe application is, before that I couldn't get it to work at all.

I clearly am doing something wrong, what is it exactly?

  • -inkey is an option and all options (must) begin with a hyphen. The privatekey file does need to be in PEM format inside, but it doesn't need to be named .pem unless you want to. – dave_thompson_085 May 28 '20 at 23:29

Try using openssl cms instead of openssl smime. See https://www.misterpki.com/openssl-cms/ for a good example.

  • I've tried that but I still get the same error: No recipient certificate or key specified – Daniel May 29 '20 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.