{"id":19628,"date":"2023-10-19T11:30:33","date_gmt":"2023-10-19T15:30:33","guid":{"rendered":"https:\/\/nuxx.net\/blog\/?p=19628"},"modified":"2023-10-19T11:30:34","modified_gmt":"2023-10-19T15:30:34","slug":"using-openssl-to-match-certificates-and-private-keys","status":"publish","type":"post","link":"https:\/\/nuxx.net\/blog\/2023\/10\/19\/using-openssl-to-match-certificates-and-private-keys\/","title":{"rendered":"Using OpenSSL to Match Certificates and Private Keys"},"content":{"rendered":"\n<p>I recently was troubleshooting a problem with network authentication and suspected that the issue was around certificates and private keys not matching on a client. I had a .PEM file for the certificate and a .KEY for the private key, and I wanted to see if they matched.<\/p>\n\n\n\n<p>Thankfully <a href=\"https:\/\/www.openssl.org\/\">OpenSSL<\/a>, the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Swiss_Army_knife#Cultural_impact\">Swiss Army Knife<\/a> of wrangling certs, made it easy. While this isn&#8217;t anything particularly secret, it took me a few to figure it out, so I&#8217;m re-documenting it here.<\/p>\n\n\n\n<p>To see if the private key matches the certificate, use the following two commands and compare the <code>Modulus<\/code> section:<\/p>\n\n\n\n<p><code>openssl x509 -in file.pem -noout -text<\/code><\/p>\n\n\n\n<p><code>openssl rsa -in file.key -noout -text<\/code><\/p>\n\n\n\n<p>If they match, the private key matches the certificate. If they don&#8217;t, they don&#8217;t.<\/p>\n\n\n\n<p>In my case they didn&#8217;t match, which was causing the authentication problems. So we then solved what was happening during cert issuance and everything was then good.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently was troubleshooting a problem with network authentication and suspected that the issue was around certificates and private keys not matching on a client.&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/nuxx.net\/blog\/2023\/10\/19\/using-openssl-to-match-certificates-and-private-keys\/\">Continue reading<span class=\"screen-reader-text\">Using OpenSSL to Match Certificates and Private Keys<\/span><\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-19628","post","type-post","status-publish","format-standard","hentry","category-computers","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/19628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/comments?post=19628"}],"version-history":[{"count":2,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/19628\/revisions"}],"predecessor-version":[{"id":19630,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/posts\/19628\/revisions\/19630"}],"wp:attachment":[{"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/media?parent=19628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/categories?post=19628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nuxx.net\/blog\/wp-json\/wp\/v2\/tags?post=19628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}