Check if an SSL certificate and private key match in two simple commands. The OpenSSL commands below will require you to replace with your file's name.

For your SSL certificate:1

openssl x509 -noout -modulus -in  | md5sum

For your RSA private key:

openssl rsa -noout -modulus -in  | md5sum

The output of these commands should be identical. If it isn’t, your keys do not match.

  1. The pipe to md5sum is solely to make the output shorter and easier to visually compare