Extract cert & key from PFX

To extract the private key and SSL Certificate from PFX file do the following:

openssl>pkcs12 -in filename.pfx -nocerts -out key.pem -nodes

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

to remove the password from the file:

openssl>rsa -in key.pem -out server.key

Once you have these items extracted you can now create a new PFX file containing the SSL Intermediate certificate.  This is sometimes a requirement on some systems like load balancers that don't have a place to upload a separate SSL cert.

openssl>pkcs12 -export -out your_cert.pfx -inkey your_private.key -in your_cert.cer -certfile verisign-chain.cer


Convert a CER to PEM

Run the following command:

openssl x509 -inform pem -in certificate.cer -outform der -out certificate.pem