<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>pki &amp;mdash; Jerry of the Week</title>
    <link>https://write.in0rdr.ch/tag:pki</link>
    <description>ˈdʒɛri - Individual who sends life against the grain no matter the consequences</description>
    <pubDate>Thu, 30 Apr 2026 14:27:44 +0000</pubDate>
    <item>
      <title>Post-quantum TLS: Ready or not, here I come.. 🎵</title>
      <link>https://write.in0rdr.ch/post-quantum-tls-ready-or-not-here-i-come</link>
      <description>&lt;![CDATA[I was looking into the state of post-quantum (PQ) TLS lately. This short article summarizes how you can create PQ-ready TLS certificates today.&#xA;&#xA;#tls #pqc #PKI #certificates&#xA;!--more--&#xA;&#xA;liboqs is a library for prototyping and experimenting with quantum-resistant cryptography. It&#39;s used by the unsupported fork of OpenSSL of the Open Quantum Safe (OQS) project. With that fork, we can easily create TSL certificates that can be used in a PQ-secure client-server TLS communication.&#xA;&#xA;First you have to build the library, liboqs. On NixOS, I use these dependencies for the build:&#xA;&#xA;shell.liboqs.nix&#xA;{ pkgs ? import nixpkgs {} }:&#xA;  pkgs.mkShell {&#xA;    nativeBuildInputs = with pkgs.buildPackages; [&#xA;      cmake&#xA;      pkg-config&#xA;      openssl&#xA;      ninja&#xA;      libtool&#xA;      gcc&#xA;    ];&#xA;    buildInputs = with pkgs.buildPackages; [ openssl ];&#xA;    LDLIBRARYPATH = pkgs.lib.makeLibraryPath [ pkgs.openssl ];&#xA;}&#xA;&#xA;The build process itself is straight forward. It involves building liboqs and the OpenSSL fork:&#xA;prepare environment&#xA;$ nix-shell shell.liboqs.nix&#xA;&#xA;clone openssl fork&#xA;$ git clone --branch OQS-OpenSSL111-stable \&#xA;   https://github.com/open-quantum-safe/openssl.git openssl.git&#xA;&#xA;clone liboqs&#xA;$ git clone -b main https://github.com/open-quantum-safe/liboqs.git liboqs.git&#xA;&#xA;$ cd liboqs.git&#xA;&#xA;build liboqs into the folder of the openssl fork (CMAKEINSTALLPREFIX)&#xA;$ cmake -GNinja -DCMAKEINSTALLPREFIX=$HOME/Downloads/pqc/openssl.git/&#xA;&#xA;openssl   = 3.0.0 (3.0.14)&#xA;$ oqs -DOQSUSEOPENSSL=OFF ..&#xA;&#xA;$ ninja&#xA;$ ninja install&#xA;&#xA;build openssl fork&#xA;$ cd ../openssl.git&#xA;$ ./Configure no-shared linux-x8664 -lm&#xA;$ make -j&#xA;&#xA;$ apps/openssl version&#xA;OpenSSL 1.1.1u  30 May 2023, Open Quantum Safe 2023-07&#xA;&#xA;Luckily, the project includes short instructions on how to use the PQ-ready OpenSSL version to create web server certificates:&#xA;&#xA;create hybrid rsa/dilithium CA with the provided ssl config&#xA;$ apps/openssl req -x509 -new -newkey rsa3072dilithium2 \&#xA;   -keyout rsa3072dilithium2CA.key -out rsa3072dilithium2CA.crt \&#xA;   -nodes -subj &#34;/CN=oqstest CA&#34; -days 365 -config apps/openssl.cnf&#xA;&#xA;check CA certificate&#xA;$ apps/openssl x509 -in rsa3072dilithium2CA.crt -noout -text&#xA;&#xA;create hybrid rsa/dilithium server cert&#xA;$ apps/openssl req -new -newkey rsa3072dilithium2 \&#xA;   -keyout rsa3072dilithium2srv.key -out rsa3072dilithium2srv.csr \&#xA;   -nodes -subj &#34;/CN=oqstest server&#34; -config apps/openssl.cnf&#xA;&#xA;sign server cert with CA cert&#xA;$ apps/openssl x509 -req -in rsa3072dilithium2srv.csr \&#xA;   -out rsa3072dilithium2srv.crt -CA rsa3072dilithium2CA.crt \&#xA;   -CAkey rsa3072dilithium2CA.key -CAcreateserial -days 365&#xA;&#xA;check server cert&#xA;$ apps/openssl x509 -in rsa3072dilithium2srv.crt -noout -text&#xA;&#xA;run the server&#xA;$ apps/openssl sserver -cert rsa3072dilithium2srv.crt \&#xA;   -key rsa3072dilithium2srv.key -www -tls13&#xA;run the client with kyber KEX&#xA;apps/openssl sclient -groups p384kyber768 -CAfile rsa3072dilithium2CA.crt&#xA;&#xA;What I noticed during playing with the new algorithms: The term &#34;Hybrid&#34; does not mean you can choose the type of certificate for the Key exchange (KEX) or signature verficiation SIG standard. It simply means that you need both. Think of it as a fallback. If Kyber (KEX) or Dilithium (SIG) would turn out to not be that secure as everyone thought, your TLS communication (key exchange and signature verification) will still be backed by a proven industry standard algorithm (RSA or ECDSA), because you will always need to apply both algorithms to verify the signature or decrypt the traffic. Of course, this has impact on performance (e.g., time to create, encrypt/decrypt and/or verify).&#xA;&#xA;Lastly, I also checked out how I can sign a message in PQ-safe way using the Cryptographic Message Syntax (CMS):&#xA;&#xA;sign file&#xA;$ apps/openssl dgst -sign rsa3072dilithium2srv.key -sha256 \&#xA;   -out binary.sig -binary binary&#xA;&#xA;extract pubkey&#xA;$ apps/openssl x509 -in rsa3072dilithium2srv.crt -noout \&#xA;   -pubkey   rsa3072dilithium2srv.pem&#xA;&#xA;check signature&#xA;$ apps/openssl dgst -verify rsa3072dilithium2srv.pem -sha256 \&#xA;   -signature binary.sig -binary binary&#xA;&#xA;Of course we could go on playing with these demos, for instance, by building an application (like Nginx or curl, see oqs-demos) with support for the new algorithms. Oh, and don&#39;t forget VPNs..&#xA;&#xA;There is also a website that shows you where these new algorithms typically fail: https://tldr.fail. Also, I was wondering, when I can simply request these hybrid certifcates from my known and loved HashiCorp Vault PKI 🤗?&#xA;&#xA;https://github.com/hashicorp/vault/issues/27239&#xA;https://www.hashicorp.com/blog/nist-s-post-quantum-cryptography-standards-our-plans&#xA;&#xA;It will take some time, but I&#39;m ready (also enabled that feature toggle in my Firefox to let servers now). Let me know what you think about the topic.&#xA;&#xA;(now that I wrote the blog post I can go ahead and delete that temporary folder on my Desktop)&#xA;&#xA;div style=&#34;text-align:center; font-size: 0.8em&#34;&#xD;&#xA;a href=&#34;https://write.in0rdr.ch/feed&#34;&amp;#128732; RSS/a | a href=&#34;https://m.in0rdr.ch/in0rdr&#34;&amp;#128024; Fediverse/a | a href=&#34;https://chat.in0rdr.ch/#/guest?join=p0c@conference.in0rdr.ch&#34;&amp;#128172; XMPP/a&#xD;&#xA;/div]]&gt;</description>
      <content:encoded><![CDATA[<p>I was looking into the state of <a href="https://www.microsoft.com/en-us/research/project/post-quantum-tls/">post-quantum (PQ) TLS</a> lately. This short article summarizes how you can create PQ-ready TLS certificates today.</p>

<p><a href="https://write.in0rdr.ch/tag:tls" class="hashtag"><span>#</span><span class="p-category">tls</span></a> <a href="https://write.in0rdr.ch/tag:pqc" class="hashtag"><span>#</span><span class="p-category">pqc</span></a> <a href="https://write.in0rdr.ch/tag:PKI" class="hashtag"><span>#</span><span class="p-category">PKI</span></a> <a href="https://write.in0rdr.ch/tag:certificates" class="hashtag"><span>#</span><span class="p-category">certificates</span></a>
</p>

<p><a href="https://github.com/open-quantum-safe/liboqs">liboqs</a> is a library for prototyping and experimenting with quantum-resistant cryptography. It&#39;s used by the <a href="https://github.com/open-quantum-safe/openssl"><em>unsupported fork</em> of OpenSSL</a> of the Open Quantum Safe (OQS) project. With that fork, we can easily create TSL certificates that can be used in a PQ-secure client-server TLS communication.</p>

<p>First you have to build the library, <code>liboqs</code>. On NixOS, I use these dependencies for the build:</p>

<pre><code class="language-javascript"># shell.liboqs.nix
{ pkgs ? import &lt;nixpkgs&gt; {} }:
  pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages; [
      cmake
      pkg-config
      openssl
      ninja
      libtool
      gcc
    ];
    buildInputs = with pkgs.buildPackages; [ openssl ];
    LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.openssl ];
}
</code></pre>

<p>The <a href="https://github.com/open-quantum-safe/openssl/tree/OQS-OpenSSL_1_1_1-stable?tab=readme-ov-file#step-1-build-and-install-liboqs">build process</a> itself is straight forward. It involves building <code>liboqs</code> and the OpenSSL fork:</p>

<pre><code class="language-bash"># prepare environment
$ nix-shell shell.liboqs.nix

# clone openssl fork
$ git clone --branch OQS-OpenSSL_1_1_1-stable \
   https://github.com/open-quantum-safe/openssl.git openssl.git

# clone liboqs
$ git clone -b main https://github.com/open-quantum-safe/liboqs.git liboqs.git

$ cd liboqs.git

# build liboqs into the folder of the openssl fork (CMAKE_INSTALL_PREFIX)
$ cmake -GNinja -DCMAKE_INSTALL_PREFIX=$HOME/Downloads/pqc/openssl.git/

# openssl &gt;= 3.0.0 (3.0.14)
$ oqs -DOQS_USE_OPENSSL=OFF ..

$ ninja
$ ninja install

# build openssl fork
$ cd ../openssl.git
$ ./Configure no-shared linux-x86_64 -lm
$ make -j

$ apps/openssl version
OpenSSL 1.1.1u  30 May 2023, Open Quantum Safe 2023-07
</code></pre>

<p>Luckily, the project includes <a href="https://github.com/open-quantum-safe/openssl/tree/OQS-OpenSSL_1_1_1-stable?tab=readme-ov-file#running">short instructions</a> on how to use the PQ-ready OpenSSL version to create web server certificates:</p>

<pre><code class="language-bash"># create hybrid rsa/dilithium CA with the provided ssl config
$ apps/openssl req -x509 -new -newkey rsa3072_dilithium2 \
   -keyout rsa3072_dilithium2_CA.key -out rsa3072_dilithium2_CA.crt \
   -nodes -subj &#34;/CN=oqstest CA&#34; -days 365 -config apps/openssl.cnf

# check CA certificate
$ apps/openssl x509 -in rsa3072_dilithium2_CA.crt -noout -text

# create hybrid rsa/dilithium server cert
$ apps/openssl req -new -newkey rsa3072_dilithium2 \
   -keyout rsa3072_dilithium2_srv.key -out rsa3072_dilithium2_srv.csr \
   -nodes -subj &#34;/CN=oqstest server&#34; -config apps/openssl.cnf

# sign server cert with CA cert
$ apps/openssl x509 -req -in rsa3072_dilithium2_srv.csr \
   -out rsa3072_dilithium2_srv.crt -CA rsa3072_dilithium2_CA.crt \
   -CAkey rsa3072_dilithium2_CA.key -CAcreateserial -days 365

# check server cert
$ apps/openssl x509 -in rsa3072_dilithium2_srv.crt -noout -text

# run the server
$ apps/openssl s_server -cert rsa3072_dilithium2_srv.crt \
   -key rsa3072_dilithium2_srv.key -www -tls1_3
</code></pre>

<pre><code class="language-bash"># run the client with kyber KEX
apps/openssl s_client -groups p384_kyber768 -CAfile rsa3072_dilithium2_CA.crt
</code></pre>

<p>What I noticed during playing with the new algorithms: The term “Hybrid” does not mean you can choose the type of certificate for the Key exchange (<code>&lt;KEX&gt;</code>) or signature verficiation <code>&lt;SIG&gt;</code> standard. It simply means that you need both. Think of it as a fallback. If Kyber (<code>&lt;KEX&gt;</code>) or Dilithium (<code>&lt;SIG&gt;</code>) would turn out to not be that secure as everyone thought, your TLS communication (key exchange and signature verification) will still be backed by a proven industry standard algorithm (RSA or ECDSA), because you will always need to apply both algorithms to verify the signature or decrypt the traffic. Of course, this has impact on performance (e.g., time to create, encrypt/decrypt and/or verify).</p>

<p>Lastly, I also checked out how I can sign a message in PQ-safe way using the <a href="https://en.wikipedia.org/wiki/Cryptographic_Message_Syntax">Cryptographic Message Syntax (CMS)</a>:</p>

<pre><code class="language-bash"># sign file
$ apps/openssl dgst -sign rsa3072_dilithium2_srv.key -sha256 \
   -out binary.sig -binary binary

# extract pubkey
$ apps/openssl x509 -in rsa3072_dilithium2_srv.crt -noout \
   -pubkey &gt; rsa3072_dilithium2_srv.pem

# check signature
$ apps/openssl dgst -verify rsa3072_dilithium2_srv.pem -sha256 \
   -signature binary.sig -binary binary
</code></pre>

<p>Of course we could go on playing with these demos, for instance, by building an application (like Nginx or curl, see <a href="https://github.com/open-quantum-safe/oqs-demos"><code>oqs-demos</code></a>) with support for the new algorithms. Oh, and don&#39;t forget VPNs..</p>

<p>There is also a website that shows you where these new algorithms typically fail: <a href="https://tldr.fail">https://tldr.fail</a>. Also, I was wondering, when I can simply request these hybrid certifcates from my known and loved <a href="https://developer.hashicorp.com/vault/docs/secrets/pki">HashiCorp Vault PKI</a> 🤗?</p>
<ul><li><a href="https://github.com/hashicorp/vault/issues/27239">https://github.com/hashicorp/vault/issues/27239</a></li>
<li><a href="https://www.hashicorp.com/blog/nist-s-post-quantum-cryptography-standards-our-plans">https://www.hashicorp.com/blog/nist-s-post-quantum-cryptography-standards-our-plans</a></li></ul>

<p>It will take some time, but I&#39;m ready (also enabled that feature toggle in my Firefox to let servers now). Let me know what you think about the topic.</p>

<p>(now that I wrote the blog post I can go ahead and delete that temporary folder on my Desktop)</p>

<div style="text-align:center; font-size: 0.8em">
<a href="https://write.in0rdr.ch/feed">🛜 RSS</a> | <a href="https://m.in0rdr.ch/in0rdr">🐘 Fediverse</a> | <a href="https://chat.in0rdr.ch/#/guest?join=p0c@conference.in0rdr.ch">💬 XMPP</a>
</div>
]]></content:encoded>
      <guid>https://write.in0rdr.ch/post-quantum-tls-ready-or-not-here-i-come</guid>
      <pubDate>Mon, 07 Oct 2024 06:23:45 +0000</pubDate>
    </item>
  </channel>
</rss>