Extracting certificates from PFX files
Using openssl makes it easy to extract everything from a PFX file so you can use it with web servers like Apache.
First extract the private key. You will need to enter a password to open the PFX file (if password protected) and then you have to enter a password for the private key. We need to do two runs to remove the password from the private key.
openssl pkcs12 -in file.pfx -nocerts -out priv-with-pwd.key
openssl rsa -in priv-with-pwd.key -out priv.key
Next we’ll extract the certificate.
openssl pkcs12 -in file.pfx -clcerts -nokeys -out cert.cer
And you are done.