Migel
Migel

Reputation: 1

How to decrypt SMIME encrypted outlook msg files in openssl using localstore certificates

I'm trying to figure out how to script such scenario:

  1. I got outlook msg files (one msg in one file) encrypted using PKI certtificates
  2. PKI certificates are stored in Cert:\CurrentUser\My\ - I got private keys (Windows OS) I've tried: PS> Unprotect-CmsMessage -path mail.msg -To 'thumprint_of_pki_certificate' but got error "no ecrypted data" I got info that there is diference beetween encrypting/decripting using certificates and smime encryption. so I tried to figure out with:

openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem

this shoud work if I can use windows store (can't export private keys to get key.pem)... Q: is a way to show to openssl windows local store?

Upvotes: 0

Views: 318

Answers (1)

not2savvy
not2savvy

Reputation: 4243

You need to export the private key either in PEM format or as a pfx file. Then

openssl smime -decrypt -in mail.msg -recip recipient.pem

or, if you have a pfx file (which is PCKS#12 format), then first convert it to pem with

openssl pkcs12 -in recipient.pfx -out recipient.pem

Your question is a bit confusing. Does this answer it?

Upvotes: 0

Related Questions