Skip to content

Instantly share code, notes, and snippets.

@ikurni
Created January 29, 2021 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikurni/3c9247f78a3789caa5a502d4db8e30ba to your computer and use it in GitHub Desktop.
Save ikurni/3c9247f78a3789caa5a502d4db8e30ba to your computer and use it in GitHub Desktop.
Verify SSL Cert with Key Pair
# How do I verify that a private key matches a certificate?
# To verify that a private key matches its certificate you need to compare the modulus of the certificate against the modulus of the private key.
#Please follow the below command to view the modulus of the certificate.
openssl x509 -noout -modulus -in server.crt | openssl md5
#Now you will receive the modulus something like a77c7953ea5283056a0c9ad75b274b96
#Please follow the below command to view the modulus of the private key.
openssl rsa -noout -modulus -in myserver.key | openssl md5
#Now you should get the modulus as same as certificate modulus above. i.e a77c7953ea5283056a0c9ad75b274b96
#If the modulus of the certificate and the modulus of the private key do not match, then you’re not using the right private key. You can either create a brand new key and CSR and send contact support or do a search for all private keys on the system and compare their modulus.
#Please follow the below command to search for all private keys on your server .
find / -name *.key
#source : https://ssl.comodo.com/support/ssl-technical-faqs/how-do-i-verify-that-a-private-key-matches-a-certificate-openssl.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment