Convert crt files to a pfx

If you have the following files:

  • certificate.crt (your certificate)
  • intermediate.crt (the intermediate certificate)
  • root.crt (the root certificate)
  • private.key (your private key)

You can create a .pfx file using the following steps:


Steps to Combine and Convert:

1. Combine the certificate files:
Combine certificate.crt, intermediate.crt, and root.crt into a single file in this order:

    cat certificate.crt intermediate.crt root.crt > fullchain.crt

    2. Generate the .pfx file:
    Use OpenSSL to combine the full chain and private key into a .pfx file:

    openssl pkcs12 -export -out certificate.pfx -inkey private.key -in fullchain.crt
    • -out certificate.pfx: Specifies the output .pfx file.
    • -inkey private.key: Specifies your private key.
    • -in fullchain.crt: Specifies the combined certificate file.

    3. Set a password for the .pfx file:
    When prompted, enter and confirm a password for the .pfx file. This password will protect the file and is required for importing it into systems.

    4. Verify the .pfx file:
    Check the .pfx file to ensure it was created correctly:

      openssl pkcs12 -info -in certificate.pfx

      Example Command Sequence:

      cat certificate.crt intermediate.crt root.crt > fullchain.crt
      openssl pkcs12 -export -out certificate.pfx -inkey private.key -in fullchain.crt