🤔 Introducing APISIX AI Gateway – Built for LLMs and AI workloads. Learn More

Post-Quantum TLS (X25519MLKEM768) in Apache APISIX

On this page

Starting with Apache APISIX 3.20.0, apisix-runtime moved to OpenSSL 3.5.9 and brought hybrid post-quantum TLS 1.3 key exchange (X25519MLKEM768) on by default. For most deployments, nothing breaks and modern browsers immediately start negotiating quantum-resistant key shares. On the wire, though, one concrete thing changes: an outbound TLS 1.3 ClientHello grows from roughly 300–500 bytes to roughly 1,200–1,500 bytes.

That single detail explains both why Post-Quantum Cryptography (PQC) is ready for production API gateways today and what operators actually need to check before rolling out an upgrade.

Why Key Exchange Comes Before Certificates

When security teams ask whether an API gateway supports PQC, two very different mechanisms often get lumped together: key exchange and digital signature certificates.

Key exchange is urgent today because of Harvest-Now, Decrypt-Later (HNDL) attacks. An attacker can record encrypted TLS sessions on the wire now and hold them until a cryptographically relevant quantum computer can break classical elliptic-curve Diffie-Hellman (X25519 or P-256). If your APIs carry financial records, healthcare data, or long-lived secrets, that exposure window starts today, not ten years from now.

Certificates work differently. Breaking a certificate’s signature only helps an attacker actively impersonate a server during a live handshake; nobody can retroactively forge a handshake that already finished years ago. Meanwhile, public certificate authorities, browser trust stores, and X.509 tooling are still standardizing NIST FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA).

That is why the industry rolled out NIST FIPS 203 (ML-KEM) in TLS 1.3 key exchange first, specifically as the hybrid group X25519MLKEM768. Every handshake combines classical X25519 with ML-KEM-768 so session keys stay at least as strong as classical TLS 1.3 even if a weakness were ever found in one of the two algorithms.

What Apache APISIX 3.20+ Covers Out of the Box

In Apache APISIX 3.20.0 and later (apisix-runtime 1.4.2+ with OpenSSL 3.5.9+), X25519MLKEM768 is active in TLS 1.3 with zero extra configuration:

  • Client to APISIX (HTTPS / TLS 1.3): Modern clients such as Chromium-based browsers, Firefox, curl with OpenSSL 3.5+, and Go 1.24+ negotiate X25519MLKEM768 automatically. Older TLS 1.3 clients fall back to X25519 or prime256v1, and TLS 1.2 clients continue using classical ECDHE.
  • APISIX to Upstream (HTTPS / TLS 1.3): APISIX offers X25519MLKEM768 when initiating TLS 1.3 connections to upstream services and falls back automatically when an upstream only supports classical curves.
  • APISIX to etcd (HTTPS / mTLS): Negotiates X25519MLKEM768 when etcd is built with Go 1.24+ and falls back cleanly on older etcd binaries.

Classical RSA and ECDSA certificates remain in use for authentication on all hops.

Verifying PQC on a Real Connection

Do not assume PQC is active just because you upgraded the container image. Verify the actual negotiated group with OpenSSL 3.5 or newer:

openssl s_client -connect "<apisix-host>:9443" -servername "<your-domain>" -tls1_3 -groups X25519MLKEM768:X25519 -brief </dev/null

A working hybrid handshake prints:

Protocol version: TLSv1.3
Negotiated TLS1.3 group: X25519MLKEM768

Then run a second check with -groups X25519 to confirm that classical-only clients still connect cleanly:

openssl s_client -connect "<apisix-host>:9443" -servername "<your-domain>" -tls1_3 -groups X25519 -brief </dev/null

Measuring Adoption in Production Access Logs

A one-off s_client test proves the gateway supports X25519MLKEM768, but compliance teams usually want to know what fraction of production traffic actually uses it. Because APISIX runs on NGINX/OpenResty, you can log $ssl_protocol and $ssl_curve directly in conf/config.yaml:

nginx_config:
  http:
    enable_access_log: true
    access_log_format: '$remote_addr - $remote_user [$time_local] $http_host "$request" $status $body_bytes_sent $request_time "$ssl_protocol" "$ssl_curve"'
    access_log_format_escape: default

Hybrid sessions show up as "TLSv1.3" "X25519MLKEM768" while classical clients log "X25519" or "prime256v1". With HTTP keep-alive and upstream connection pooling enabled, the extra ~1.1 KB key share is amortized over connection reuse, so steady-state latency and throughput barely move.

The One Real Upgrade Pitfall: Split ClientHello Packets

Compliant servers handle X25519MLKEM768 gracefully, even when they do not support it. Where production rollouts get tripped up is in the middle of the network.

Adding an ML-KEM-768 key share pushes a TLS 1.3 ClientHello to ~1,200–1,500 bytes, which often splits across two TCP segments. Older stateful firewalls, load balancers, or deep packet inspection (DPI) appliances that expect an entire ClientHello inside the first TCP packet can stall or reset the connection.

If upstream HTTPS requests start timing out right after upgrading to APISIX 3.20.0+, run a two-line comparison from the APISIX host:

openssl s_client -connect "<upstream-host>:443" -servername "<upstream-sni>" -tls1_3 -groups X25519MLKEM768 -brief </dev/null
openssl s_client -connect "<upstream-host>:443" -servername "<upstream-sni>" -tls1_3 -groups X25519 -brief </dev/null

If X25519 succeeds while X25519MLKEM768 hangs or resets, you have found a network device that mishandles multi-packet ClientHello messages. While the network team updates that device, you can temporarily restrict outbound HTTP proxy groups in conf/config.yaml:

nginx_config:
  http_server_configuration_snippet: |
    proxy_ssl_conf_command Groups X25519:prime256v1:secp384r1;

For grpcs:// upstreams, add grpc_ssl_conf_command Groups X25519:prime256v1:secp384r1; in the same snippet. For APISIX-to-etcd and other OpenResty Lua cosocket connections (not proxy_pass), use lua_ssl_conf_command Groups X25519:prime256v1:secp384r1; in nginx_config.http_configuration_snippet. For TLS-terminating or TLS-originating L4 Stream routes (not tls_passthrough), place the matching directive under nginx_config.stream_configuration_snippet.

Note one protocol detail that trips people up: restricting ssl_ecdh_curve on the server side only controls server group selection and ServerHello size. It cannot fix an appliance dropping an inbound client’s oversized ClientHello, because the client sends ClientHello before seeing anything from APISIX.

Next Steps

If you are planning an upgrade to Apache APISIX 3.20.0+ or answering a PQC security review, the full reference—including hop-by-hop coverage, grpcs:// and Admin API notes, and verification commands—is available in the Apache APISIX Post-Quantum Cryptography documentation alongside the SSL Protocol guide. If you run into an edge case with a legacy network appliance or custom OpenSSL build, open an issue on the Apache APISIX GitHub repository.