How to convert an SSL certificate in linux

前端 未结 2 1039
北荒
北荒 2021-01-30 04:23

Is there a way how to convert certificates between cer/pem/crt/der/pfx/p12 in Linux? I have an SSL certificate in a .cer file and I need it to be .pem in order to use it.

<
相关标签:
2条回答
  • 2021-01-30 04:53

    Converting certificates between cer/pem/crt/der/pfx/p12 can be done in Linux with the use of OpenSSL tool via the terminal.

    These commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software.

    Convert a DER file (.crt .cer .der) to PEM

    openssl x509 -inform der -in certificate.cer -out certificate.pem

    Convert a PEM file to DER

    openssl x509 -outform der -in certificate.pem -out certificate.der

    Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM

    openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes

    You can add -nocerts to only output the private key or add -nokeys to only output the certificates.

    Convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12)

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

    For more information see:

    http://www.sslshopper.com/article-most-common-openssl-commands.html

    https://support.ssl.com/index.php?/Knowledgebase/Article/View/19

    0 讨论(0)
  • 2021-01-30 04:58

    Convert .crt to .p12

    openssl pkcs12 -export -out server.p12 -inkey server.key -in server.crt

    Where server.key , is the server key . server.crt is cert file from CA or self sigh

    0 讨论(0)
提交回复
热议问题