How to Generate PFX File or P12 File Using OpenSSL?

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...
Generate PFX File or P12 using OpenSSL

Confused or unaware of the know-how to generate a PFX file or P12 file using OpenSSL? Don’t fret! You have reached the correct article. You can quickly resolve this issue by reading this article till the last scroll.

But before we tell you how to generate any of these two files using OpenSSL with step-by-step instructions, won’t it be better to know what a PFX or P12 file is?

Knowing this will help you comprehend the process and will widen your knowledge. Therefore, let’s move on by first getting familiar with these two types of files. And also getting to know if/there are any differences between them.

Cheap SSL Certificates

What is a PFX File?

A PFX (Personal Information Exchange) file is a type of digital file format commonly associated with Windows operating systems. It stores a complete certificate chain and private key in a single, encrypted file. PFX files are typically password-protected and used for securely transporting or backing up private keys and certificates.

What is a P12 File?

P12, or PKCS #12, is also a file format that securely stores private keys and certificates. The P12 format file is encrypted and password protected and is used for exporting and importing keys and certificates between different systems or applications.

The only difference between PFX and P12 Files is that the PFX file is commonly used with Windows operating systems. On the other hand, P12 or PKCS #12 is used in environments or systems that are not Windows-based, such as Unix systems or Linux systems.

How to Generate PFX File Using OpenSSL?

Prerequisite: Download and Install OpenSSL (exe or MSI file). For OSX users, OpenSSL will be installed by default.

Follow the steps mentioned below to generate a PFX file using OpenSSL:

  • Click the Search icon placed on the taskbar.
  • Type Win64 OpenSSL Command Prompt and press Enter.
  • The OpenSSL command line console window will open.
  • In the OpenSSL command line console window, the default location (c:\users\%username%\) will be visible. This is where the Private key and Certificate will be saved.
  • Type the “openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt” command in the OpenSSL command line console window. (Note: Replace “privateKey.key” with the name of your private key file. Replace “certificate.crt” with the name of your certificate file.)
  • Press Enter.
  • Re-enter and export the password. 

Kudos!! You have successfully generated the PFX file using OpenSSL.

How to Generate P12 or PKCS #12 File in OpenSSL?

Follow the steps mentioned below to generate a PFX file using OpenSSL:

  • Click the Search icon placed on the taskbar.
  • Type Win64 OpenSSL Command Prompt and press Enter.
  • The OpenSSL command line console window will open.
  • In the OpenSSL command line console window, the default location (c:\users\%username%\) will be visible. This is where the Private key and Code Signing Certificate will be saved.
  • Type the “openssl pkcs12 -export -out certificate.p12 -inkey privateKey.key -in certificate.crt” command in the OpenSSL command line console window. (Note: Replace “privateKey.key” with the name of your private key file. Replace “certificate.crt” with the name of your certificate file.)
  • Press Enter.
  • Re-enter and export the password. 

Congratulations!! You have successfully generated the P12 orPKCS #12 file using OpenSSL.

Recommended: How to Export Certificates and Private Key From a PKCS#12 File with OpenSSL?