www.gsx.com | log in | register

Last update: . Author: Christian Stokes .

Extracting Certificate.crt and PrivateKey.key from a Certificate.pfx File

A certificate.crt and privateKey.key can be extracted from your Personal Information Exchange file (certificate.pfx) using OpenSSL.

Follow this article to create a certificate.crt and privateKey.key files from a certificate.pfx file.

Personal Information Exchange | OpenSSL

Instructions

Extracting certificate and private key information from a Personal Information Exchange (.pfx) file with OpenSSL: 

  1. Open Windows File Explorer.
  2. Copy your .pfx file to a computer that has OpenSSL installed, notating the file path.
    • Certificate.pfx files are usually password protected. Obtain the password for your .pfx file.
  3. Navigate to the \OpenSSL\bin\ directory.
  4. Right-click the openssl.exe file and select Run as administrator.
  5. Enter the following command to set the OpenSSL configuration:
    • set OPENSSL_CONF=c:\OpenSSL\bin\openssl.cnf
  6. Run the following OpenSSL command, replacing the applicable filepath\filename to match your corresponding copied .pfx file location:
    • pkcs12 -in C:\PathToThePFXfile\myPFXfileName.pfx -out certificate.txt -nodesCreate_text_from_pfx.png
  7. Enter the password for the .pfx file.
  8. A certificate.txt file is now generated within the same directory as your referenced location in the command above.

Creating your certificate.crt file: 

  1. Open Notepad.
  2. Open the newly generated certificate.txt file above.
  3. Copy the section starting from and including -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----
    • for example, you would copy the highlighted text:
      BeginCertificateText.png
  4. Create a new file using Notepad.
  5. Paste the information into the new Notepad file.
  6. Save the file as certificate.crt.
    • Notepad should save this file as certificate.crt.txt.
  7. Rename the new Notepad file extension to .crt.

Creating your privateKey.key file: 

  1. Return to the certificate.txt file generated above.
  2. Copy the section starting from and including -----BEGIN PRIVATE KEY----- to -----END PRIVATE KEY-----
    • for example, you would copy the highlighted text:
      PrivateKeyText.png
  3. Create a new file using Notepad.
  4. Paste and save the information into the new Notepad file.
  5. Save the file as privateKey.key.
    • Notepad should save this file as privateKey.key.txt.
  6. Rename the new Notepad file extension to .key.
  7. You can repeat the same copy process for any other corresponding certificate files needed that is provided by the certificate.txt file.

 

You now have certificate.crt and privateKey.key files created from your certificate.pfx file.



Not finding what you are looking for?

Have more questions? Submit a request


Was this article helpful?

0 out of 0 found this helpful