Extracting private key and certificate from pfx file

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

To do the opposite

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


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *