Fun hacks, WP plugins, photography, and PKI junk. Languishing since 2008.
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 <file> with your file’s name.
For your SSL certificate:1
openssl x509 -noout -modulus -in <file> | md5sum
For your RSA private key:
openssl rsa -noout -modulus -in <file> | 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 ↩
| Print article | This entry was posted by Paul Kehrer on October 5, 2009 at 9:52 am, and is filed under Posts. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 5 months ago
Hey, this is a good one to keep handy. Just wanted to mention to your readers that -modulus for both ‘x509′ and ‘rsa’ applications in openssl prints the RSA key modulus and even those values can be compared to confirm a match. The pipe to md5sum/sha1sum simply help make things easier when visually comparing.
Good one!