Updated on 2024-10-16 GMT+08:00

HTTPS Certificate Format Conversion

CDN only supports certificates or private keys in PEM format. The following examples illustrate some popular conversion methods.

In the following examples, the name of certificates before conversion is old_certificate by default, and that of private keys before conversion is old_key by default. The new certificate and private key names are new_certificate and new_key respectively.

  • Converting DER to PEM
    openssl x509 -inform der -in old_certificate.cer -out new_certificate.pem
    openssl rsa -inform DER -outform pem -in old_key.der -out new_key.key
  • Converting P7B to PEM
    openssl pkcs7 -print_certs -in old_certificate.p7b -out new_certificate.cer
  • Converting PFX to PEM
    openssl pkcs12 -in old_certificate.pfx -nokeys -out new_certificate.pem
    openssl pkcs12 -in old_certificate.pfx -nocerts -out new_key.key

You can also use an online third-party certificate conversion tool.