Linux Administrator

Check if Certificate, Private Key and CSR Match

Written by Santosh Prasad

If your certificate does not match to private key and throwing an error, this article will help to verify that you are using correct private key or certificate.

In this article I will provide you two method to verify if certificate, private key and CSR match.

Method #1 : Using OpenSSL and MD5

Using md5 value of the certificate, private key and CRS should be same for all, if you are getting different md5 value it means your certificate, private key and CRS does not match.

# openssl rsa -noout -modulus -in example.key | openssl md5
# openssl req -noout -modulus -in example.csr | openssl md5
# openssl x509 -noout -modulus -in example.crt | openssl md5

Method #2 : Using OpenSSL and sha256sum

In this method check the SHA sum values of all the files and check if the value of all files are same.

# openssl pkey -in example.key -pubout -outform pem | sha256sum
# openssl x509 -in example.crt -pubkey -noout -outform pem | sha256sum
# openssl req -in example.csr -pubkey -noout -outform pem | sha256sum 
Thank you! for visiting Look Linux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment