How do I export my certificate from Apache?

It is pretty easy to export a certificate from Apache if you have root access to the server.

In fact you just need to find three files: the certificate issued for your domain name, appropriate Private Key and CA bundle on the server where the certificate is installed.

If you are not sure about the names of the files coming with the certificate, you can locate them by checking your VirtualHost file. If the certificate is installed, you should have the following lines in your VirtualHost:

      SSLCertificateFile "/*path_to_your_certificate*/*.crt"

      SSLCertificateKeyFile "/*path_to_your_Pivate_Key*/*.key"

      SSLCACertificateFile "/*path_to_your_CA_bundle*/*.crt"

The lines have paths to the required files as values, therefore, you can find their location.

Afterwards, simply copy all the three files and upload them to the exportation destination.

In case you are going to install the certificate on a Microsoft server or Tomcat, you may export it in the required PKCS12 format using the openssl command:

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

where certificate.crt is the certificate issued for your domain, CACert.crt is the chain of CA certificates, and privateKey.key is your private key. In the output you will have the certificate as a .pfx file in the PKCS12 format required for installation on a Microsoft server or Tomcat.

Updated
Viewed
26877 times

Need help? We're always here for you.

notmyip