Convert PEM to PFX Certificate
Sometimes, you have a certificate in PEM format as a CRT file (also called a CER file) with a key file (also called a PEM file), and you need to combine and convert them into a PFX certificate.
In this post, I will show you step-by-step how to convert a PEM certificate into a PFX file.
Prerequisites
- OpenSSL binary installed. You can find the OpenSSL binaries on the OpenSSL wiki.
- Private key file
- SSL Certificate
The Process
- Place everything in a working directory.
I will be using C:\SSL as my working directory.
- Open the command line. You can use Linux or Windows. The commands are all the same regardless of which OS you are using.
I will be using Microsoft Windows with Windows Terminal and PowerShell.
To convert the certificate using OpenSSL, we will need to use a few options to create our command.
- The options we will use are
pkcs12to tell OpenSSL that we will be working with a PKCS#12 file. PKCS#12 is another name for a PFX file.inkeyto tell OpenSSL which private key to use.into tell OpenSSL which certificate file to use.exportto tell OpenSSL we want to export a PKCS#12 file.outto tell OpenSSL where to save the converted certificate.



