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


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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Zephyr ICTCloud ArchitectCommented:
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
adiemeerAuthor 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?
adiemeerAuthor 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?
Zephyr ICTCloud ArchitectCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adiemeerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.