<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alan Veras</title>
    <description>The latest articles on DEV Community by Alan Veras (@victhors).</description>
    <link>https://dev.to/victhors</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3728602%2Fc68fb4eb-fe2b-476b-a430-5617656107ed.png</url>
      <title>DEV Community: Alan Veras</title>
      <link>https://dev.to/victhors</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/victhors"/>
    <language>en</language>
    <item>
      <title>Checking post-quantum TLS with openssl s_client: the grep trap and the fallback trap</title>
      <dc:creator>Alan Veras</dc:creator>
      <pubDate>Fri, 04 Dec 2026 15:32:54 +0000</pubDate>
      <link>https://dev.to/victhors/checking-post-quantum-tls-with-openssl-sclient-the-grep-trap-and-the-fallback-trap-14be</link>
      <guid>https://dev.to/victhors/checking-post-quantum-tls-with-openssl-sclient-the-grep-trap-and-the-fallback-trap-14be</guid>
      <description>&lt;p&gt;After the US ONCD, NSA and CISA statement on December 2, 2026, and the joint statement from Amazon, Apple, Google, Microsoft and others backing a fast move to post-quantum cryptography, I wanted a quick way to check one thing: does a given server already negotiate a post-quantum key exchange?&lt;/p&gt;

&lt;p&gt;The key exchange is the part that matters for "harvest now, decrypt later": someone records encrypted traffic today and decrypts it once a large quantum computer exists. In TLS 1.3 the post-quantum option you will see most is &lt;code&gt;X25519MLKEM768&lt;/code&gt;, a hybrid of classical X25519 and ML-KEM-768.&lt;/p&gt;

&lt;p&gt;You can check it with plain &lt;code&gt;openssl&lt;/code&gt;, no account and no SDK. It is one handshake. But on my machine two details made the result easy to misread, so this post is about those.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 0: can your client even offer it?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl version
openssl list -tls-groups &lt;span class="o"&gt;|&lt;/span&gt; tr &lt;span class="s1"&gt;':'&lt;/span&gt; &lt;span class="s1"&gt;'\n'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; grep -i mlkem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You need OpenSSL 3.5 or later, and &lt;code&gt;X25519MLKEM768&lt;/code&gt; in that list. I used OpenSSL 3.6.5 on Manjaro Linux.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: one handshake
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kms.sa-east-1.amazonaws.com
openssl s_client -connect &lt;span class="s2"&gt;"$host:443"&lt;/span&gt; -servername &lt;span class="s2"&gt;"$host"&lt;/span&gt; \
  -groups X25519MLKEM768:X25519 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;"^Protocol|Negotiated TLS1.3 group|Temp Key|Cipher is"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-groups X25519MLKEM768:X25519&lt;/code&gt; offers the hybrid first and classical X25519 as a fallback. The server picks one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trap 1: the grep that hides the classical result
&lt;/h2&gt;

&lt;p&gt;If the server picks the hybrid group, OpenSSL 3.6.5 prints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Negotiated TLS1.3 group: X25519MLKEM768
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it picks classical X25519, that line is not there. The group shows up somewhere else:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Peer Temp Key: X25519, 253 bits
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you grep only for &lt;code&gt;Negotiated TLS1.3 group&lt;/code&gt;, a classical server gives you the protocol, the cipher and no group at all. That reads like "no data", not like "classical". That is why the grep above includes &lt;code&gt;Temp Key&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And if the connection ends up on TLS 1.2 with RSA key transport, there is neither line. In a script I fall back from one to the other:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;out&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(timeout 10 openssl s_client -connect "&lt;/span&gt;&lt;span class="nv"&gt;$host&lt;/span&gt;:443&lt;span class="s2"&gt;" \
      -servername "&lt;/span&gt;&lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="s2"&gt;" -groups "&lt;/span&gt;&lt;span class="nv"&gt;$groups&lt;/span&gt;&lt;span class="s2"&gt;" &amp;lt;/dev/null 2&amp;gt;&amp;amp;1)"&lt;/span&gt;
&lt;span class="nv"&gt;group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(sed -n 's/^Negotiated TLS1.3 group: //p' &amp;lt;&amp;lt;&amp;lt;"&lt;/span&gt;&lt;span class="nv"&gt;$out&lt;/span&gt;&lt;span class="s2"&gt;" | head -1)"&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; -z &lt;span class="s2"&gt;"$group"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(sed -n 's/^\(Peer\|Server\) Temp Key: //p' &amp;lt;&amp;lt;&amp;lt;"&lt;/span&gt;&lt;span class="nv"&gt;$out&lt;/span&gt;&lt;span class="s2"&gt;" | head -1)"&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; -z &lt;span class="s2"&gt;"$group"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"none (RSA key transport)"&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$group"&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; *MLKEM* &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"PQ"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"NO_PQ"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;timeout 10&lt;/code&gt; is there because &lt;code&gt;s_client&lt;/code&gt; has no connect timeout of its own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trap 2: your fallback is not always what you think
&lt;/h2&gt;

&lt;p&gt;To make sure the script could say "no", I added a control: the same handshake offering &lt;strong&gt;only&lt;/strong&gt; X25519, which must come back classical.&lt;/p&gt;

&lt;p&gt;Against &lt;code&gt;sts.us-east-1.amazonaws.com&lt;/code&gt; it did come back classical, but not the way I expected. It did not finish TLS 1.3 with X25519. It negotiated &lt;strong&gt;TLS 1.2 with &lt;code&gt;AES128-GCM-SHA256&lt;/code&gt;&lt;/strong&gt;, which is RSA key transport: no ephemeral key, no forward secrecy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;h&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;sts.us-east-1.amazonaws.com
openssl s_client -connect &lt;span class="nv"&gt;$h&lt;/span&gt;:443 -servername &lt;span class="nv"&gt;$h&lt;/span&gt; -groups X25519 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;"^Protocol|Cipher is"&lt;/span&gt;
&lt;span class="c"&gt;# TLS 1.2, AES128-GCM-SHA256&lt;/span&gt;
openssl s_client -connect &lt;span class="nv"&gt;$h&lt;/span&gt;:443 -servername &lt;span class="nv"&gt;$h&lt;/span&gt; -tls1_3 -groups X25519 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null
&lt;span class="c"&gt;# handshake fails&lt;/span&gt;
openssl s_client -connect &lt;span class="nv"&gt;$h&lt;/span&gt;:443 -servername &lt;span class="nv"&gt;$h&lt;/span&gt; -groups X25519:P-256 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;"^Protocol|Temp Key"&lt;/span&gt;
&lt;span class="c"&gt;# TLS 1.3, P-256&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I repeated the X25519-only handshake on 56 public AWS endpoints: 29 fell back to TLS 1.2 like this, 27 stayed on TLS 1.3 with X25519. I did not find AWS documentation that explains it, so I am not guessing why.&lt;/p&gt;

&lt;p&gt;How much it matters is narrower than it looks. OpenSSL's defaults also offer P-256, and with P-256 the same endpoint stays on TLS 1.3. Only a client that offers X25519 alone gets the weaker connection, and it gets it silently, not as an error. I don't know how common those clients are.&lt;/p&gt;

&lt;p&gt;The lesson for testing: when you restrict what the client offers, check the protocol and cipher too, not just the group.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make the test able to fail
&lt;/h2&gt;

&lt;p&gt;A script that only ever prints "PQ" proves nothing. I ran three controls next to the real hosts:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Control&lt;/th&gt;
&lt;th&gt;Expected&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;a known host, offering only X25519&lt;/td&gt;
&lt;td&gt;&lt;code&gt;NO_PQ&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;does-not-exist.invalid&lt;/code&gt; (reserved, never resolves)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DNS_FAIL&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;192.0.2.1&lt;/code&gt; (TEST-NET, never routed)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;TIMEOUT&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All three came back as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  What one handshake does not tell you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It measures your client.&lt;/strong&gt; The server can prefer ML-KEM and your app can still connect classically, because your SDK, CLI or browser has to offer it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One name, many servers.&lt;/strong&gt; Each name resolves to several IPs and one handshake reaches one of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Only the key exchange.&lt;/strong&gt; Every certificate I saw on AWS endpoints was RSA 2048. Post-quantum key exchange protects recorded traffic; it does not make the server's identity post-quantum.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where I used it
&lt;/h2&gt;

&lt;p&gt;I ran this on the home pages of seven Brazilian banks (all seven picked &lt;code&gt;X25519MLKEM768&lt;/code&gt;) and on 56 public AWS endpoints in &lt;code&gt;sa-east-1&lt;/code&gt; and &lt;code&gt;us-east-1&lt;/code&gt; (46 picked ML-KEM, 10 stayed classical). The AWS results, compared with AWS's own readiness table, are in my case study on AWS Builder Center: &lt;a href="https://builder.aws.com/content/3MyD8Ger9bI25UO3EdvcyCEK4dn/is-your-aws-connection-post-quantum-i-checked" rel="noopener noreferrer"&gt;https://builder.aws.com/content/3MyD8Ger9bI25UO3EdvcyCEK4dn/is-your-aws-connection-post-quantum-i-checked&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/alan-veras/aws-pqc-tls-check" rel="noopener noreferrer"&gt;https://github.com/alan-veras/aws-pqc-tls-check&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you checked what your own HTTP client or SDK offers? I'd like to know which version first gave you &lt;code&gt;X25519MLKEM768&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was created with the help of AI. The commands and results come from runs on my own machine on December 3, 2026.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cli</category>
      <category>cybersecurity</category>
      <category>networking</category>
      <category>security</category>
    </item>
  </channel>
</rss>
