PQ Python

Python ecosystem briefing, state as of 3 Dec 2026

Upgrade the encryption on your connections now. Plan new signing keys next

On 2 Dec 2026 the NSA told operators of US National Security Systems to speed up their move to post-quantum cryptography, after AI companies disclosed unpublished results. No algorithm is publicly confirmed broken, and experts disagree on whether today’s common elliptic curves, P-256 and Curve25519, are weakened. Both camps agree on the first step, and in Python most of it comes free with OpenSSL 3.5 or newer.

How to use this page

  1. Run the one-line check in every image that makes or accepts TLS connections.
  2. Work through the three lists below: what to do now, what to plan, and what to leave alone.
  3. Find your dependencies on the package wall, or open a topic page for the detail behind any item.

The one check that answers most of it

$ python -c "import ssl; print(ssl.OPENSSL_VERSION)"

OpenSSL 3.5.x or newer
Offers and prefers hybrid X25519MLKEM768 by default. No code changes.
OpenSSL 3.0.x to 3.4.x
Classical X25519 and P-256 only. Recorded traffic stays exposed.
LibreSSL
macOS /usr/bin/python3. Classical only.

Run it inside every image that terminates or originates TLS. A single set_ecdh_curve() call turns the hybrid off. Which builds pass, and how to verify the negotiated group

Do now#

Encryption, in transit and at rest Someone can record your encrypted traffic today, or copy data you stored encrypted with a public key, and keep it until they can break the maths that protects it. A newer, post-quantum method (ML-KEM) prevents this. For connections (the first three items below), it mostly comes free with OpenSSL 3.5 or newer. Data already stored and secrets already sent (the last two) need work of their own.

  • Upgrade every Python runtime to OpenSSL 3.5 or newer. OpenSSL is the library that encrypts Python’s connections, and from 3.5 it adds the post-quantum protection by itself. Run the check in each image and on each server. Debian 12 (bookworm) images, Ubuntu 22.04 and 24.04 system Pythons, and python.org installers for 3.12 and older are too old. Which builds pass
  • Delete settings that switch it back off. A set_ecdh_curve() call in Python, or a fixed list of curves in a proxy config, replaces OpenSSL’s new default with a single old method. Remove them so the default applies. How to find them
  • Turn it on at your load balancer or proxy. Browsers and API clients usually connect to a load balancer or proxy, not to your Python app, so that is where incoming traffic gets its protection. Cloudflare, CloudFront, Google Cloud and Caddy already do it. AWS load balancers (ALB) need a newer security policy, Envoy needs a config change, and the granian server cannot do it at all, so put a proxy in front of it. How to check
  • Re-encrypt stored data that was locked with a public key. This means data encrypted so that only the holder of a private key can read it, with PyNaCl SealedBox or age files for example. Upgrading OpenSSL does not change data that is already encrypted, so re-encrypt it with a post-quantum scheme such as pyca/cryptography’s HPKE with KEM.MLKEM768_X25519. Data encrypted with a shared secret key, such as Fernet or AES-GCM, does not need this. How
  • Replace tokens that may have been recorded, starting with GitHub’s. GitHub’s servers still use only the old method, even when your client offers the new one, so tokens and private code sent to GitHub over HTTPS could be read from a recording later. Rotate GitHub tokens, give the new ones short expiry dates, and use git over SSH, which GitHub already protects. Do the same for other secrets sent from machines with an old OpenSSL. Why GitHub

Prepare#

Signatures and identity Certificates, signed tokens and SSH keys prove who sent something. If the maths behind them were broken, someone could forge them from that point on, but could not go back and alter anything already checked. So there is time to replace keys on a schedule: stronger classical keys now, and post-quantum ML-DSA as your tools add support, which few Python libraries have yet.

  • Move your own signed tokens to stronger keys. If your service signs JWTs with a key pair (ES256 or EdDSA) so that other services can check them, switch to ES384 or an RSA key of at least 3072 bits now; common JWT libraries already support both. Move to ML-DSA later: jwcrypto can do it today, while PyJWT’s support is an open pull request (#1256). Tokens signed with a shared secret (HS256) need nothing. Tokens and auth
  • Reissue HTTPS certificates with stronger keys. Many certificates use P-256 keys. Reissue them as P-384 or RSA-3072, which Let’s Encrypt issues and Python clients already accept. With certbot, ask for the new key type explicitly, because renewals keep the old one. Certificates
  • Make room in your database for much larger keys and signatures. An ML-DSA public key is about 2 KB and a signature about 3.3 KB, roughly 30 to 60 times the size of today’s. A column sized for today’s values will reject them, or in some setups silently cut them short, and tests on SQLite will not notice because SQLite ignores column lengths. Widen these columns before the first ML-DSA value arrives. Storage
  • Add post-quantum SSH keys next to your current ones. OpenSSH 10.6 can create ssh-mldsa44-ed25519 keys, which combine a post-quantum and a classical signature. Keep your existing keys too: Python SSH libraries such as paramiko and asyncssh cannot use the new ones yet. SSH
  • Try ML-DSA first where you control both ends. Internal certificates, such as a private certificate authority or service-to-service mTLS, are the easiest place to start, because you decide what the clients accept. cryptography 49 or newer can sign ML-DSA certificates, and 50 or newer can verify chains of them. Private PKI
  • Do not rely on package signatures alone. PyPI’s attestations (PEP 740) show which repository and workflow built a release, but they are signed with P-256. Also pin the exact SHA-256 hash of every dependency, in a lockfile or with pip --require-hashes, which does not depend on signatures at all. Supply chain

Leave alone#

Passwords, shared secrets and hashes These rely on a secret that both sides already hold, or on a one-way hash, not on the public-key maths in question. Nothing in the advisory touches them, so spend no emergency effort here. The one thing to check is how their keys reached you.

  • Tokens and sessions signed with a shared secret. HS256 JWTs and the signed session cookies in Starlette, Flask and Django use HMAC: the same secret signs and checks them, and no public key is involved. Keep the secret at least 32 random bytes, and rotate it if it leaks. Details
  • Password hashes. Argon2, bcrypt, scrypt and PBKDF2 hashes involve no public keys, so stored hashes do not need to be recomputed.
  • Data encrypted with a shared key. AES-GCM, ChaCha20-Poly1305 and Fernet are not affected. The key, though, is only as safe as the way it arrived: a Fernet key fetched over a connection without post-quantum protection shares that connection’s risk. Key delivery
  • Hash pins in lockfiles. SHA-256 hashes in uv.lock, pylock.toml or a pip --require-hashes requirements file make sure you install exactly the file you expected, and a broken curve does not change that. Supply chain
  • PyPI API tokens. They are Macaroons, which are built on HMAC, so the token format is safe. A long-lived token sent from a machine with an old OpenSSL may still have been recorded on the way, so rotate those, as under Do now. Details
  • Why these are safe, and what still matters around them

Key exchange mostly has a path. Signatures mostly do not.

Each tile is a package or family, ordered by monthly downloads. Its two bars match the first two lists above: the left one rates encryption in transit and at rest (key exchange and public-key encryption), the right one signatures and identity. Open a tile for the details.

41 of 60

packages that do key exchange or public-key encryption have a post-quantum path today

16 of 72

packages that sign or verify have a post-quantum signature path today

24

can only offer a classical stopgap (P-384, RSA-3072) for signatures

24

ratings where a package is exposed by default with no path yet

  • PQ by default
  • PQ with action
  • Stopgap only
  • No path yet
  • Not affected
  • Unknown
  1. boto3 +12.4B
  2. requests1.49B
  3. cryptography1.38B
  4. PyJWT763M
  5. Starlette739M
  6. FastAPI567M
  7. google-auth447.8M
  8. itsdangerous219M
  9. Flask182M
  10. pyOpenSSL180M
  11. PyNaCl170M
  12. keyring166.2M
  13. Authlib161M
  14. docker +1157.1M
  15. joserfc154M
  16. azure-identity +1145.3M
  17. paramiko111.5M
  18. pycryptodome87.4M
  19. pycryptodomex56.5M
  20. Django52.6M
  21. ecdsa +142.1M
  22. python-jose30.6M
  23. hvac23.0M
  24. Ansible19.2M
  25. jwcrypto19M
  26. asyncssh17.5M
  27. google-cloud-kms15.6M
  28. pywebpush +114.9M
  29. python-gnupg +113.2M
  30. Fabric8.1M
  31. web3.py +25.4M
  32. coincurve3.0M
  33. josepy2.9M
  34. pyrage2.8M
  35. acme2.6M
  36. solders +12.4M
  37. trustme2.1M
  38. fastapi-users +41.41M
  39. certbot1.2M
  40. netmiko +11.0M
  41. matrix-nio +1823.8K
  42. python-bitcoinlib +1576.4K
  43. stem492.3K
  44. pqcrypto +4399K
  45. M2Crypto310K
  46. kyber-py +1251K
  47. liboqs-python56K
  48. quantcrypt2.5K
  49. aiohttp
  50. aioquic
  51. argon2-cffi +3
  52. asyncpg +2
  53. awscrt
  54. certifi
  55. conda +2
  56. CPython ssl module
  57. curl_cffi +1
  58. Daphne
  59. Granian
  60. grpcio
  61. Gunicorn
  62. HTTPX
  63. Hypercorn
  64. niquests +2
  65. pip
  66. pixi +1
  67. poetry +1
  68. Psycopg 3
  69. py-ecc +2
  70. py_webauthn
  71. PycURL
  72. pypi-attestations
  73. python-fido2
  74. python-tuf +1
  75. sigstore-python
  76. tink-py
  77. Tornado
  78. truststore
  79. Twisted
  80. urllib3
  81. uv
  82. Uvicorn
  83. Waitress

Open the sortable package table

Read by layer