How to convert .pem into .key?

2019-03-08 03:30发布

问题:

I already have purchased SSL certificate and i have received certificate and a .pem file as a private key? from the supplier; now i need to convert this .pem key into .key for bitnami Redmine Apache web server in order to make it work.

How do I go about doing this what what program or commands to do this? I am a newbie in terms of using Openssl etc to do this.

Any advice would be much appreciated!

Thank you.

回答1:

I assume you want the DER encoded version of your PEM private key. So :

openssl rsa -outform der -in private.pem -out private.key


回答2:

openssl x509 -outform der -in your-cert.pem -out your-cert.crt


回答3:

openssl rsa -in privkey.pem -out private.key does the job.



回答4:

CA's don't asks for your private keys they only asks for CSR to issue a certificate for you if they have your private key its possible that your SSL certificate will be compromised and end up being revoked, your .key file is generated upon CSR generation most probably its somewhere on your PC where you generated the CSR. That's why private key is called "Private" because not anyone can have that file except you.



回答5:

If you're looking for a file to use in httpd-ssl.conf as a value for SSLCertificateKeyFile, a PEM file should work just fine.

See this SO question/answer for more details on the SSL options in that file.

Why is SSLCertificateKeyFile needed for Apache?