View on GitHub

Devendra's Log

Export private key in pfx or p12 file to pem format

The following openssl command can be used to export private key in a pfx or p12 file to pem

openssl pkcs12 -nodes -in file.pfx -out key.pem -nocerts

If you need the public key for the private key in key.pem

openssl rsa -in key.pem -out key.pub -pubout

If you need information on the public key (modulus, exponent…)

openssl rsa -in key.pem -pubout -text

OR

openssl rsa -pubin -in key.pub -text

If you need to create pfx from private key and certificate in pem format

openssl pkcs12 -inkey key.pem -in cert.pem -export -out file.pfx  -passout pass:foobar