How to extract Private Key (.key) and SSL Certificate File from a .pfx file

Modified on Mon, 16 Dec, 2024 at 7:54 PM

Extracting the Private Key


The following command will extract the private key from a .pfx file. The result will be stored in a file with the extension .pem


# openssl pkcs12 -in myfile.pfx -nocerts -out private_key.pem -nodes
Enter Import Password:
MAC verified OK
Extracting the Certificate


The following command will extract the certificate from a .pfx file. The result will be stored in a file with the extension .crt

# openssl pkcs12 -in myfile.pfx -nokeys -out certificate_file.crt
Enter Import Password:
MAC verified OK

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article