在cer / pem / crt / der / pfx / p12之间转换证书可以在Linux中通过终端使用 OpenSSL 工具完成 .
这些命令允许您将证书和密钥转换为不同的格式,以使它们与特定类型的服务器或软件兼容 .
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
您可以添加-nocerts以仅输出私钥或添加-nokeys以仅输出证书 .
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
有关更多信息,请参阅
http://www.sslshopper.com/article-most-common-openssl-commands.html https://support.ssl.com/index.php?/Knowledgebase/Article/View/19