PQ Python

Fix key exchange this week, plan signature rotation, and watch upstream releases

Harvest-now-decrypt-later makes key exchange the first job: get every TLS hop and stored envelope onto ML-KEM hybrids now. Signatures are an online-forgery risk with thin library support, so rotate them deliberately over weeks to months.

State as of 3 Dec 2026

In short

  • Check ssl.OPENSSL_VERSION in every runtime: OpenSSL 3.5 or later negotiates X25519MLKEM768 with no code change (details).
  • Turn hybrids on at every edge and inner hop, then prove the negotiated group on fresh handshakes; “TLS 1.3 enabled” is not evidence (details).
  • Re-encrypt data sealed to X25519 or P-256 keys and rotate credentials that crossed X25519-only links such as GitHub HTTPS (details).
  • Start the signing-key inventory now, but rotate JWT, certificate, SSH, passkey and cloud keys over weeks to months as libraries allow (details).
  • Record evidence per hop or trust decision, with an owner and a date, not per installed package (details).

Start with the TLS terminator and the identity provider#

Start with the TLS terminator and the identity provider, not pip install -U fastapi cryptography. A FastAPI request has at least two independent protections: TLS establishes a secret for the connection, and the API verifies a token or other credential to decide who may use it. Moving one to post-quantum cryptography does not move the other. The same split separates downloading a wheel securely from verifying who published it.

The plan follows the two risk classes. Key exchange carries a retroactive harvest-now-decrypt-later risk that the NSA itself flags, and NSA, Filippo Valsorda and Valsorda’s critics all agree on fixing it first (how experts read the advisory). A signature break is an online-forgery risk: it only helps an attacker who can break a specific key at the moment they use it, and rotation fixes it. The joint statement’s “not… immediate and widespread” supports weeks to months for that work, not hours.

This alert is not a breach notification. It names no broken algorithm, CVE or package (what the documents say). Continue routine patching and investigate real compromise indicators separately. A confirmed compromise calls for incident response and evidence preservation; absent one, stop accumulating avoidable exposure, migrate shared trust deliberately and measure what actually changed.

Priority Who acts First decision or evidence
Now: traffic carrying long-lived secrets or sensitive records Ingress, platform, client and data owners The terminator and the group actually selected on each hop
Now, in parallel: keys trusted by many systems Identity, PKI, CI/release owners Issuers, CAs, mTLS identities, deploy keys, code signers and their verifiers
This week: application-level public-key use cryptography and application maintainers ECDH/X25519 encryption and ECDSA/Ed25519 signing outside TLS
Do not rotate on this alert alone Application owners AES data with independent keys, HMAC cookies, Argon2 hashes, SHA-256 digests (why)
Evidencethe ASTRA report's decision brief, in full
Priority Who should act First decision or evidence to obtain
Now: traffic carrying long-lived secrets or sensitive records Ingress, platform, client and data owners For each external and internal TLS hop, identify the terminator and the key-exchange group actually selected. Canary TLS 1.3 with an approved PQ or hybrid group. Do not count “TLS 1.3 enabled” as success.
Now, in parallel: keys trusted by many systems Identity, PKI, CI/release owners Identify token issuers, private CAs, mTLS identities, deploy keys, code signers and their verifiers. Record P-256/Ed25519 dependencies, who can rotate them, and how to stop accepting the old keys. Start here even if issuance of new signatures must wait.
This week: application-level public-key use cryptography and application maintainers Find ECDH/X25519 encryption or key wrapping and ECDSA/Ed25519 signing outside TLS. Match each use to a released protocol implementation and capable backend on both sides. Prioritize durable ciphertext and widely trusted signatures.
Do not rotate on this alert alone Application owners AES-encrypted data with independently protected keys, HMAC-only cookies, Argon2 password hashes, and SHA-256 artifact digests are not 256-bit elliptic curves. Inspect how their keys, transports and software updates are protected instead.
Backgroundhow the three reports' horizons line up
This page Claude report AGY report ASTRA report
Do now “Do now (this week)”: checklist items 1 to 10 P0, “Immediate (Today / Week 1)” “First 24 hours” and “24–72 hours”
Prepare “Prepare (weeks to months)”: items 11 to 20 P1, “Near-Term (Weeks 2–4)”, and P2, “Medium-Term (Q1–Q4 2027)” “First week” and “30 days and onward”
Monitor “Monitor” table Tracking items inside P1 and P2, plus “Verified References & Tracking Links” “What remains unknown”

Where the reports put the same task in different horizons, this page keeps the earlier horizon or says which report ranks it higher (details).

Run the response in four time boxes, each ending in evidence#

The ASTRA report proposes operational time boxes. They are recommendations, not NSA deadlines. Run identity and release-signing work alongside TLS rather than waiting for it to finish.

Each box ends with evidence a reviewer can check. The inventory produces a row per hop or trust decision; the canary produces counted handshakes; the first week produces tested verifiers and owned exceptions; the rollout produces a trend of negotiated PQ share.

When Owner Done when
First 24 hours Security lead and platform One row per hop or trust decision, unknowns marked (inventory)
24 to 72 hours Edge and client owners Fresh verified handshakes counted as hybrid, classical, failed or unknown (verify)
First week IAM, PKI and release teams Every verifier consumes the intended profile; every exception has an owner and expiry (exceptions)
30 days onward Service owners Negotiated PQ share trends up; old trust retired only after replacement is distributed (rollout)
Tablethe full time-boxed plan and its acceptance criteria (ASTRA)

These are recommended operational time boxes, not NSA deadlines. Run identity and release-signing work alongside TLS rather than waiting for it to finish.

When Owner and action Evidence of completion
First 24 hours Security lead + platform: identify long-confidentiality data, public ingress, egress, IdPs, private CAs, CI signers, offline recovery/update mechanisms. Capture actual runtime builds, policies and owners. A row per hop or trust decision, not per installed package. Mark unknowns explicitly. Identify exposure to retained ciphertext and classical trust anchors; do not declare a breach based on inventory.
24–72 hours Edge/client owners: canary TLS 1.3 plus the approved PQ/hybrid group on the highest-impact paths. For commercial compatibility, distinguish preferred from required. Audit egress and inner hops separately. Fresh verified handshakes from representative clients; count hybrid, classical, failed and unknown results. Measure handshake latency/retries, fragmentation or middlebox failures. A strict test cohort rejects a classical-only peer without disabling verification.
First week IAM/PKI/release teams: test private-PKI issuance, JWKS rollout, SSH keys and artifact verification. Ask CDN/IdP/HSM/KMS/CA vendors for exact algorithms, versions, availability, evidence and retirement dates. Each verifier can consume the intended profile; tests cover old/new clients, larger signatures, renewals, caches, mTLS and disaster recovery. Every legacy exception has an owner, containment, expiry and review date.
30 days and onward Service owners: widen successful canaries; enforce appropriate profiles on managed cohorts. Reissue/re-sign verified material; retire old issuers, keys and anchors only after replacement trust is distributed. Segment incapable peers and arrange replacement. Trend negotiated PQ share of fresh eligible handshakes, not just capability. Report classical/unknown share, coverage of long-lived data paths, and number of high-value verifiers still accepting old trust. Exercise a bounded rollback that does not silently weaken all clients.

The record format for the inventory and a read-only script to run inside each worker image are on the toolkit page.

Do now: put every TLS hop and every public-key envelope on ML-KEM#

This is the week-one work. Key exchange is where recorded traffic becomes readable later, and Python can mostly fix it today by moving every runtime onto OpenSSL 3.5 or later and checking every hop. The same urgency applies to data already encrypted to X25519 or P-256 public keys, because captured ciphertext cannot be protected after the fact.

Every Python runtime must link OpenSSL 3.5 or later#

python -c "import ssl; print(ssl.OPENSSL_VERSION)" must report 3.5 or later, preferably 3.5.6 or later, in every runtime. Hybrid key exchange depends on the OpenSSL the interpreter links, not on the Python version (TLS and interpreters).

Recipewhere to check, what to replace and what to move to

Check web servers, workers, cron jobs, CI images, Lambda and container bases, and developer machines. Run the check inside the actual worker image, not a developer shell (runtime audit scripts).

python -c "import ssl; print(ssl.OPENSSL_VERSION)"
  • Replace: python.org ≤3.12 / 3.13.0–3.13.15 / 3.14.0–3.14.5, Docker *-bookworm, Ubuntu 22.04/24.04 and Debian 12 system Pythons, Alpine 3.21 and macOS /usr/bin/python3.
  • Good targets: python.org 3.13.16+/3.14.6+/3.15.x, uv-managed Pythons (uv python upgrade for old installs), Docker python:*-trixie or *-alpine3.23+, Debian 13, Ubuntu 26.04, fresh conda-forge environments, RHEL 10.1.
  • AGY’s P0 version of the same step: migrate Dockerfiles off python:*-slim-bookworm to python:3.13-slim-trixie / python:3.15-slim / alpine3.24. On Ubuntu 24.04 or Python 3.12 hosts, deploy Python via uv python install (OpenSSL 3.5.10).
  • RHEL 9.7 / AL2023: run update-crypto-policies --set DEFAULT:PQ; crypto-policies keep the hybrid off until an admin does.

Already-installed uv-managed Pythons keep the OpenSSL they were built with, which is why the checklist says uv python upgrade for old installs. The reason for preferring 3.5.6 or later (a hybrid-group negotiation bug fixed in 3.5.6, reported by secondary sources) and the full per-distribution table are on the TLS page.

Sources disagree. The Claude report says RHEL 9.7 needs DEFAULT:PQ and RHEL 10.1 has PQ on by default; the AGY report says RHEL 9.8 needs DEFAULT:PQ and RHEL 10.2 has it on. The Claude checklist says *-alpine3.23+; the AGY report lists alpine3.22 to 3.24 with OpenSSL 3.5.10 Claude, AGY. See where the reports disagree.

Give hosts stuck on OpenSSL 3.0 a PQ-capable client until the runtime moves#

Some clients bring their own TLS stack and negotiate X25519MLKEM768 even on an OpenSSL 3.0 interpreter. Use them as a bridge on hosts you cannot rebase this week, not as a substitute for the runtime fix.

Recipeclients that bypass the host OpenSSL
  • niquests: niquests[rtls] is the AGY report’s “immediate client escape hatch” on Ubuntu 24.04 or Python 3.12 hosts.
  • grpcio: upgrade to grpcio >= 1.86.0. The AGY report says its bundled BoringSSL has preferred X25519MLKEM768 since 1.83.0; the Claude report read this from source and did not live-test it, and notes BoringSSL lacks SecP384r1MLKEM1024.
  • psycopg: upgrade to psycopg[binary] >= 3.3.9, which the AGY report says bundles its own PQ-capable TLS independent of host OpenSSL.
  • pycurl, or urllib3.contrib.pyopenssl.inject_into_urllib3() with a current cryptography wheel (pyOpenSSL, urllib3). Both bring their own newer OpenSSL; both negotiated X25519MLKEM768 on Python 3.10.16 / OpenSSL 3.0.16 in the Claude report’s tests.

Details per client are on the TLS page.

Delete every explicit classical curve list#

Any explicit classical-only curve list silently disables X25519MLKEM768. Search code, dependencies and proxy configs, and remove or replace every hit.

Recipethe kill-switch search
grep -rn "set_ecdh_curve\|ssl_ecdh_curve\|curvePreferences\|ecdh_curves\|set_tmp_ecdh"

Run it across application code, vendored dependencies and proxy configuration. In CPython, set_ecdh_curve() replaces the whole group list with one classical curve and cannot select a hybrid; nginx ssl_ecdh_curve, Traefik curvePreferences, Caddy curves and Envoy ecdh_curves do the same when set to classical-only lists (TLS page).

Turn on hybrid key exchange at every edge and every hop#

Most edges already prefer X25519MLKEM768; AWS ALB, Envoy and Azure Front Door need action, and granian cannot do it at all. Every hop that crosses an untrusted network counts, including proxy-to-app and CDN-to-origin legs.

Recipeedge by edge
  • Already on by default: Cloudflare, CloudFront, GCP load balancers (since Oct 2026), Caddy, and nginx/HAProxy on OpenSSL 3.5+.
  • Needs action: opt in on AWS ALB; configure Envoy (its default is X25519 + P-256); set Azure Front Door’s key-exchange policy; check the proxy-to-app and Cloudflare-to-origin legs.
  • Replace or front granian, whose ring-based rustls cannot do ML-KEM. The AGY report makes a PQC-capable reverse proxy “mandatory if using granian 2.8.9”.
  • AGY’s P0 version: put a PQC-capable reverse proxy (Cloudflare, AWS ALB PQC policy, Nginx OpenSSL ≥ 3.5, Envoy, Caddy) in front of every FastAPI, Django or Flask app (FastAPI, Django, Flask).
  • ASTRA’s 24 to 72 hour step: canary TLS 1.3 plus the approved PQ or hybrid group on the highest-impact paths. For commercial compatibility, distinguish preferred from required. Audit egress and inner hops separately.

Per-vendor defaults, documentation links and server hooks are on the TLS page and the infrastructure page.

Sources disagree. The AGY report lists Envoy among the PQC-capable proxies to put in front of apps; the Claude report quotes Envoy’s documentation that non-FIPS builds default to X25519 and P-256, so Envoy needs explicit configuration AGY, Claude. On AWS ALB, the Claude report says hybrids are opt-in per listener; the ASTRA report says console-created listeners default to a PQ policy while CloudFormation and CLI default to ELBSecurityPolicy-2016-08 Claude, ASTRA.

Prove the negotiated group on fresh handshakes#

Verify, do not assume. Neither the Python version, the cipher string, a client offer nor a successful HTTP request proves the group, so record what was actually negotiated on a fresh, verified connection.

Recipeverification commands and what counts as done
  • On Python 3.15, log SSLSocket.group() in a health check.
  • Elsewhere, hit https://pq.cloudflareresearch.com/cdn-cgi/trace and look for kex=X25519MLKEM768, or run:
curl -v --curves X25519MLKEM768 https://your.domain
  • If a middlebox chokes on the larger ClientHello, use ?X25519MLKEM768 without *, which defers the PQ key share to a HelloRetryRequest.

Evidence of completion (ASTRA, 24 to 72 hours): fresh verified handshakes from representative clients; counts of hybrid, classical, failed and unknown results; measured handshake latency and retries, fragmentation or middlebox failures. A strict test cohort rejects a classical-only peer without disabling verification. Do not count “TLS 1.3 enabled” as success.

Scripts, probes and where to read the group from terminator logs are on the toolkit page.

Pin cryptography floors in your own requirements#

Dependents allow cryptography versions as old as 3.3, so pin the floor yourself and feature-detect PQ support at runtime. Source builds on OpenSSL 3.0 or LibreSSL have no PQ even on a new version.

Recipewhich floor for which feature
  • cryptography>=48 for ML-KEM and ML-DSA in the official wheels.
  • >=50 for ML-DSA X.509 path validation.
  • >=51 for ssh-mldsa44-ed25519 keys.
  • Feature-detect with UnsupportedAlgorithm, since source builds on OpenSSL 3.0 or LibreSSL have no PQ (feature-detection snippet).
  • AGY’s P0 version: upgrade to cryptography >= 50.0.2 (or 51.0.1 once cut; official wheels) and pycryptodome >= 4.7.0, and drop pycryptodomex. The AGY report prefers 50.0.2 over 51.0.0 for anyone using Fernet/MultiFernet, because 51.0.0 has two non-security regressions that 51.0.1 fixes. Avoid OS-packaged cryptography linked to OpenSSL < 3.5.

pycryptodome 4.x carries its own ML-KEM, ML-DSA, SLH-DSA and X-Wing code with no OpenSSL dependency; the frozen pycryptodomex 3.x line has no PQ.

Upgrade SSH clients so key exchange is the ML-KEM hybrid#

Upgrade the OpenSSH that Ansible controllers use to 10.0 or later, ideally 10.6, and run paramiko 5.1.0+ or asyncssh 2.24.0+ on a PQ-capable cryptography backend. Without that backend, paramiko silently falls back to X25519 or P-256.

RecipeSSH key exchange by client
  • OpenSSH for Ansible controllers: ≥10.0, ideally 10.6. Ansible’s default transport = ssh uses the system OpenSSH, so the controller’s OpenSSH is the lever (AGY: upgrade control nodes to OpenSSH 10.6).
  • paramiko: ≥5.1.0 with cryptography ≥48 on an OpenSSL 3.5+/AWS-LC backend; otherwise it silently falls back to X25519 or P-256. Watch paramiko #2712 if you run FIPS: import fails under FIPS during ML-KEM availability detection (trackers).
  • asyncssh: ≥2.24.0 (Claude); the AGY report says asyncssh >= 2.24.2 with cryptography >= 51.0.0.
  • AGY’s P1 version: disable classical 256-bit ECC key exchange once the PQ hybrid negotiates. The AGY report schedules SSH for weeks 2 to 4; the Claude report puts key exchange in week one and keys in “prepare” (SSH keys).

Client-side configuration examples are on the infrastructure page.

Re-encrypt data sealed to X25519 or P-256 public keys#

Find every public-key envelope (PyNaCl SealedBox/Box, DIY ECIES, JWE ECDH-ES, HPKE DHKEM(X25519/P-256), age/pyrage X25519 recipients, GnuPG cv25519 subkeys) and re-encrypt long-lived data. Captured ciphertexts cannot be saved, so start with data that crossed networks.

Recipereplacements, and how to migrate an envelope safely

Find ECDH/X25519 encryption or key wrapping outside TLS (ASTRA’s “this week” row) and match each use to a released protocol implementation and capable backend on both sides. Prioritize durable ciphertext. For an encrypted archive, ask what wrapped its data key: changing TLS does not change an old envelope.

Replace with:

  • pyca HPKE KEM.MLKEM768_X25519 or KEM.MLKEM1024_P384 (cryptography). The AGY report’s P0 list replaces X25519, ECDH(SECP256R1), PyNaCl Box/SealedBox and pyrage.x25519 with cryptography.hazmat.primitives.hpke.Suite (MLKEM1024_P384 or MLKEM1024 or MLKEM768_X25519).
  • pycryptodome ≥4.2 HPKE X-Wing (pycryptodome).
  • Symmetric keys.
  • For age: re-encrypt to age1pq1 recipients with age ≥1.4.0 or rage ≥0.13 until pyrage PR #175 ships. The AGY report says the Go age >= 1.3.0 CLI (age-keygen -pq) already handles age1pq1 recipients (where the reports disagree).

Migrate safely (ASTRA): a migration may need a versioned envelope, new recipients, rewrapping or re-encryption, and a tested recovery path. It cannot recover confidentiality for an old copy already obtained. Use a reviewed protocol implementation, not a hand-built KEM/KDF/AEAD combiner. Working HPKE code is on the cryptography page.

Rotate credentials that crossed X25519-only links#

GitHub HTTPS still negotiates X25519 only, so every PAT and token sent over it is harvestable. Rotate those, long-lived pypi- tokens used from OpenSSL < 3.5 clients, and private-index credentials used from old clients.

Recipewhat to rotate and what to move to
  • GitHub PATs and tokens, because GitHub HTTPS is X25519-only. Prefer SSH with OpenSSH ≥9.0 for git.
  • Long-lived pypi- tokens used from OpenSSL <3.5 clients. Move to Trusted Publishing.
  • Private-index credentials used from old clients.

The host-by-host probe results and what an X25519 break would expose in the supply chain are on the supply-chain page.

Pin hashes for every install#

Hash-pin with uv.lock, pylock.toml or pip --require-hashes. SHA-256 pinning is the install-time control that survives any curve break, provided the hashes were approved independently of the file.

Recipehash pinning that holds up
  • Pin hashes with uv.lock, pylock.toml or pip --require-hashes (Claude).
  • AGY’s P1 version: switch CI/CD package installs to uv >= 0.13.12 with strict SHA-256 lockfile hash verification (uv lock / pip --require-hashes) rather than relying solely on Sigstore v1 P-256 attestations (uv, pip).
  • ASTRA’s version: protect lockfiles and CI workflows; pin all transitive artifacts with independently approved SHA-256 hashes and use pip hash-checking mode (--require-hashes, plus --only-binary :all: where feasible). A digest learned from the same untrusted source as the file is not an independent approval.

A lock is only as good as the index view it was produced from (what is not affected).

Stop sending sensitive Web Push payloads and add WireGuard pre-shared keys#

Web Push encrypts payloads with P-256 ECDH and has no PQ successor, so send an ID and fetch the content over PQ TLS. Add pre-shared keys to WireGuard configurations your tooling generates.

Backgroundwhy these two

pywebpush implements RFC 8291 payload encryption with ephemeral P-256 ECDH; push services relay the ciphertext, so a recorded payload is harvestable (FastAPI page). Jason Donenfeld advises WireGuard users to use the 256-bit pre-shared key option (infrastructure page).

Remove python-jose#

python-jose has had no release since May 2025, pins pycryptodome<4, uses pure-Python ecdsa and has no PS256, EdDSA or ML-DSA. Replace it with PyJWT, jwcrypto or joserfc.

Recipereplacements and why the AGY report ranks this P0
  • PyJWT >= 2.15.1 for JWS, or jwcrypto >= 1.6.3 for ML-DSA today, or joserfc >= 1.8.0 for JWE (AGY).
  • The Claude report files this under “Prepare” (“Leave python-jose”; “Treat the advisory as a reason to leave”).

Unverified. The AGY report ranks the removal P0 because of an unpatched CVE-2026-85394 (CVSS 9.1–9.3, DER key to HMAC confusion) AGY. The Claude report lists no CVE for python-jose.

Start the signing-key inventory now, in parallel#

Following NSA Action 1, list every system that signs or verifies with P-256, Ed25519, secp256k1 or RSA keys under 3072 bits, with who can rotate each key and how to stop accepting the old one. Issuance of new signatures can wait; the inventory should not.

Recipewhat to inventory and what counts as done

Grep for SECP256R1, ed25519, Ed25519PrivateKey, x25519, ES256, EdDSA, ES256K, ecdsa-sha2-nistp256, ssh-ed25519 and RSA keys under 3072 bits (Claude checklist item 11). Record algorithms per system, and flag long-lived, internet-facing or widely depended-on systems. Ready-made searches are on the toolkit page.

Identify (ASTRA, now in parallel): token issuers, private CAs, mTLS identities, deploy keys, code signers and their verifiers. Record P-256/Ed25519 dependencies, who can rotate them, and how to stop accepting the old keys.

First 24 hours (ASTRA): identify long-confidentiality data, public ingress, egress, IdPs, private CAs, CI signers, offline recovery/update mechanisms. Capture actual runtime builds, policies and owners.

Evidence of completion: a row per hop or trust decision, not per installed package. Mark unknowns explicitly. Identify exposure to retained ciphertext and classical trust anchors; do not declare a breach based on inventory. The record format is on the toolkit page.

Prepare: move signatures and authentication over weeks to months#

A signature break would allow forgery with a broken key, not decryption of past traffic, and rotation fixes it. That buys time, which is useful because Python’s library support is thin: ML-DSA is released in pyca, jwcrypto and py_webauthn verification, but not in PyJWT, paramiko, asyncssh, josepy/certbot or pywebpush. Classical stopgaps (ES384 or P-384, RSA-3072+) work today.

The reports rank some of these tasks in different horizons#

The AGY report puts python-jose removal, the JWT allowlist audit and the certbot curve change in P0; the Claude report puts them under “prepare”. This page keeps the earlier horizon where the task is cheap and the later one where it needs a key rotation.

Sources disagreethe same task in different horizons
Task Claude report AGY report ASTRA report
Remove python-jose Prepare (item 12) P0 (CVE claim) Not covered
Audit jwt.decode(..., algorithms=[...]) allowlists, Supabase ES256 Prepare (item 13) P0 First week (JWKS rollout tests)
certbot to P-384 or RSA-3072 and force-renew Prepare (item 14) P0 First week (PKI tests)
SSH key exchange Do now (item 6) P1 (weeks 2 to 4) First week (SSH keys)
Hash pinning Do now (item 9) P1 Not time-boxed
Signing-key inventory Prepare (item 11) Not listed Now, in parallel

This page places python-jose removal, SSH key exchange, hash pinning and the inventory under “Do now”, and the JWT, certificate and SSH-key rotations under “Prepare”.

Move JWTs you issue off ES256 and EdDSA#

Single-service HS256 tokens need no change. Move ES256 or EdDSA tokens to ES384 or to PS256/RS256 with a new RSA-3072+ key, then to ML-DSA-65 as libraries ship it, rotating through JWKS with algorithms pinned per issuer.

Recipethe JWT rotation
  • HS256 single-service tokens: no change. AGY: “Keep single-service monoliths on HS256”, provided the secret has ≥256 bits of entropy.
  • ES256 or EdDSA: move to ES384 or PS256/RS256 with a new RSA-3072+ key, asserting key.key_size >= 3072 yourself. With joserfc, pass algorithms=[...] explicitly.
  • Then ML-DSA-65 (ML-DSA-87 for CNSA 2.0) via jwcrypto today, or PyJWT once #1256 merges. The AGY report also tracks joserfc#129 and authlib#1086 (joserfc, Authlib).
  • Rotate through JWKS: old and new keys side by side, new kid, shorter TTLs, and pin algorithms= per issuer.
  • Also check private_key_jwt client-assertion keys, DPoP keys, signed URLs and webhook signatures.

The full rollout sequence for a controlled issuer, library support and code are on the FastAPI page.

Pin algorithms for tokens you verify and tolerate unknown key types#

Pin algorithms= per issuer and never trust the header alg. Make JWKS parsing tolerate an unknown kty such as AKP, so an IdP publishing ML-DSA keys does not break login.

Recipeverifier-side changes
  • IdPs (Google, Entra, Apple, Firebase, Auth0, Clerk) sign with RSA-2048 RS256. Pin algorithms=["RS256"] and never trust the header alg.
  • Make JWKS parsing tolerate unknown kty (AKP), and test with a synthetic entry. Whether PyJWT 2.15.1 skips or raises is disputed between the reports (unknowns).
  • Supabase ES256 projects should plan a rotation.
  • Sign in with Apple ES256 client secrets cannot be changed: guard and rotate the .p8 key.
  • AGY’s P0 version: audit all FastAPI jwt.decode(..., algorithms=[...]) calls, especially Supabase (ES256) apps, so IdP rotations to ES384/RS384/PS384/ML-DSA-65 do not cause outages. A hardcoded algorithms=["ES256"] breaks the moment the IdP rotates.

IdP-by-IdP JWKS results and the external-issuer checklist are on the FastAPI page.

Keep ML-DSA tokens out of browser cookies#

An ML-DSA-65 signature alone is 4,412 base64url characters, more than a 4,096-byte cookie. Move browser sessions to opaque server-side cookies, keep ML-DSA JWTs in Authorization headers, and raise proxy and server header limits before issuing them.

Recipesession and buffer changes
  • AGY’s P1 version: refactor browser-cookie JWT flows to BFF opaque session cookies (SessionMiddleware + server-side store), and raise Nginx large_client_header_buffers 4 32k + Uvicorn --h11-max-incomplete-event-size 65536 (Starlette, uvicorn).
  • Claude’s version: the PQ-era answer for browser sessions is opaque or HMAC-signed server-side sessions, which Starlette, Django and Flask already provide, not ML-DSA JWTs in cookies. Also check reverse-proxy limits on Authorization header size.
  • Measured sizes (ASTRA): signature segments of 3,227 / 4,412 / 6,170 characters for ML-DSA-44/65/87. Check cookie, header, gateway and proxy limits with real claim sizes.
  • Per-request cost (ASTRA): an ML-DSA-65 JWT adds 4,326 B to every request, about 3.7 TB a day at 10,000 requests per second. Reuse connections to keep handshake costs down; nothing in the transport reduces the token’s own cost (wire cost).

The full size table and per-server limits are on the FastAPI page.

Widen columns that store keys, signatures and tokens#

An ML-DSA-65 public key is 1,952 B, a signature 3,309 B and a JWT about 4.8 KB, so VARCHAR(255) to VARCHAR(1024) columns for keys, tokens, WebAuthn credentials or audit signatures will reject or truncate them ASTRA. Migrate them to text or binary types and index a fingerprint, not the key. SQLite does not enforce lengths, so run the test against your production database (storage).

Reissue certificates on P-384 or RSA-3072, and move private PKI to ML-DSA#

Re-issue P-256 leaves as P-384 or RSA-3072; renewals keep their old key type unless you change it. Move private PKI and mTLS to ML-DSA where both ends run OpenSSL 3.5+ Pythons, and check key types yourself after verify().

Recipecertbot, private PKI and verifier checks

Public leaves with certbot:

certbot renew --cert-name X --key-type ecdsa --elliptic-curve secp384r1 --force-renewal

Renewals do not change key type on their own. The AGY report’s P0 version sets the default in /etc/letsencrypt/cli.ini and force-renews P-256 certificates:

# /etc/letsencrypt/cli.ini — stopgap off P-256 (Let's Encrypt accepts secp384r1 and RSA 3072/4096; rejects secp521r1)
key-type = ecdsa
elliptic-curve = secp384r1
# Or RSA-3072:
# key-type = rsa
# rsa-key-size = 3072

Private PKI and mTLS: move to ML-DSA where both ends run OpenSSL 3.5+ Pythons (pyca ≥49 to sign, ≥50 to validate), otherwise to RSA-3072/P-384. AGY’s P1 version: re-key internal CAs and mTLS certs to ML-DSA-65/87 via cryptography >= 50.0.2, with P-384 / RSA-3072 stopgaps where peers lack ML-DSA TLS certificate support. ASTRA: distribute roots before changing leaves, and test expiry, revocation, recovery and eventual rejection of old chains.

Verifier check: add a post-verify() key-type check, since the pyca verifier accepts P-256 and RSA-2048.

Tests: replace trustme’s P-256 test CAs where tests should mirror production.

Recipes for ML-DSA CAs are on the cryptography page; certbot and ACME details are on the infrastructure page.

Add ML-DSA SSH keys and keep classical fallbacks for Python clients#

Follow Valsorda’s advice on OpenSSH 10.6: generate ssh-mldsa44-ed25519 keys and keep classical keys as fallbacks. paramiko, asyncssh, Fabric and netmiko cannot use the new keys, so dropping classical keys breaks every one of them.

Recipedual keys on OpenSSH 10.6 servers
  • Generate ssh-mldsa44-ed25519 keys and keep classical keys only as fallbacks for clients that cannot use them. Python clients (paramiko, asyncssh, Fabric, netmiko) cannot use the new keys.
  • In paramiko, prefer rsa-sha2-512 or ecdsa-sha2-nistp384 host keys where you control both ends; the exact configuration API was not verified.
  • AGY’s P1 version: maintain dual ssh-mldsa44-ed25519 + P-384/RSA-3072+ keys on OpenSSH 10.6 servers until paramiko and asyncssh add ssh-mldsa44-ed25519, and disable ssh-ed25519, ecdsa-sha2-nistp256 and classical key exchange. Ansible’s native ssh transport works with ssh-mldsa44-ed25519 today.

An asyncssh connection example restricted to PQ key exchange and non-256-bit host keys is on the infrastructure page.

Offer ML-DSA passkeys without requiring them#

Upgrade py_webauthn to 3.0 or later and put ML-DSA first in supported_pub_key_algs, but do not require it: almost no platform authenticator supports it yet. Users must register new credentials, so this is a re-enrolment programme.

Reciperelying-party changes
  • Upgrade to py_webauthn ≥3.0 and override supported_pub_key_algs with ML-DSA first.
  • Store each credential’s COSE algorithm and nudge users to add a PQ passkey.
  • Do not require ML-DSA yet.
  • Restrict access to the credential public-key table.
  • AGY’s P2 version (Q1–Q4 2027): roll out ML-DSA passkeys via python-fido2 >= 2.2.1 / py_webauthn >= 3.0.1 as Apple, Google and Microsoft OS passkey providers add native ML-DSA authenticator support (fido2).
  • ASTRA: test enrollment, recovery and re-enrollment with capable devices; do not disable phishing-resistant MFA on the strength of this alert.

The full algorithm order and authenticator status are on the FastAPI page.

Move cloud signing keys to ML-DSA where the KMS offers it#

AWS KMS and Google Cloud KMS offer ML-DSA keys and their Python SDKs already model them. Azure Key Vault has no PQ key types, and hvac cannot create Vault’s ML-DSA keys yet. Check what verifies the signatures before moving a key: several AWS managed services cannot use ML-DSA yet (boto3).

Recipecloud by cloud
  • Move AWS KMS and Google Cloud KMS P-256/Ed25519 signing keys to ML-DSA (boto3 and google-cloud-kms already model them). AGY’s P1 version: cloud signing to AWS KMS ML_DSA_65/ML_DSA_87 via boto3 >= 1.44.18.
  • Vault Enterprise users need raw hvac calls until PR #1235 ships.
  • Azure Key Vault has no PQ key types yet, so use RSA-3072+.
  • Note where SigV4a (multi-region S3, EventBridge and SESv2 global endpoints) is in use.

Details are on the infrastructure page.

Do not rely on P-256 Sigstore verification alone#

PEP 740 attestations, CPython’s Sigstore release signatures and the Sigstore TUF root all rest on P-256. Keep them, but add hash pinning, platform signatures and timestamp-required policies, and move private TUF repositories to ML-DSA.

Recipesupply-chain verification
  • Do not treat PEP 740 or CPython Sigstore verification as sufficient on its own until a PQ Sigstore root exists.
  • Prefer Authenticode/Apple signatures for CPython installers, plus hash pinning.
  • Use TSA-timestamp-required verification policies where tooling allows.
  • Rotate python-tuf repositories from Ed25519 to ML-DSA via securesystemslib ≥1.5.1 (Claude). AGY’s P1 version: migrate private TUF repos to securesystemslib >= 1.6.0 (ml-dsa-65/1) (tuf).
  • ASTRA’s promotion step: for high-value wheels, verify PyPI attestations against the expected publisher and repository during promotion, retain that evidence, then deploy the same approved bytes by hash. Record exceptions for missing attestations. Keep Trusted Publishing and current Sigstore verification; do not wait without controls or claim that a valid attestation proves code safety.
  • Verifiers and roots (ASTRA): plan a route to update the verifiers and trust roots themselves, including offline builders and recovery images.

Details are on the supply-chain page.

In FIPS mode, use the P-384 hybrids#

X25519 is disabled in pyca FIPS mode, so the MLKEM768_X25519 hybrid is unavailable; MLKEM1024_P384 and SecP384r1MLKEM1024 are the CNSA-shaped options. Neither path was tested in FIPS mode.

RecipeFIPS settings and limits
  • For TLS on Python 3.15, use set_groups("SecP384r1MLKEM1024:…"), since SecP384r1MLKEM1024 is not in OpenSSL’s default list.
  • For HPKE, use KEM.MLKEM1024_P384.
  • Neither path was tested in FIPS mode.
  • BoringSSL-based grpcio lacks this group.
  • paramiko 5.1.0 fails to import under FIPS (issue #2712, trackers).

Put algorithm choices behind configuration#

Hide algorithm choices behind configuration so the next rotation is a configuration change, not a refactor, in line with the NCSC’s 3 Dec 2026 cryptographic agility guidance.

Get exact algorithm answers from vendors and give every exception an owner#

Ask CDN, IdP, HSM, KMS and CA vendors for exact algorithms, versions, availability, evidence and retirement dates. Every legacy system that cannot move gets an owner, containment, expiry and review date.

Recipefirst-week testing and exception handling
  • First week (ASTRA): IAM, PKI and release teams test private-PKI issuance, JWKS rollout, SSH keys and artifact verification.
  • Evidence of completion: each verifier can consume the intended profile; tests cover old and new clients, larger signatures, renewals, caches, mTLS and disaster recovery. Every legacy exception has an owner, containment, expiry and review date.
  • This matches the advisory’s Action 6 (triage non-upgradable systems, use CNSA 1.0 algorithms as an interim, and deploy live traffic detection for weak cryptography) (advisory).
  • For an external IdP that cannot yet offer a PQ profile, keep strict current verification, limit lifetime and scope, and record the vendor dependency (FastAPI page).

Widen canaries, enforce, then retire old trust#

From 30 days onward, widen successful canaries, enforce profiles on managed cohorts, reissue and re-sign verified material, and retire old issuers, keys and anchors only after replacement trust is distributed. Track negotiated PQ share, not capability.

Reciperollout, measurement and runtime upgrades
  • Owner and action (ASTRA): service owners widen successful canaries; enforce appropriate profiles on managed cohorts. Reissue/re-sign verified material; retire old issuers, keys and anchors only after replacement trust is distributed. Segment incapable peers and arrange replacement.
  • Evidence of completion: trend negotiated PQ share of fresh eligible handshakes, not just capability. Report classical/unknown share, coverage of long-lived data paths, and number of high-value verifiers still accepting old trust. Exercise a bounded rollback that does not silently weaken all clients.
  • AGY’s P2 version (Q1–Q4 2027): upgrade production runtimes to Python 3.15+ for programmatic set_groups() / SSLSocket.group() / set_*_sigalgs() enforcement and telemetry, and track truststore proxy support.

Optional for CNSA 2.0: move Fernet and HS256 to 256-bit keys#

The AGY report lists this as non-urgent P2 work for ultra-conservative CNSA 2.0 compliance: phase Fernet (AES-128) to Cobblestone256 / AESGCM(256) and HS256 to HS384/HS512. Nothing in the advisory flags either (what is not affected).

Monitor: upstream releases and a technical disclosure decide the next step#

Several prepare-phase items are blocked on releases you cannot set: PyJWT’s ML-DSA PR, pyca’s SLH-DSA and CMS work, a PQ Sigstore root, MTC certificates, GitHub hybrid HTTPS and platform ML-DSA passkeys. A technical disclosure from NSA or the disclosing company would confirm or refute the 256-bit reading and settle RSA’s status.

Check these weekly. Every issue, PR and announcement, with links and status as of 3 Dec 2026, is on the trackers page; the open questions behind them are on the unknowns page.

Tablethe Claude report's monitor list
Watch item Why it matters Where
Any technical disclosure: paper, CVE or NSA clarification It would confirm or refute the 256-bit reading and the status of RSA NSA PQC Hub; Cloudflare (Prince: “we have time before any potential techniques are released”)
PyJWT PR #1256 ML-DSA for the 763M-download JWT library used by FastAPI PR
pyca: SLH-DSA (#14419), ML-DSA PKCS#7 (#16054), HPKE context (#16094), verifier knobs, any curve deprecation; 51.0.1 Completes the PQ toolkit pyca issues
CPython: set_groups/group() backports (none filed), docs gh-154517, PSF PQC PEP (3.16 window, May 2027) Control and observability on 3.13/3.14 PSF roadmap
pyrage #175, PyNaCl libsodium ≥1.0.22, paramiko/asyncssh ML-DSA keys, paramiko #2712, hvac #1235, granian aws-lc-rs, certbot #10838–#10841 Specific library gaps Respective trackers
Sigstore PQC (mid-2027), cosign #5269, sigstore-python ML-DSA, PEP 740 PQ bundles PQ supply-chain signatures Sigstore blog
MTC rollout: Cloudflare Q1 2027, Let’s Encrypt 2027, Chrome quantum-resistant root store about Q3 2027; certifi PQ roots or pruning PQ WebPKI authentication LE
GitHub HTTPS hybrid key exchange and ML-DSA SSH keys Largest harvest-now-decrypt-later gap in the Python supply chain GitHub changelog
IdP AKP keys / ML-DSA token signing; platform ML-DSA passkeys; Web Push successor Third-party timelines you cannot set OIDF, FIDO, IETF
EO 14412 180-day deliverables (about 19 Dec 2026); NIST IR 8547/SP 800-131A changes; NIST statement Regulatory dates for US-government suppliers EO text
Tablewhat the AGY report says to track
Item Horizon in the AGY report
PyJWT#1256, joserfc#129 and authlib#1086 “for imminent ML-DSA releases” P1
paramiko FIPS bug #2712 P1
truststore proxy support for Python 3.15’s group and sigalg APIs P2
Sigstore v2 (Identity Transparency + ML-DSA), “once operational (~mid-2027)” P2
Let’s Encrypt Merkle Tree Certificates in certbot (certbot#10706) P2
Native ML-DSA authenticators in Apple, Google and Microsoft OS passkey providers P2
cryptography 51.0.1 P0 (pin >=50.0.2 until it ships)

A typical FastAPI service needs work at the edge, the auth layer and the deploy pipeline#

FastAPI and Starlette contain no public-key cryptography of their own, and HS256 JWTs signed with your own secret, Starlette’s HMAC sessions and Argon2 password hashing are not implicated. Exposure comes from what surrounds the app: TLS termination and outbound clients, asymmetric JWTs and IdP tokens, passkeys, Web Push, app-level encryption and the dependency pipeline.

The table walks one service layer by layer. Most rows in the “Do now” column are the runtime fix; most rows in “Prepare” are key rotations; the rest wait on upstream (FastAPI page).

Tablea typical FastAPI service, layer by layer (Claude)
Layer Default exposure Do now Prepare Monitor
Edge TLS (CDN/LB/ingress) Depends on vendor (Envoy and ALB off by default) Enable X25519MLKEM768; verify with curl P-384/RSA-3072 leaf certificates MTC availability
uvicorn/gunicorn/hypercorn TLS (if terminating) PQ on OpenSSL ≥3.5 interpreters; none on bookworm/22.04/24.04 Move the base image to trixie/alpine3.23+/uv; on 3.15, ssl_context_factory with set_groups ML-DSA certificates for internal mTLS Python 3.15 adoption
granian No PQ (ring) Front with a PQ proxy or switch server Nothing aws-lc-rs provider
Outbound httpx/requests/aiohttp, DB drivers, KMS/secret fetches Inherit interpreter OpenSSL Same runtime fix; GitHub API traffic stays X25519-only Nothing GitHub PQ HTTPS
FastAPI/Starlette core, SessionMiddleware None (HMAC) Nothing Key-rotation hygiene Nothing
JWT signed with your own secret (HS256, the FastAPI tutorial’s choice) None Nothing Nothing Nothing
JWT ES256/EdDSA, or asymmetric service tokens Flagged under the reading Inventory ES384 / RSA-3072, then ML-DSA (jwcrypto or PyJWT #1256) PyJWT release
IdP token validation RSA-2048 (legacy tier) Pin algorithms= Tolerate AKP in JWKS IdP ML-DSA rollout
Passwords (pwdlib/Argon2) None Nothing Nothing Nothing
Passkeys (py_webauthn) ES256/EdDSA credentials Nothing ML-DSA first in registration options; track COSE alg Platform authenticators
Web Push (pywebpush) P-256 ECDH, harvestable Stop sending sensitive payloads Nothing IETF/browser successor
App-level encryption (SealedBox, JWE ECDH-ES) Harvestable Re-encrypt with pyca HPKE ML-KEM hybrids Nothing Nothing
Dependencies and deploy PEP 740 is P-256; FastAPI ships no attestations Hash-pin; Trusted Publishing; rotate tokens Do not rely on Sigstore alone Sigstore PQC

Key exchange was solved in the right place; authentication is the open problem#

This closing summarizes the Claude report’s conclusion. Key exchange was already solved, and solved in the right place. Because CPython delegates TLS to OpenSSL, the OpenSSL 3.5 default flip did more for Python’s harvest-now-decrypt-later posture than any Python release could have, and so did pyca’s May 2026 decision to ship ML-KEM in its wheels.

What is left is operational, not engineering: old interpreters, Debian 12 and Ubuntu LTS base images, set_ecdh_curve() hardening snippets, granian and Envoy defaults. A team that confirms ssl.OPENSSL_VERSION ≥ 3.5 on every hop has done most of what both Valsorda and Valsorda’s critics recommend, whatever the undisclosed result turns out to be.

Python’s authentication layer has almost no PQ path, and much of the ecosystem’s trust is concentrated on a single curve. PEP 740 attestations, CPython’s sole release signature since 3.14, the Sigstore TUF root, GitHub’s TLS certificate chain and the default keys of certbot, paramiko, py_webauthn’s registration options and pywebpush all converge on P-256 or Ed25519. What survives a hypothetical curve break is the “boring” layers: SHA-256 hash pins, HMAC and Macaroon tokens, HS256 JWTs, and RSA-signed OIDC and Authenticode.

That argues for treating hash-pinned lockfiles and HMAC sessions as security features rather than legacy. It also means the PSF’s planned PQC PEP, PyJWT’s ML-DSA PR and Sigstore’s mid-2027 PQ root are now work the whole ecosystem waits on, not nice-to-haves.

Sources cited on this page 8
  1. cryptographic agility guidance ncsc.gov.uk
  2. PR github.com
  3. pyca issues github.com
  4. PSF roadmap pyfound.blogspot.com
  5. Sigstore blog blog.sigstore.dev
  6. LE letsencrypt.org
  7. GitHub changelog github.blog
  8. EO text govinfo.gov

All sources across the guide