How to migrate Node.js and Python apps to post-quantum cryptography

Upgrade containers to Node.js on OpenSSL 3.5 (24.22.3 ships 3.5.9) and Python 3.15 linked to OpenSSL 3.5, because OpenSSL 3.0 lacks X25519MLKEM768. Require TLS 1.3 with X25519MLKEM768:X25519 and verify it in tests. Rotate jose and PyJWT to ES384 via a dual-key JWKS, upgrade cryptography keys, and audit lockfiles.
How to check OpenSSL 3.5 in Node.js and Python
Both runtimes inherit post-quantum TLS from their linked OpenSSL, so check your container first; see the NSA December 2026 advisory checklist.
node -p process.versions.openssl
python -c "import ssl; print(ssl.OPENSSL_VERSION)"
OpenSSL 3.5 adds ML-KEM, ML-DSA, and RFC 10024 hybrid groups, and puts X25519MLKEM768 first by default. Node.js on OpenSSL 3.5 (24.22.3 ships 3.5.9) and the uv-managed Python 3.15 build link OpenSSL 3.5.9; distro OpenSSL 3.0 packages have no ML-KEM.
| Component | Flagged | Interim | Target |
|---|---|---|---|
| Node TLS | X25519, P-256, OpenSSL 3.0 | X25519MLKEM768:X25519 | X25519MLKEM768 |
| Node JWTs | ES256, EdDSA, RS256 | ES384 or PS384 JWKS | ML-DSA-65 |
| Python TLS | set_ecdh_curve(), OpenSSL 3.0 | set_groups on 3.15 | X25519MLKEM768 |
| Python keys | SECP256R1, Ed25519, RSA-2048 | SECP384R1, RSA-3072 | MLDSA65PrivateKey |
| Python JWTs | ES256, EdDSA, RS256 | ES384 | ML-DSA |
How to enable X25519MLKEM768 TLS in Node.js
In Node.js on OpenSSL 3.5 (24.22.3 ships 3.5.9), default node:tls sockets already negotiate X25519MLKEM768, so audit repos for older images or ecdhCurve overrides. Set minVersion: 'TLSv1.3' and ecdhCurve: 'X25519MLKEM768:X25519' on servers and https.Agent, then drop :X25519 once peers upgrade. Check socket.getEphemeralKeyInfo() for X25519MLKEM768 on TLSv1.3 in CI; see Post-quantum TLS 1.3 for proxy behavior.
How to rotate jose JWTs to ES384 without downtime
Rotate jose signing from ES256, EdDSA, or RS256 to ES384 or PS384 in five steps:
- Generate an
ES384pair withgenerateKeyPair('ES384')and export its JWK with a newkid. - Publish the old key and new
ES384key together in your JWKS. - Verify tokens with
createRemoteJWKSetandjwtVerify, which selects bykid. - Switch issuers to sign new tokens with the new
kidand a boundedexp. Keep the old key in the JWKS until every old-key token with anexphas expired and, if any were issued withoutexp, the cutoff in step 5 has passed. Then remove it. - If older tokens were issued without
exp, set a cutoff date for them and revoke or reissue them before it. Only after that cutoff, addrequiredClaims: ['exp']to the verifier, as in the verifier below. Turning it on earlier rejects those older tokens while their key is still published.
import { SignJWT, createRemoteJWKSet, exportJWK } from 'jose';
import { generateKeyPair, jwtVerify } from 'jose';
const NEW_KID = 'es384-2026-12';
const { publicKey, privateKey } = await generateKeyPair('ES384');
const newPublicJwk = {
...(await exportJWK(publicKey)),
kid: NEW_KID,
};
const token = await new SignJWT({ sub: 'service-account' })
.setProtectedHeader({ alg: 'ES384', kid: NEW_KID })
.setIssuedAt()
.setExpirationTime('15m')
.sign(privateKey);
const jwks = createRemoteJWKSet(
new URL('https://auth.example.com/.well-known/jwks.json'),
);
const { payload } = await jwtVerify(token, jwks, {
requiredClaims: ['exp'],
});
node:crypto on OpenSSL 3.5 supports ml-dsa-65, ml-kem-768, and crypto.encapsulate; reserve ML-DSA for internal services until federated verifiers accept it. Audit node:crypto for 'ed25519', prime256v1, and modulusLength: 2048, and see Audit JWTs, SSH keys and certificates.
Run the Node.js and Python migration with Capy
Upgrading base images, TLS config, JWKS rotations, and lockfiles repo by repo stalls on CI follow-ups. Capy splits that work by repository:
- Captains split work to one thread per repo. Each thread opens and follows its pull request; Capy never merges unless someone asks for that merge.
- Each thread runs on an isolated cloud microVM. With the repo cloned, it runs your real test suite and TLS handshake checks before opening the PR.
- Capy Review checks every PR. Plain-English rules in
AGENTS.md## Reviewsand organization Review settings flag P-256, Ed25519, and sub-3072 RSA. - Automations run a stored prompt on a schedule. A weekly re-scan opens a PR when it finds new weak crypto.
See multi-repo code migrations for batch sizing and stop rules.
How to configure Python 3.15 TLS with ssl and requests
Python 3.15 adds set_groups(), get_groups(), and SSLSocket.group() to ssl, whereas older releases only expose single-curve set_ecdh_curve(). Assert s.version() == "TLSv1.3" and s.group() == "X25519MLKEM768" in CI, then drop :X25519 once peers upgrade.
import ssl
srv = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
srv.minimum_version = ssl.TLSVersion.TLSv1_3
srv.load_cert_chain("cert.pem", "key.pem")
srv.set_groups("X25519MLKEM768:X25519")
For requests, subclass HTTPAdapter to pass ssl_context via init_poolmanager for urllib3 2.x, and confirm ssl.OPENSSL_VERSION in the deployed image.
How to upgrade Python cryptography keys and PyJWT
In cryptography, change SECP256R1 to SECP384R1, raise RSA key_size to 3072, and move Ed25519 to P-384 or ML-DSA. cryptography 48.0.0 on OpenSSL 3.5 adds mldsa and mlkem, and PyJWT moves to algorithm="ES384" behind a dual-key JWKS.
from cryptography.hazmat.primitives.asymmetric import mldsa
private_key = mldsa.MLDSA65PrivateKey.generate()
data = b"signed-payload"
signature = private_key.sign(data)
private_key.public_key().verify(signature, data)
How to audit Node.js and Python lockfiles
Transitive dependencies can pin older crypto libraries:
- Node.js. Run
npm ls jose jsonwebtoken node-forgeand greppackage-lock.json. - Python. Run
uv tree | grep -iE 'cryptography|pyopenssl'and inspectuv.lockorpoetry.lockforcryptographyunder 48.0.0 orpyOpenSSL.
Skip pip-audit here because it checks advisories, not algorithms. Pair lockfile audits with scanning for RSA and ECC, blocking weak crypto in CI, and the Go migration guide.
Frequently Asked Questions
Why does Python fail to negotiate X25519MLKEM768 after code changes?+
Does Node.js on OpenSSL 3.5 negotiate X25519MLKEM768 by default?+
Why rotate JWTs to ES384 or PS384 before ML-DSA?+
Can Python 3.14 set hybrid TLS groups with set_ecdh_curve?+
Sources
- Node.js documentation: TLS (SSL)
- panva/jose: JWA, JWS, JWE, JWT, JWK, JWKS for JavaScript
- Python documentation: What is New in Python 3.15
- pyca/cryptography: Changelog
Spotted something out of date? Tell us at support@capy.ai.
Migrate Node.js and Python services with Capy
Start one Capy thread per repository on its own isolated cloud microVM to bump base images, swap keys behind a dual-key window, run handshake tests, and open pull requests.
- How to check OpenSSL 3.5 in Node.js and Python
- How to enable X25519MLKEM768 TLS in Node.js
- How to rotate jose JWTs to ES384 without downtime
- Run the Node.js and Python migration with Capy
- How to configure Python 3.15 TLS with ssl and requests
- How to upgrade Python cryptography keys and PyJWT
- How to audit Node.js and Python lockfiles
- FAQ
- Sources





