One of the most versatile SSL tools is OpenSSL which is an open source implementation of the SSL protocol. There are versions of OpenSSL for nearly every platform, including Windows, Linux, and Mac OS X. OpenSSL is commonly used to create the CSR and private key for many different platforms, including Apache. However, it also has hundreds of different functions that allow you to view the details of a CSR or certificate, compare an MD5 hash of the certificate and private key (to make sure they match), verify that a certificate is installed properly on any website, and convert the certificate to a different format.

The most common OpenSSL commands and their usage:

General OpenSSL Commands

These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.

Generate a new private key and Certificate Signing Request

Generate a self-signed certificate

Generate a certificate signing request (CSR) for an existing private key

Generate a certificate signing request based on an existing certificate

Remove a passphrase from a private key

 

Checking Using OpenSSL

If you need to check the information within a Certificate, CSR or Private Key, use these commands.

Check a Certificate Signing Request (CSR)

Check a private key

Check a certificate

Check a PKCS#12 file (.pfx or .p12)

Debugging Using OpenSSL

If you are receiving an error that the private doesn’t match the certificate or that a certificate that you installed to a site is not trusted, try one of these commands.

Check an MD5 hash of the public key to ensure that it matches with what is in a CSR or private key

Check an SSL connection. All the certificates (including Intermediates) should be displayed

 

Converting Using OpenSSL

These commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software. For example, you can convert a normal PEM file that would work with Apache to a PFX (PKCS#12) file and use it with Tomcat or IIS.

Convert a DER file (.crt .cer .der) to PEM

Convert a PEM file to DER

Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM

You can add -nocerts to only output the private key or add -nokeys to only output the certificates.
Convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12)