Extracting private key from .cer to .pem with openssl

certificateopensslssl-certificate

How can I export the private key embedded in an .cer file and convert it to .pem using openssl.

Update:

If I download a .cer file from Apple and import it into KeyChain, I can export the private key as a .p12 file. How can I do this using openssl?

alt text
(source: flickr.com)

alt text
(source: flickr.com)

Best Answer

Unfortunately - the certificate does not contain the private key (it does, however contain the public key). You'll need the private key source (a .p12 usually), to extract the private key.

Hope this helps.