OpenSSL Convert

PFX to Key

openssl pkcs12 -in filename.pfx -nocerts -out key_pw.pem

Remove password from key

openssl rsa -in key_pw.pem -out key.pem

PFX to Cert

openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem

Fixing PFX withs Issues (pfx -> pem -> pfx)

Open Powershell in the bin folder of OpenSSL and run these commands (replace old.pfx is your current, new.pfx will be the fixed one. You might have to enter the pfx password a few times):

openssl.exe pkcs12 -in old.pfx -nocerts -out key_pw.pem
openssl.exe rsa -in key_pw.pem -out key.pem
openssl.exe pkcs12 -in old.pfx -clcerts -nokeys -out cert.pem
openssl.exe pkcs12 -inkey key.pem -in cert.pem -export -out new.pfx

Leave a Reply

Your email address will not be published. Required fields are marked *