Announcement

Collapse
No announcement yet.

Convert your SSL from or to: crt, cer, pem, der, pfx, & p7b

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert your SSL from or to: crt, cer, pem, der, pfx, & p7b

    Convert your SSL file to other formats

    If your server/device requires a different certificate format other than Base64 encoded X.509, a third party tool such as OpenSSL can be used to convert the certificates into the appropriate format.
    OpenSSL commands to convert PEM formatted file

    Convert PEM to DER
    Code:
    openssl x509 -outform der -in certificate.pem -out certificate.der

    Convert PEM to P7B
    Code:
    openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer

    Convert PEM to PFX
    Code:
    openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt
    OpenSSL commands to convert DER formatted file

    Convert DER to PEM
    Code:
    openssl x509 -inform der -in certificate.cer -out certificate.pem
    OpenSSL commands to convert P7B formatted file

    Convert P7B to PEM
    Code:
    openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

    Convert P7B to PFX
    Code:
    openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer 
    openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.cer
    OpenSSL commands to convert PFX formatted file

    Convert PFX to PEM
    Code:
    openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes

  • #2
    thanks for the tutorial, but i have ssl recently issued with me and by mistake i choose to install on windows and ssl company issued me ssl in .cer format and there is no CA certificate and .crt file, as i need to install it on the linux server.

    I tried the above command but got errors:

    21325:error:0D0690A4:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1316:
    21325:error:0D07802A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509

    Comment


    • #3
      CER Certificate has two types of encoding i.e DER and Base64.

      If either one returns an error loading certificate i.e asn1 encoding routines, try the different one.

      Code:
      openssl x509 -inform DER -in certificate.cer -out certificate.crt
      
      openssl x509 -inform PEM -in certificate.cer -out certificate.crt
      [B][/B]


      or try this:

      Code:
        
       openssl pkcs7 -print_certs -in certificate.cer -out certificate.crt [B][/B]

      Comment

      Working...
      X