云证书管理服务 CCM-如何将证书格式转换为PEM格式?:证书格式转换为PEM格式

时间:2023-11-01 16:19:32

证书格式转换为PEM格式

表1 证书转换命令

格式类型

转换方式(通过OpenSSL工具进行转换)

CER/CRT

“cert.crt”证书文件直接重命名为“cert.pem”

PFX

  • 提取私钥命令,以“cert.pfx”转换为“key.pem”为例。

    openssl pkcs12 -in cert.pfx -nocerts -out key.pem

  • 提取证书命令,以“cert.pfx”转换位“cert.pem”为例。

    openssl pkcs12 -in cert.pfx -nokeys -out cert.pem

P7B

  1. 证书转换,以“cert.p7b”转换为“cert.cer”为例。

    openssl pkcs7 -print_certs -in cert.p7b -out cert.cer

  2. “cert.cer”证书文件直接重命名为“cert.pem”

DER

  • 提取私钥命令,以“privatekey.der”转换为“privatekey.pem”为例。

    openssl rsa -inform DER -outform PEM -in privatekey.der -out privatekey.pem

  • 提取证书命令,以“cert.cer”转换为“cert.pem”为例。

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

support.huaweicloud.com/ccm_faq/ccm_01_0128.html