You are here

Extracting private key and certificate from pfx file

Ivan Radovanovic's picture

To extract private key:

  • openssl pkcs12 -in file.pfx -nocerts -out pk.pem
  • openssl rsa -in pk.pem -out key.pem

To extract certificate:

  • openssl pkcs12 -in file.pfx -clcerts -nokeys -out cert.pem

Comments

Ivan Radovanovic's picture

openssl pkcs12 -export -in certificate.crt -inkey certificate.key -out certificate.pfx