The NSA’s December 2 advisory, Immediate Actions to Push Toward Post-Quantum, 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.
agentgateway 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.
Here is what to do, with a test after each step that proves it worked.
AgentgatewayPolicy.
You don’t need to change your certificates for any of this.
You need agentgateway v1.8.1 built with the aws-lc-rs crypto backend. The official release binaries are. Check yours:
./agentgateway --version
Look 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).
To 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:
mkdir -p certs && cd certs
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \
-keyout ca-key.pem -out ca.pem -days 30 -subj "/CN=agw-pqc-test-ca"
openssl req -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \
-keyout key.pem -out leaf.csr -subj "/CN=localhost"
openssl x509 -req -in leaf.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial \
-out cert.pem -days 30 \
-extfile <(printf "subjectAltName=DNS:localhost,IP:127.0.0.1\nbasicConstraints=CA:FALSE\nextendedKeyUsage=serverAuth,clientAuth")
cd ..
There is nothing to turn on. Any HTTPS listener in v1.8.1 offers the hybrid. Save this as config-frontend.yaml:
binds:
- port: 8443
listeners:
- name: pqc
protocol: HTTPS
tls:
cert: certs/cert.pem
key: certs/key.pem
routes:
- policies:
directResponse:
status: 200
body: "hello over tls\n"
Test it. Start the gateway and connect with a client that offers the hybrid:
./agentgateway -f config-frontend.yaml &
openssl s_client -connect 127.0.0.1:8443 -servername localhost \
-tls1_3 -groups X25519MLKEM768 -brief -CAfile certs/ca.pem
You should see:
Protocol version: TLSv1.3
Verification: OK
Negotiated TLS1.3 group: X25519MLKEM768
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.
Older clients still connect. They fall back to a classical group:
| Client offers | Negotiated |
|---|---|
| OpenSSL 3.5 defaults | X25519MLKEM768 |
X25519MLKEM768 |
X25519MLKEM768 |
X25519 only |
X25519 |
secp256r1 only |
prime256v1 (P-256) |
TLS 1.2 client ( -tls1_2 ) |
X25519 ,ECDHE-ECDSA-AES256-GCM-SHA384 |
Run the same command with -groups X25519 and you get Peer Temp Key: X25519, 253 bits instead:
Add two lines to the listener’s tls block:
tls:
cert: certs/cert.pem
key: certs/key.pem
minTLSVersion: TLS_V1_3
keyExchangeGroups: [X25519_MLKEM768]
Clients 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.
Test it. Restart the gateway. The command from Step 1 still connects with X25519MLKEM768. A classical client is refused:
openssl s_client -connect 127.0.0.1:8443 -servername localhost \
-tls1_3 -groups X25519 -brief -CAfile certs/ca.pem
ssl/tls alert handshake failure ... SSL alert number 40
Check 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.
When 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:
binds:
- port: 8443
listeners:
- name: plain
protocol: HTTP
routes:
- policies:
backendTLS:
root: certs/ca.pem
hostname: localhost
keyExchangeGroups: [X25519_MLKEM768, X25519]
backends:
- host: 127.0.0.1:9443
Keep 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 makes this the default in releases after v1.8.1.
Test it. Run an OpenSSL server as the upstream with -trace, so it prints the handshake, and send a request through the gateway:
openssl s_server -accept 9443 -cert certs/cert.pem -key certs/key.pem -www -trace
./agentgateway -f config-backend.yaml &
curl -s -o /dev/null -w 'HTTP %{http_code}\n' http://127.0.0.1:8443/
The key exchange lines from s_server -trace should look like this:
ClientHello, Length=1465
extension_type=key_share(51), length=1258
NamedGroup: X25519MLKEM768 (4588)
NamedGroup: ecdh_x25519 (29)
ServerHello, Length=1206
extension_type=key_share(51), length=1124
NamedGroup: X25519MLKEM768 (4588)
The proof is one ClientHello, no retry, and X25519MLKEM768 in the ServerHello. The request returns HTTP 200.
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.
On 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.
Require the hybrid on every listener of a Gateway:
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: pqc-frontend
namespace: agentgateway-system
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: agentgateway-proxy
frontend:
tls:
minProtocolVersion: "1.3"
keyExchangeGroups: ["X25519_MLKEM768"]
Lead with the hybrid on connections to an upstream Service:
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: pqc-backend
namespace: agentgateway-system
spec:
targetRefs:
- group: ""
kind: Service
name: my-upstream
sectionName: "8443"
backend:
tls:
caCertificateRefs:
- name: my-upstream-ca
sni: my-upstream.example.com
keyExchangeGroups: ["X25519_MLKEM768", "X25519"]
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:
openssl s_client -connect <gateway-address>:443 -servername <your-hostname> \
-tls1_3 -groups X25519MLKEM768 -brief
If 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:
kubectl logs -n agentgateway-system deploy/agentgateway-proxy | grep -i "backend TLS policy"
The 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.
Test it. Ask for an ML-DSA signature and check both the signature type and the group:
openssl s_client -connect 127.0.0.1:8443 -servername localhost \
-tls1_3 -sigalgs mldsa65 -brief -CAfile mldsa65/ca.pem
Signature type: mldsa65
Verification: OK
Negotiated TLS1.3 group: X25519MLKEM768
./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.