Convert SSL Certificate PEM/CRT to PFX

Learn how to Convert SSL Certificate to PFX (PEM/CRT to PFX)

There are many situations where you might need to convert PEM SSL Certificates (mainly due to Linux Environments like Certbot or Cloudflare etc.) but you need to Import the PFX certificate in Microsoft Platforms like IIS or Azure. Below are the Steps which can help you to convert this certificate.

Prerequisites:

  1. Download OpenSSL from Here
  2. Keep ready the certificate SSL files i.e. crt.pem and pvt.key which was obtained from Linux or Cloudflare etc platform
  3. Install Open SSL (usually installed in C:\Program Files\OpenSSL-Win64\)

Steps to Convert PEM SSL Certificate to PFX

  1. Open Command Prompt as Administrator (right-click on Command Prompt and select Run as Administrator)
  2. Switch to OpenSSL path i.e. C:\Program Files\OpenSSL-Win64\
  3. Verify that the Command Prompt path should be like below
Convert SSL Certificate to PFX (PEM/CRT to PFX)

4. Copy the SSL certificate files for ex:- certificate_pvt.key and certificate.pem into the bin folder (else you can mention the absolute path of these files)

5. After copying the SSL files into the Bin folder. Run the below command in the command prompt.

openssl pkcs12 -inkey certificate_pvt.key -in certificate.pem -export -out certificate.pfx

6. It will prompt you to enter the pfx file password twice. Please enter your desired password and press enter. If no error occurs then the file has been exported out to pfx certificate.

Look for the certificate.pfx file in C:\Program Files\OpenSSL-Win64\Bin. Copy it and Import it to Windows Server, Azure, or wherever you may need to.

Also know How to Convert PFX to Crt/PEM & Key Files in 3 Easy Steps

Conclusion

It is simple to get the PFX certificate from CRT/PEM and key files. It can be done through an online portal like SSL shopper. However, I would not suggest it as your own certificate would be uploaded on the third-party server which could be the compliance issue. Rather go for the Offline conversion as mentioned above. If you like this article you can share it further.

Ravi Chopra
Scroll to Top