Saturday, January 1, 2011

OpenSSL Commands to Convert SSL Certificates



OpenSSL Convert PEM

Convert PEM to DER
openssl x509 -outform der -in certificate.pem -out certificate.der

Convert PEM to P7B
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

Convert PEM to PFX
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

OpenSSL Convert DER

Convert DER to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem

OpenSSL Convert P7B

Convert P7B to PEM
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

Convert P7B to PFX
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer

OpenSSL Convert PFX

Convert PFX to PEM
openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes





Leave your comment below

3 comments:

  1. Nice Article !

    how can we convert this ? is there any specific tools or we need to use cmd.

    can you describe the steps to convert.

    Thanks...

    ReplyDelete
  2. Yes. Install OpenSLL Tool which is a freeware and can be download @ www.openssl.org & execute the commands @ command Prompt (CMD).

    The Steps are very simple. Just save the certificate in OpenSSL\bin folder and execute the above mentioned commands.

    I have also mentioned the steps to extract the private key from .pfx file in my previous post "Extract SSL Certificate and Private Key from PFX file" on November.

    Hope this helps :-)

    ReplyDelete