{"slug": "post-quantum-tls-on-agentgateway-how-to-turn-it-on-and-prove-it-works", "title": "Post-quantum TLS on agentgateway: how to turn it on and prove it works", "summary": "Agentgateway v1.8.1, built with the aws-lc-rs crypto backend, offers the hybrid X25519MLKEM768 post-quantum key-exchange group on any HTTPS listener by default, requiring no certificate changes, and operators can verify negotiation with OpenSSL 3.5 or newer via the output line \"Negotiated TLS1.3 group: X25519MLKEM768.\" The setup follows the NSA's December 2 advisory, Immediate Actions to Push Toward Post-Quantum, which directs operators to move TLS services to TLS 1.3 and enable post-quantum key exchange using the hybrids defined in RFC 10024. Setting minTLSVersion: TLS_V1_3 and keyExchangeGroups: [X25519_MLKEM768] on the listener refuses classical-only clients with a handshake failure (SSL alert number 40) instead of falling back, and the optional SymCrypt backend has no ML-KEM, so the hybrid is unavailable there.", "body_md": "The NSA’s December 2 advisory, [Immediate Actions to Push Toward Post-Quantum](https://media.defense.gov/2026/Dec/01/2004039413/-1/-1/0/CSA_Immediate_Actions_Push_Toward_PQC.PDF), tells operators to move TLS services to TLS 1.3 and turn on post-quantum key exchange where it is available, using the hybrids defined in [RFC 10024](https://www.rfc-editor.org/rfc/rfc10024).\n\nagentgateway supports the hybrid `X25519MLKEM768`, which combines classical X25519 with ML-KEM-768 (FIPS 203). It protects against harvest-now-decrypt-later attacks: a session recorded today stays safe unless an attacker breaks both X25519 and ML-KEM.\n\nHere is what to do, with a test after each step that proves it worked.\n\n`AgentgatewayPolicy`.\nYou don’t need to change your certificates for any of this.\n\nYou need agentgateway v1.8.1 built with the `aws-lc-rs` crypto backend. The official release binaries are. Check yours:\n\n```\n./agentgateway --version\n```\n\nLook for `\"crypto_backend\": \"aws-lc-rs\"` in the output. The optional SymCrypt backend has no ML-KEM, so the hybrid isn’t available there ([#3130](https://github.com/agentgateway/agentgateway/issues/3130)).\n\nTo run the tests you need OpenSSL 3.5 or newer, because earlier versions can’t offer `X25519MLKEM768`. Create a throwaway CA and a certificate for `localhost`:\n\n```\nmkdir -p certs && cd certs\nopenssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \\\n -keyout ca-key.pem -out ca.pem -days 30 -subj \"/CN=agw-pqc-test-ca\"\nopenssl req -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \\\n -keyout key.pem -out leaf.csr -subj \"/CN=localhost\"\nopenssl x509 -req -in leaf.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial \\\n -out cert.pem -days 30 \\\n -extfile <(printf \"subjectAltName=DNS:localhost,IP:127.0.0.1\\nbasicConstraints=CA:FALSE\\nextendedKeyUsage=serverAuth,clientAuth\")\ncd ..\n```\n\nThere is nothing to turn on. Any HTTPS listener in v1.8.1 offers the hybrid. Save this as `config-frontend.yaml`:\n\n``` php\n# yaml-language-server: $schema=https://agentgateway.dev/schema/config\nbinds:\n- port: 8443\n listeners:\n - name: pqc\n protocol: HTTPS\n tls:\n cert: certs/cert.pem\n key: certs/key.pem\n routes:\n - policies:\n directResponse:\n status: 200\n body: \"hello over tls\\n\"\n```\n\n**Test it.** Start the gateway and connect with a client that offers the hybrid:\n\n```\n./agentgateway -f config-frontend.yaml &\n\nopenssl s_client -connect 127.0.0.1:8443 -servername localhost \\\n -tls1_3 -groups X25519MLKEM768 -brief -CAfile certs/ca.pem\n```\n\nYou should see:\n\n```\nProtocol version: TLSv1.3\nVerification: OK\nNegotiated TLS1.3 group: X25519MLKEM768\n```\n\n`Negotiated TLS1.3 group: X25519MLKEM768` is the proof. OpenSSL 3.5 offers the hybrid first by default, so a plain `openssl s_client` without `-groups` gets the same result. The admin UI doesn’t show the negotiated group, so use OpenSSL to check.\n\nOlder clients still connect. They fall back to a classical group:\n\n| Client offers | Negotiated | \n|---|---|\n| OpenSSL 3.5 defaults | `X25519MLKEM768` | \n| `X25519MLKEM768` | `X25519MLKEM768` | \n| `X25519` only | `X25519` | \n| `secp256r1` only | `prime256v1` (P-256) | \n| TLS 1.2 client ( `-tls1_2` ) | `X25519` ,`ECDHE-ECDSA-AES256-GCM-SHA384` | \n\nRun the same command with `-groups X25519` and you get `Peer Temp Key: X25519, 253 bits` instead:\n\nAdd two lines to the listener’s `tls` block:\n\n```\n tls:\n cert: certs/cert.pem\n key: certs/key.pem\n minTLSVersion: TLS_V1_3\n keyExchangeGroups: [X25519_MLKEM768]\n```\n\nClients that can’t do the hybrid are now refused instead of falling back. The supported group names are `X25519`, `P-256`, `P-384` and `X25519_MLKEM768`.\n\n**Test it.** Restart the gateway. The command from Step 1 still connects with `X25519MLKEM768`. A classical client is refused:\n\n```\nopenssl s_client -connect 127.0.0.1:8443 -servername localhost \\\n -tls1_3 -groups X25519 -brief -CAfile certs/ca.pem\nssl/tls alert handshake failure ... SSL alert number 40\n```\n\nCheck your clients before you turn this on in production. Clients that only offer X25519 or secp256r1 get the same alert, and TLS 1.2 clients can’t connect at all. Browsers, Go, and curl built on OpenSSL 3.5 or newer already offer the hybrid. A safe way to roll it out is to add an enforced listener on a separate port and move clients to it.\n\nWhen agentgateway calls an upstream, the gateway is the TLS client. In v1.8.1 it sends an X25519 key share first. An upstream that prefers the hybrid has to ask for a retry, which costs a round trip, and an upstream that follows the client’s order settles on plain X25519. Make the gateway lead with the hybrid by setting `keyExchangeGroups` on `backendTLS`. Save this as `config-backend.yaml`:\n\n```\nbinds:\n- port: 8443\n listeners:\n - name: plain\n protocol: HTTP\n routes:\n - policies:\n backendTLS:\n root: certs/ca.pem\n hostname: localhost\n keyExchangeGroups: [X25519_MLKEM768, X25519]\n backends:\n - host: 127.0.0.1:9443\n```\n\nKeep `X25519` in the list so classical upstreams still work. The gateway sends both key shares, so an upstream without ML-KEM picks X25519 in the same handshake. [PR #4670](https://github.com/agentgateway/agentgateway/pull/4670) makes this the default in releases after v1.8.1.\n\n**Test it.** Run an OpenSSL server as the upstream with `-trace`, so it prints the handshake, and send a request through the gateway:\n\n```\nopenssl s_server -accept 9443 -cert certs/cert.pem -key certs/key.pem -www -trace\n./agentgateway -f config-backend.yaml &\ncurl -s -o /dev/null -w 'HTTP %{http_code}\\n' http://127.0.0.1:8443/\n```\n\nThe key exchange lines from `s_server -trace` should look like this:\n\n```\nClientHello, Length=1465\n extension_type=key_share(51), length=1258\n NamedGroup: X25519MLKEM768 (4588)\n NamedGroup: ecdh_x25519 (29)\nServerHello, Length=1206\n extension_type=key_share(51), length=1124\n NamedGroup: X25519MLKEM768 (4588)\n```\n\nThe proof is one ClientHello, no retry, and `X25519MLKEM768` in the ServerHello. The request returns `HTTP 200`.\n\n`keyExchangeGroups` works on `backendTLS` in route policies, per-backend policies and AI provider policies. It can’t be combined with `spiffe` in the same backend TLS block.\n\nOn Kubernetes, the same settings go in an `AgentgatewayPolicy`. Listener settings live under `spec.frontend.tls`, and `minTLSVersion: TLS_V1_3` becomes `minProtocolVersion: \"1.3\"`. The group names are the same.\n\nRequire the hybrid on every listener of a Gateway:\n\n```\napiVersion: agentgateway.dev/v1alpha1\nkind: AgentgatewayPolicy\nmetadata:\n name: pqc-frontend\n namespace: agentgateway-system\nspec:\n targetRefs:\n - group: gateway.networking.k8s.io\n kind: Gateway\n name: agentgateway-proxy\n frontend:\n tls:\n minProtocolVersion: \"1.3\"\n keyExchangeGroups: [\"X25519_MLKEM768\"]\n```\n\nLead with the hybrid on connections to an upstream Service:\n\n```\napiVersion: agentgateway.dev/v1alpha1\nkind: AgentgatewayPolicy\nmetadata:\n name: pqc-backend\n namespace: agentgateway-system\nspec:\n targetRefs:\n - group: \"\"\n kind: Service\n name: my-upstream\n sectionName: \"8443\"\n backend:\n tls:\n caCertificateRefs:\n - name: my-upstream-ca\n sni: my-upstream.example.com\n keyExchangeGroups: [\"X25519_MLKEM768\", \"X25519\"]\n```\n\n**Test it.** Point `openssl s_client` at your Gateway’s address and hostname, and look for the same `Negotiated TLS1.3 group: X25519MLKEM768` line as in Step 1:\n\n```\nopenssl s_client -connect <gateway-address>:443 -servername <your-hostname> \\\n -tls1_3 -groups X25519MLKEM768 -brief\n```\n\nIf a backend request starts failing after you apply the policy, check the proxy logs. When the crypto provider doesn’t support a listed group, or the policy also sets `certificateSource: SPIFFE`, the proxy rejects the backend TLS settings and every request to that backend fails, even though the policy status says `Accepted`:\n\n```\nkubectl logs -n agentgateway-system deploy/agentgateway-proxy | grep -i \"backend TLS policy\"\n```\n\nThe steps above protect the key exchange, and your ECDSA or RSA certificates can stay as they are. If you also want post-quantum signatures, agentgateway v1.8.1 supports ML-DSA-44, ML-DSA-65 and ML-DSA-87 certificates (FIPS 204) for listener certificates, backend TLS verification and mTLS client certificates. No extra configuration is needed. Generate the key with `openssl genpkey -algorithm ML-DSA-65` and use the certificate like any other.\n\n**Test it.** Ask for an ML-DSA signature and check both the signature type and the group:\n\n```\nopenssl s_client -connect 127.0.0.1:8443 -servername localhost \\\n -tls1_3 -sigalgs mldsa65 -brief -CAfile mldsa65/ca.pem\nSignature type: mldsa65\nVerification: OK\nNegotiated TLS1.3 group: X25519MLKEM768\n```\n\n`./agentgateway --version` shows `\"crypto_backend\": \"aws-lc-rs\"`.` openssl s_client -groups X25519MLKEM768` against your listener shows `Negotiated TLS1.3 group: X25519MLKEM768`.` openssl s_client -groups X25519` is refused with alert 40.`backendTLS` has `keyExchangeGroups: [X25519_MLKEM768, X25519]`, and `s_server -trace` shows a single ClientHello and `X25519MLKEM768`.", "url": "https://wpnews.pro/news/post-quantum-tls-on-agentgateway-how-to-turn-it-on-and-prove-it-works", "canonical_source": "https://agentgateway.dev/blog/2026-12-03-post-quantum-tls-agentgateway/", "published_at": "2026-12-03 00:00:00+00:00", "updated_at": "2026-12-03 16:46:50.612587+00:00", "lang": "en", "topics": ["ai-infrastructure", "ai-agents", "ai-policy"], "entities": ["agentgateway", "NSA", "RFC 10024", "X25519MLKEM768", "ML-KEM-768", "aws-lc-rs", "OpenSSL", "SymCrypt"], "also_reported_by": [], "takeaway": "agentgateway v1.8.1 with the aws-lc-rs backend negotiates X25519MLKEM768 on any HTTPS listener with no config, and adding minTLSVersion: TLS_V1_3 plus keyExchangeGroups: [X25519_MLKEM768] blocks classical-only clients with SSL alert 40 rather than letting them fall back.", "recommendation": {"advice": "Enable X25519MLKEM768 on agentgateway v1.8.1's aws-lc-rs build and verify with OpenSSL 3.5's s_client; before enforcing keyExchangeGroups, confirm clients support the hybrid or they will fail the handshake.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/post-quantum-tls-on-agentgateway-how-to-turn-it-on-and-prove-it-works", "markdown": "https://wpnews.pro/news/post-quantum-tls-on-agentgateway-how-to-turn-it-on-and-prove-it-works.md", "text": "https://wpnews.pro/news/post-quantum-tls-on-agentgateway-how-to-turn-it-on-and-prove-it-works.txt", "jsonld": "https://wpnews.pro/news/post-quantum-tls-on-agentgateway-how-to-turn-it-on-and-prove-it-works.jsonld"}}