Wednesday, February 24, 2021

Extracting Certificate and Private Key Files from a .pfx File

You will need to use OpenSSL to perform the steps below.

  1. Command to export the private key: openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes
  2. Command to export the certificate: openssl pkcs12 -in certname.pfx -nokeys -out cert.pem
  3. Command to remove the passphrase from the private key: openssl rsa -in key.pem -out server.key