Pagine

Tutorial - PFX to PEM certificate exporting procedure #HOW TO

If you have necessity to transform .PFX certificate to .PEM files you have to follow a specific procedure:

Consider that PFX file is a certificate, in PKCS#12 format, it contains SSL certificate (public keys) and corresponding private keys.
Be aware that a PEM file is a text file, containing one or more items, in Base64 ASCII encoding, each with plain-text headers and footers (e.g. -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----)

Here they are steps that you should take place

  1. Install OpenSSL
    https://slproweb.com/products/Win32OpenSSL.html

  2. Copy .pfx files in same folder where OpenSSL.exe is located

  3. First case: To convert a PFX file to a PEM file that contains both the certificate and private key:

    Launch below commands:
    openssl pkcs12 -in original_certificate.pfx -nocerts -out Exported_certificate_private_key-encrypted.key

    (you will be prompted to insert original password and new one)

    openssl pkcs12 -in original_certificate.pfx -clcerts -nokeys -out Exported_certificate_private_key-encrypted.crt

  4. Second case: How to convert PFX file to PEM file (that contains both certificate and private key):
    openssl pkcs12 -in original_certificate.pfx -out Exported_certificate.pem -nodes

    (you will be prompted to insert original password and new one)
[Original articles]