Skip to content

Instantly share code, notes, and snippets.

@KavenTheriault
Last active November 15, 2017 20:26
Show Gist options
  • Save KavenTheriault/921c3cd460c7ac64826786a0524eece9 to your computer and use it in GitHub Desktop.
Save KavenTheriault/921c3cd460c7ac64826786a0524eece9 to your computer and use it in GitHub Desktop.
How to extract certificate information (including private key) from pfx file

How to extract certificate information (including private key) from pfx file

Use openssl to extract private key. After executing the following line. you will need to enter the password used when the pfx file was created.

openssl pkcs12 -in file_name.pfx -out certificate.cer -nodes

When converting a PFX file to PEM format, OpenSSL will put all the certificates and the private key into a single file. You will need to open the file in a text editor and copy each certificate and private key (including the BEGIN/END statments) to its own individual text file and save them as certificate.cer, CACert.cer, and privateKey.key respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment