A Personal Information Exchange (PFX) is a cryptographic file format used to store and protect sensitive information such as certificates, private keys, and secrets. In this blog, I’ll explain how to extract the certificates and private keys from PFX using OpenSSL in Windows Subsystem for Linux (WSL).
Prerequisites:
- WSL
- PFX file with certificate and private key
- Open WSL and run sudo apt update to refresh the list of available packages and their versions.
- Run sudo apt install openssl to install OpenSSL in WSL.
- Run openssl version to check the OpenSSL version installed in WSL.
- Navigate to the folder that contains your PFX file using the cd command.
- Run the following command to extract the private key and certificate. You will be prompted to enter the PFX file password.
openssl pkcs12 -in demo.pfx -nocerts -nodes -out demo.key
openssl pkcs12 -in demo.pfx -clcerts -nodes -out certificate.crt
- You will now see the extracted certificate.crt file and demo.key file in your directory.
This guide focused on how to extract values from a PFX file using WSL. By following the steps, you should now be able to extract both the certificate and the private key.
No comments:
Post a Comment