Help Center/ Anti-DDoS Service/ FAQs/ AAD FAQs/ Access Configuration/ How Do I Convert a Non-PEM Certificate into a PEM One?
Updated on 2023-03-23 GMT+08:00

How Do I Convert a Non-PEM Certificate into a PEM One?

  • Converting a .cer or .crt certificate into a .pem one

    Change the name extension of the certificate file.

    For example, change certificate.cer to certificate.pem.

  • Converting a .pfx certificate into a .pem one
    Use OpenSSL to convert the certificate.
    # Certificate extraction command
    openssl pkcs12 -in certificate.pfx -nokeys -out cert.pem
    # Private key extraction command
    openssl pkcs12 -in certificate.pfx -nocerts -out key.pem -nodes
  • Converting a .p7b certificate into a .pem one

    Use OpenSSL to convert the certificate.

    1. Run the following command to convert the certificate:
      openssl pkcs7 -print_certs -in incertificat.p7b -out outcertificate.cer
    2. Obtain the certificate content in outcertificat.cer.
    3. Save the content in .pem format.
  • Converting a .der certificate into a .pem one
    Use OpenSSL to convert the certificate.
    # Certificate extraction command
    openssl x509 -inform der -in certificate.cer -out certificate.pem
    # Private key extraction command
    openssl rsa -inform DER -outform PEM -in privatekey.der -out privatekey.pem