Check If A Certificate & Private Key Match
Check if an SSL certificate and private key match in two simple commands. The OpenSSL commands below will require you to replace
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.
The pipe to md5sum is solely to make the output shorter and easier to visually compare ↩