Latest

How to Extract the Private and Public Key From pfx File ?




Install and configure OpenSSL 

  1. Extract the key-pair
    >openssl pkcs12 -in certificate.pfx -nocerts -nodes -out cert.key

  2. Get the Private Key from the key-pair
    >openssl rsa -in cert.key -out cert_private.key

  3. Get the Public Key from key pair
    >openssl rsa -in cert.key -pubout -out cert_public.key

  4. Need to do some modification to the private key -> to pkcs8 format
    >openssl pkcs8 -topk8 -inform PEM -in cert_private.key -outform PEM -nocrypt
    Copy the output and save it as cert_private_pkcs8.key

  5. Extract Server Certificate chain
           >openssl pkcs12 -in [certificate.pfx] -cacerts -nokeys -out  server-ca.crt

No comments