Export Private Key from pkcs12 file
I need to export private key from pkcs12 file, it took me a while to find the command needed.
OpenSSL to extract the private key, and the cert file
Export the private key file from the pfx file
openssl pkcs12 -in filename.pfx -nocerts -out key.pem
Export the certificate file from the pfx file
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem
Remove the passphrase from the private key
openssl rsa -in key.pem -out server.key
If you use Putty, you have to use puttygen to convert from pem format to PPK format only used by putty. Please make sure you remove the pasword using the above command, otherwise puttygen will not able to load it.
Previous Post Next Post