Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Cyber Security
  3. Question
Cyber Security

How can I convert pem to key file?

Asked by Anil Jha Apr 6, 2022 570 views 1 answer
Share

About this question

I downloaded certificated for my website using letsencrypt:

letsencrypt -d crackerscreed.me --manual --preferred-challenges dns certonly The process was successful but the site I want to implement these certificates on is expecting a .key file for private key. There are many solution which tells the solution using openSSL:

When I tried:  rsa -outform der -in /etc/letsencrypt/live/crackerscreed.me/privkey.pem -out /etc/letsencrypt/live/crackerscreed.me/privkey.key

The site popped an error saying:


Invalid KEY format encountered. Your file doesn't seem to have a valid key! Please, upload a valid key file.


and when I tried with x509 instead of RSA, x509 -outform der -in /etc/letsencrypt/live/crackerscreed.me/privkey.pem -out /etc/letsencrypt/live/crackerscreed.me/privkey.key

unable to load certificate

OpenSSL popped an error saying:


unable to load certificate 140343522624768:error:0906D06C:PEM routines:PEM_read_bio:no start line:../crypto/pem/pem_lib.c:691:Expecting: TRUSTED CERTIFICATE


What do I do now? Is there a way to properly convert the file? If not, can I revoke these certificates and create new ones and somehow ask letsencrypt to provide me certificates directly as a .key file instead of a .pem file?

Your answer

1 Answer

More Cyber Security discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Cyber Security Blogs

Guides, tips and career advice on Cyber Security from JanBask experts.