How to extract private key from PFX file


Sometimes you receive a PFX file, which is a file that bundles both certificate and private key of a SSL certificate. Here's how to extract the private key.

Published on August 10, 2022 · 1 minute read

For this we need the openssl command line tool. Using the following command you can extract the private key from a PFX file:

openssl pkcs12 -in pfx-file.pfx -nocerts -out private-key-file.pem -nodes

Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!