Tuesday, March 02, 2010

Importing keys from a .pfx file

Export the private key
openssl pkcs12 -in filename.pfx -nocerts -nodes -out key.pem

Create a public key from the private key
openssl rsa -in key.pem -out public.key

Export the certificate
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem