How do I verify that a private key matches a certificate? 
Friday, 11 February 2022, 12:47 - Technology, OpenSSL
Posted by Administrator
To verify that an RSA private key matches the RSA public key in a certificate you need to i) verify the consistency of the private key and ii) compare the modulus of the public key in the certificate against the modulus of the private key.

To verify the consistency of the RSA private key:
openssl rsa -check -noout -in myserver.key
RSA Key is ok

If it doesn't say 'RSA key ok', it isn't OK!"

To view its modulus:
openssl rsa -modulus -noout -in myserver.key | openssl md5

To view the modulus of the RSA public key in a certificate:
openssl x509 -modulus -noout -in myserver.crt | openssl md5

If the first commands shows any errors, or if the modulus of the public key in the certificate and the modulus of the private key do not exactly match, then you're not using the correct private key.
add comment ( 1062 views )   |  permalink   |  $star_image$star_image$star_image$star_image$star_image ( 2.9 / 1440 )

<Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Next> Last>>