We help IT Professionals succeed at work.

How to convert a PEM file to a CRT file with private key

adiemeer
adiemeer asked
on
Hello,

I installed a PEM certificate. Now this certificate has to be installed in the firewall. For this reason I have to convert the PEM file to a CRT file and I need the private key. I installed the certificate at a windows server. How to I get this CRT file and private key?

Best regards,

Arne Diemeer
Comment
Watch Question

Zephyr ICTCloud Architect

Commented:
You can use Openssl for this (command line)

Something like this:
openssl x509 -outform der -in certificate.pem -out certificate.crt

Open in new window


To get the key something like this should work I think:

openssl pkey -in certificate.pem -out certificate-key.pem

Open in new window


More information on the pkey option here

Author

Commented:
Thank you. How do I select the certificate? Doe I have to save the certificate in a filefolder and then give the path to the certificate.pem?

Author

Commented:
Another question. I tried to run your script but get the message 'openssl' is not recognized as an internal or external command. Do I have to install openssl?
Cloud Architect
Commented:
Hi, yes probably you'll need to install openssl it's not a standard part of Windows ... Easiest is to have the certificate in a folder somewhere yes, you can export it out of the certificate store in Windows.

Author

Commented:
Thanks!