SSL: Verifying that a Certificate matches a Private Key
The private key contains a series of numbers. Two of those numbers form the “public key”, the others are part of your “private key”. The “public key” bits are also embedded in your Certificate (we get them from your CSR). To check that the public key in your cert matches the public portion of your private key, you need to view the cert and the key and compare the numbers.
Normally it requires some manual number matching to match a given private key with a given certificate, however with this command you are able to do a comparison automatic:
$ (openssl x509 -noout -modulus -in server.pem | openssl md5 ;\
openssl rsa -noout -modulus -in server.key | openssl md5) | uniq
(If more than one hash is displayed, they don’t match)
Related posts:
- View x509 certificate details
- Howto Create Generate a Certificate Signing Request
- Howto: Convert an OpenSSL key to a public/private OpenSSH key-pair
- View The Contents Of A Certificate Signing Request (CSR)
- Openssl to create an unencrypted key from an encrypted one (Remove password)
- SSL Certificates Review: What to Buy
- OpenSSL CSR Wizard
- Howto Secure Apache
- SSH Key for Login Without Password
- sec_error_reused_issuer_and_serial – Firefox
