How to convert .pem into .key?

只谈情不闲聊 提交于 2019-12-20 08:18:07

问题


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?




回答6:


just as a .crt file is in .pem format, a .key file is also stored in .pem format. Assuming that the cert is the only thing in the .crt file (there may be root certs in there), you can just change the name to .pem. The same goes for a .key file. Which means of course that you can rename the .pem file to .key.

Which makes gtrig's answer the correct one. I just thought I'd explain why.



来源:https://stackoverflow.com/questions/19979171/how-to-convert-pem-into-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!