Conversion of CRT Certificate to PFX Format
Recently we faced an issue where a client renewed his certificate from GoDaddy. After renewal, the client found that the private key was missing from the certificate. GoDaddy support suggested importing the certificate on the same server from where the CSR was generated. However, that server was removed from the network.
Why Convert Between Certificate Formats?
Conversion from one certificate format to another, such as from .crt to .pfx, is necessary to accommodate different systems or applications that require specific formats for certificate usage. For instance:
- .pfx files are commonly used for storing private keys along with their associated public key certificates
- .crt files contain the certificate in a standard format but without the private key bundled in
- Different platforms and tools may have format-specific requirements for importing certificates
This conversion ensures compatibility and proper functionality across various platforms. Similarly, converting from .crt to .cer format may be necessary due to different naming conventions or system requirements. Both formats essentially contain certificate information, but their extensions might signify their usage or compatibility with particular software or environments.

Prerequisites
Before starting, make sure you have:
- The old PFX file or the private key for the certificate
- OpenSSL for Windows downloaded and installed
- The renewed .crt certificate file
Step-by-Step Conversion Process
Step 1: Locate the Old PFX File
Locate the old PFX file containing the certificate's password (the one nearing expiration), or export it from the current server.
Step 2: Install OpenSSL
Download and install OpenSSL on your Windows PC.
Step 3: Open the OpenSSL Command Prompt
Open a command prompt and navigate to the OpenSSL bin directory:
cd C:\OpenSSL-Win64\bin
openssl
Step 4: Extract the Private Key
Place your old PFX file in the bin directory and execute this command to extract the encrypted private key:
pkcs12 -in Old.pfx -nocerts -out keyfile-encrypted.key
When prompted:
- Enter the Import Password for the old PFX file
- Set a new PEM pass phrase and verify it
Step 5: Generate the New PFX File
Use the following command to generate the PFX format of the renewed certificate:
pkcs12 -export -out New.pfx -inkey keyfile-encrypted.key -in certificate.crt
When prompted:
- Enter the pass phrase for
keyfile-encrypted.key(the same one set in Step 4) - Set an Export Password and verify it
Step 6: Verify the Output
After executing these commands, a new file (New.pfx) will be created in the bin folder in PFX format. You can now import this PFX file into your target server or application.
Conclusion
By using OpenSSL on a Windows PC, you can extract the private key from an old PFX file and generate a new PFX file for a renewed certificate. Following the outlined steps will allow you to manage and safeguard your certificates effectively, ensuring a seamless continuation of secure operations.
Frequently Asked Questions
What is the difference between a .CRT and .PFX certificate file?
A .CRT file contains only the public certificate in PEM or DER format. A .PFX (PKCS#12) file is a bundled format that contains the certificate, the private key, and optionally any intermediate CA certificates -- all in a single password-protected file.
Can I convert CRT to PFX without the private key?
No. A PFX file requires both the certificate and the private key. If the private key is lost and cannot be recovered from the original server or a backup, you will need to generate a new CSR and re-issue the certificate.
Is OpenSSL free to use?
Yes, OpenSSL is an open-source toolkit and is free to download and use. For Windows, you can download a pre-compiled binary from the OpenSSL for Windows project page.
Can I use this method on Linux or macOS?
Yes, the OpenSSL commands are the same across operating systems. On Linux and macOS, OpenSSL is typically pre-installed. Simply open a terminal and run the same pkcs12 commands without needing to install anything extra.
