Howto export RSA Private Key from bundle PKCS12 (*.p12)

Howto export RSA Private Key from bundle PKCS12 (*.p12)

When you want to set up SSL in Apache 2, you will need to provide to the service the following items: certificate for web-site, private key for that certificate, root CA certificate that issued web-site-certificate.

In my case I got from our sequrity-men p12-file which contains certificate itself and the private key. How to convert this p12 bundle to RSA private key?

Take openssl.exe and run the following commands:

openssl pkcs12 -in www.website.com.p12 -nocerts -out www.website.com.key.pem -nodes
openssl pkcs12 -in www.website.com.p12 -nokeys -out www.website.com.cert.pem -nodes
openssl rsa -in www.website.com.key.pem -out www.website.com.key.txt.pem -text

As the result you will get three files, and in one of them there will be the following section:

-----BEGIN RSA PRIVATE KEY-----
.....
-----END RSA PRIVATE KEY-----

Take all this block and copy to separate text-file.

And thats it.

 

ssl (en)

  • Hits: 31771
Add comment

Related Articles