Extracting certificate and private key files from a .pfx file

Created: 2021-10-20

The PKCS #12 file with .pfx or .p12 extension is an archive file format for storing many cryptography objects, including a private key with its X.509 certificate.

  1. Extract the private key from PFX
openssl pkcs12 -in certificate.pfx -nocerts -out private-key.pem -nodes
  1. Extract the certificate from PFX
openssl pkcs12 -in certificate.pfx -nokeys -out certificate.pem

Resources: