FreeKB - How to create an PFX public / private key pair using OpenSSL on Linux
How to create an PFX public / private key pair using OpenSSL on Linux

Home > Search > How-to


A PFX (personal exchange format) file contains both private keys and public certificates. If you do not yet have OpenSSL installed on your Linux system, use apt-get or yum to install OpenSSL.

yum install openssl

 

Before creating the PFX file, you will first need to create the public certificate and private key. These articles describe how to create the public certificate and private key.

 

Let's say you've created the following files:

  • foo.crt (public certificate)
  • foo.key (private key)

 

The following command will create foo.pfx using the foo.crt public certificate and the foo.key private key.

openssl pkcs12 -export -out foo.pfx -inkey foo.key -in foo.crt

 

You can then use OpenSSL to verify that the PFX file contains both the certificate and private key.

openssl pkcs12 -info -in foo.pfx

 

Or the Java keytool command (if you have Java installed on your system).

keytool -list -v -keystore foo.pfx -storetype PKCS12 -storepass your_password

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter b7059 in the box below so that we can be sure you are a human.




Comments