Dangerous Things
Custom gadgetry for the discerning hacker

The Store is now open! Check out the gadgetry »
Like what you're reading?
Share It.

Export KEY and PEM files from PFX

Nothing new here, just another personal note on how to do something so I don’t forget.

Generate a new private key and Certificate Signing Request
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

To export the private key without a passphrase or password
openssl pkcs12 -in filename.pfx -nocerts -nodes -out key.pem

To Generate a public version of the private RSAkey
openssl rsa -in key.pem -out server.key

To export the Certificate
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem

The directory will now have a file cert.pem and a key.pem

Leave a Reply

Get Adobe Flash player