How to extract the certificate from a 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 certificate.

Mark van Eijk 1 minute read Security

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

openssl pkcs12 -in pfx-file.pfx -nokeys -out certificate-file.pem