kb

Openssl | Convert Certificate pfx into pem | crt | key

I will describe how to convert a pfx certifcate file which includes a password to different formats by using openssl.

Export Certificate from pfx to pem

openssl pkcs12 -in certname.pfx -out certname.pem -nokeys

Export Key from pfx (Output file is password protected)

openssl pkcs12 -in certname.pfx -out certnameKEY.pem -nocerts

Export Key from pfx (Output file is NOT password protected)

openssl pkcs12 -in certname.pfx -out certnameKEY.pem -nocerts
openssl rsa -in certnameKEY.pem -out certnameKEY.key

Convert cer to pem

openssl x509 -inform der -in certname.cer -out certname.pem