<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Key on DevOps Engineer &amp; Software Engineer</title>
    <link>https://carlossura.com/tags/key/</link>
    <description>Recent content in Key on DevOps Engineer &amp; Software Engineer</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <lastBuildDate>Tue, 26 May 2026 21:45:56 -0600</lastBuildDate>
    <atom:link href="https://carlossura.com/tags/key/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SSL Certificate Private Key Validation</title>
      <link>https://carlossura.com/blog/ssl-certificate-private-key-validation/</link>
      <pubDate>Tue, 26 May 2026 21:45:56 -0600</pubDate>
      <guid>https://carlossura.com/blog/ssl-certificate-private-key-validation/</guid>
      <description>&lt;p&gt;I had an issue the other day with an SSL Certificate and Private Key that didn&amp;rsquo;t match. Here is how I validated it.&lt;/p&gt;&#xA;&lt;p&gt;First, ensure you have the &lt;code&gt;cryptography&lt;/code&gt; library installed.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pip install cryptography&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, use the following script to validate the SSL Certificate and Private Key.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;from cryptography.hazmat.primitives.asymmetric import rsa&#xA;from cryptography.hazmat.primitives import serialization&#xA;from cryptography.x509 import load_pem_x509_certificate&#xA;&#xA;# Load private key&#xA;with open(&amp;#34;your-private.key&amp;#34;, &amp;#34;rb&amp;#34;) as key_file:&#xA;    private_key = serialization.load_pem_private_key(key_file.read(), password=None)&#xA;&#xA;# Load certificate&#xA;with open(&amp;#34;your-certificate.pem&amp;#34;, &amp;#34;rb&amp;#34;) as cert_file:&#xA;    cert = load_pem_x509_certificate(cert_file.read())&#xA;&#xA;# Get the public key from the certificate&#xA;public_key = cert.public_key()&#xA;&#xA;# Check if the public key matches the private key&#xA;if isinstance(public_key, rsa.RSAPublicKey) and isinstance(private_key, rsa.RSAPrivateKey):&#xA;    if private_key.public_key().public_numbers() == public_key.public_numbers():&#xA;        print(&amp;#34;The private key belongs to the certificate.&amp;#34;)&#xA;    else:&#xA;        print(&amp;#34;The private key does NOT belong to the certificate.&amp;#34;)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I ran this script, and it told me that the private key did not belong to the certificate. So I knew I had the wrong private key. This saved me a lot of time troubleshooting.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
