How to migrate a codebase to post-quantum cryptography

Migrate a codebase from RSA and ECC to post-quantum cryptography (PQC) in the order set by NSA's December 2026 advisory: inventory algorithms across code, configs and live traffic, enable TLS 1.3 hybrid key exchange with X25519MLKEM768 first, upgrade roots and certificates to ML-DSA (or interim RSA-3072 and P-384 where hardware blocks PQC), then update libraries and track non-upgradable systems. Across many repositories, write the migration spec and verification commands once, prove them in one pilot pull request, and fan out one coding agent per repository in batches while enforcing no-regression rules in code review. Target ML-KEM (FIPS 203) for key establishment and ML-DSA (FIPS 204) or SLH-DSA (FIPS 205) for signatures ahead of NIST IR 8547's 2030 deprecation and 2035 disallowance dates.
The December 2 joint statement from ONCD, NSA and CISA reported that American frontier AI companies disclosed discoveries "that impact the security of some cryptography currently in use." In consultation with those companies, the agencies assessed that recent advances "do not present an immediate and widespread threat to that cryptography," while calling on government and industry to expeditiously upgrade digital infrastructure and pointing to Executive Order 14412, which accelerates the federal move to post-quantum readiness. Alongside it, NSA's advisory, Immediate Actions to Push Toward Post-Quantum (PP-26-4956) set a six-step transition sequence for National Security Systems (NSS), paired with an NSA press release urging an immediate move to post-quantum cryptography (PQC) because adversaries already collect encrypted traffic to decrypt later.
Two public analyses clarify what to build toward. CIRG Statement 1 reviewed the November 16 lattice cryptography results shared by Anthropic and confirmed that its quantum quasi-polynomial-time algorithm costs far more than prior attacks against ML-KEM (FIPS 203) and ML-DSA (FIPS 204), sitting past 2^1000 quantum operations even for ML-KEM-512 and ML-DSA-44 with no classical improvement; ML-KEM and ML-DSA stay the targets. Separately, cryptographer Filippo Valsorda's analysis of the NSA advisory reads it as a signal that 256-bit elliptic curves (P-256, X25519 and Ed25519) are "likely broken or significantly weaker than we thought," that RSA-3072 and P-384 are interim stopgaps at best, and that teams should move to ML-KEM and ML-DSA as fast as their stacks allow.
Deadlines under NIST IR 8547 and OMB M-26-15
NIST IR 8547, finalized in October 2026, deprecates every quantum-vulnerable public-key algorithm after 2030 and disallows them under NIST standards after 2035. That covers RSA, ECDSA, EdDSA, Diffie-Hellman, ECDH/MQV and RSA key transport at every key size, tightening earlier SP 800-57 plans that only projected disallowing 112-bit-security schemes from 2031.
Under Executive Order 14412, OMB Memorandum M-26-15 adds federal milestones:
- January 2, 2030. Federal agencies must support TLS 1.3.
- December 31, 2030. High value assets and high impact systems must adopt PQC for key establishment.
- December 31, 2031. Those systems must adopt PQC for digital signatures.
- 2035. NSM-10 keeps 2035 as the overall federal deadline.
Many enterprise security reviews and compliance programs follow NIST guidance outside government work too. Planning active repository changes around 2030 leaves buffer for hardware and vendor dependencies that run toward 2035.
Target algorithms and interim stopgaps
Every repository converges on three NIST PQC standards, using CNSA 1.0 classical algorithms only as temporary bridges where hardware or external software lags.
- Key establishment. Move to ML-KEM (FIPS 203). In TLS 1.3 today, deploy hybrid key exchange per IETF RFC 10024 with
X25519MLKEM768, addingSecP256r1MLKEM768orSecP384r1MLKEM1024where compliance profiles require NIST curves. Pairing a classical share with an ML-KEM share keeps the handshake protected if either algorithm fails. - Digital signatures. Move to ML-DSA (FIPS 204) and SLH-DSA (FIPS 205) for certificates, private PKI, SSH authentication, code signing and tokens. For JOSE and COSE, IETF RFC 9964 registers
ML-DSA-44,ML-DSA-65andML-DSA-87with theAKP(Algorithm Key Pair) JWK key type. - Interim classical choices. Use RSA-3072 or larger and P-384 only as interim stopgaps for roots of trust, certificates and authentication where CAs, HSMs or SDKs cannot handle ML-DSA yet. Neither is quantum-resistant. Exclude 256-bit elliptic curves (P-256, X25519 alone and Ed25519 alone) from new configs, since NSA's advisory flags every curve other than P-384 and P-521 for ECDH and ECDSA.
- CNSA 2.0 sizes for NSS. National Security Systems must target the larger CNSA 2.0 parameters in the advisory appendix:
ML-KEM-1024,ML-DSA-87, AES-256, SHA-384 or SHA-512, and LMS or XMSS for firmware and software signing.
Order of work from NSA Steps 1 to 6
NSA's advisory targets National Security Systems, yet its six steps put quick wins with the widest reach first and map cleanly to multi-repo engineering work.
- Step 1, Inventory where cryptography is currently used. Enumerate TLS, IPsec, SSH, PKI, code signing, Wi-Fi and identity credentials across internet-facing and internal systems. Record algorithms for key establishment, signatures and certificates, flagging anything outside CNSA 2.0 and CNSA 1.0: DSA, curves other than P-384 or P-521 (which rules out P-256), EdDSA (in practice Ed25519), deprecated Diffie-Hellman groups and pairing-based schemes such as BLS signatures over BLS12-381. Source grep misses runtime defaults, transitive dependencies, managed load balancers and external CAs, so combine code scans with manifests, IaC checks, live probes and a CycloneDX 1.6 cryptography bill of materials (CBOM). Prioritize internet-facing services, shared libraries and long-lived sensitive data. See How to scan a codebase for RSA and ECC.
- Step 2, Move TLS services to TLS 1.3 with approved crypto profiles. Enable hybrid key exchange (
X25519MLKEM768) on proxies, load balancers and application listeners, and drop weaker elliptic-curve and deprecated DH groups such as IKE groups 22 to 24. Because TLS 1.3 configures key establishment separately from cipher suites, inspectCurvePreferences,ssl_ecdh_curve,ecdh_curvesand AWS ALBssl_policyin every repo. Keep TLS 1.2 on CNSA 1.0 only where clients require it, and record servers that support neither. See How to enable post-quantum TLS 1.3 with X25519MLKEM768. - Step 3, Stand up PQC Certificate Authorities and roots of trust. Prepare private CAs and engage external CA providers early. Verify RSA-3072 or P-384 as the interim base size for roots when updating PKI before ML-DSA roots work end to end; NSA notes RSA-2048 may be required for legacy support in certain instances.
- Step 4, Replace or reconfigure certificates, PKI, and code signing. Reissue internal X.509 certificates, rotate JWT signing keys, move OpenSSH 10.6 hosts to hybrid
ssh-mldsa44-ed25519keys, and re-sign software and firmware packages. Ship new trust anchors first, then delete old chains after cutover, because authentication stays exposed while a vulnerable trust anchor remains accepted. See Moving JWT, SSH, certificates and code signing off 256-bit ECC. - Step 5, Update and upgrade software and firmware to enable PQC. Upgrade container base images, OpenSSL to 3.5 or newer, Go toolchains, Envoy, OpenSSH and crypto SDKs, starting with internet-facing edges and shared infrastructure. Configure each upgraded service to use the approved profile exclusively and remove non-PQC defaults or kill switches like
GODEBUG=tlsmlkem=0. Log non-upgradable products as risks. - Step 6, Triage non-upgradable systems and add live detection for residual weak cryptography. Record every product that cannot upgrade, isolate it via network segmentation or a TLS-terminating proxy, and deploy live traffic detection such as network monitors or OpenSSH 10.6
WarnWeakCryptologs to drive remaining remediation.
Quick wins, interim stopgaps, and the full ML-DSA rollout
Separating work into three lanes cuts harvest now, decrypt later exposure immediately without waiting on HSM firmware or third-party JWT libraries.
| Lane | Work items | Rough effort | Dependencies and notes |
|---|---|---|---|
| Quick wins | Enable X25519MLKEM768 in nginx, HAProxy, Envoy and Go TLS; upgrade OpenSSH to 10.0+ for the default mlkem768x25519-sha256 key exchange and 10.6 for WarnWeakCrypto and ssh-mldsa44-ed25519; remove GODEBUG=tlsmlkem=0 and P-256 CurvePreferences; move AWS ALB IaC off ELBSecurityPolicy-2016-08 to ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09 | Days to weeks | Needs OpenSSL 3.5+ for nginx/HAProxy and Go 1.24+ (1.26+ for SecP hybrids); test middleboxes for the 1,216-byte X25519MLKEM768 client key share |
| Interim stopgaps | Stand up RSA-3072 or P-384 private PKI roots and reissue leaf certs; rotate JWT signing from ES256, RS256 or EdDSA to ES384 or PS384; lock legacy TLS 1.2 listeners to CNSA 1.0 | Weeks to a quarter | Needs dual-key verification windows across services; interim bridge only, deprecated after 2030 under NIST IR 8547 |
| Full ML-DSA rollout | Deploy ML-DSA private PKI and prepare WebPKI certificate rotation; re-sign packages and firmware with ML-DSA or LMS/XMSS; adopt RFC 9964 ML-DSA-44, ML-DSA-65 or ML-DSA-87 JWTs with AKP keys | Quarters to multi-year | Blocked on CA chains, HSM/KMS support, JWT libraries and OS trust stores; track per system |
Running the migration across many repositories with coding agents
Platform teams often repeat the same TLS, base-image and signing changes across 20 to 200 repositories, each with its own CI and reviewers. How to run a code migration across many repositories with coding agents covers the generic pilot-then-fan-out method. Applying it to PQC adds runtime handshake proof, library-first ordering and dual-key waves.
Write the spec once and prove it in one pilot repo
Pick one bounded wave, such as Step 2 hybrid TLS configs and GODEBUG cleanup. Write one spec naming the exact edits per stack, the commands that prove the change, and explicit stop rules for what an agent must skip and escalate: custom HSM wrappers, pinned mobile clients and unmanaged external CAs.
Require live handshake proof in the spec rather than static config checks alone. For a Go or reverse-proxy repository, run the test suite plus a probe against a local test server:
go test ./...
openssl s_client -connect 127.0.0.1:8443 -groups X25519MLKEM768 -brief </dev/null
A passing probe prints Negotiated TLS1.3 group: X25519MLKEM768. Verify the test image ships OpenSSL 3.5 or newer, since stock 3.0.x builds cannot negotiate the hybrid group.
Pilot the spec on one small, representative repository, review that pull request closely, and merge it before scaling. Fold pilot surprises back into the spec, such as fixed-size proxy buffers rejecting the 1,216-byte client key share or Go services whose explicit CurvePreferences dropped default hybrids.
Migrate shared libraries first and plan dual-key waves
Upgrade shared crypto packages, auth SDKs, Terraform modules and base Docker images first, and release them before fanning out to consuming services. Downstream repositories then adopt the updated library cleanly without mid-flight conflicts.
Because pull requests in separate repositories merge independently, signing and certificate changes cannot switch atomically. Split cross-service auth rollouts into two waves:
- Wave 1, dual-accept. Update every verifier to accept both the existing key or root and the new one, such as
ES256besideES384or a classical root beside an interim or ML-DSA root, then deploy all verifiers. - Wave 2, rotate and remove. Switch issuers to the new key, confirm old traffic has drained, and run a cleanup wave removing old signing code and vulnerable trust anchors.
Fan out one thread per repository with a Captain
In Capy, put the target repositories in one project with a working Setup so builds and tests run cleanly. Create a Captain in that project and give it the pilot-tested spec in its first message. The Captain writes the standing rules to CREW.md in its Drive, which every crew thread reads on every turn.
Ask the Captain to fan out one thread per repository in batches, such as ten at a time, sized to your team's review bandwidth. Each thread runs on its own isolated cloud microVM (up to 64 GB RAM on Max) with the repository cloned and Setup applied, running go test and openssl s_client probes before opening a pull request. Each thread follows its pull request through CI and Capy Review. A failing check or review comment wakes that thread to push fixes to the same branch. Filter the Pull requests page by Captain to inspect the batch, while the Captain collects reports and brings you only the exceptions that need a person.
Preventing regressions and tracking non-upgradable systems
A completed migration drifts if a new service copies an old Terraform listener or adds ES256 signing next quarter. Hold the migrated baseline with two automated checks, and track non-upgradable hardware in structured Issues.
Commit PQC rules to each repository's AGENTS.md file. Capy Review reviews every pull request with the whole repository checked out, posts inline GitHub findings by severity and enforces AGENTS.md rules alongside logic bugs:
## Post-quantum cryptography rules
- Flag any new use of P-256 (`prime256v1`, `secp256r1`), X25519 alone, Ed25519 alone, or `ES256` in application signing, TLS configs, or IaC.
- Flag RSA keys shorter than 3072 bits (such as `rsa_bits = 2048`, `genrsa 2048`, or `req -newkey rsa:2048`).
- Flag TLS 1.3 server configs and AWS ALB listeners that omit `X25519MLKEM768` (or an AWS `PQ` security policy) or set `GODEBUG=tlsmlkem=0`.
- Flag explicit Go `crypto/tls` `CurvePreferences` slices that drop the default hybrid groups.
Pair pull request enforcement with a weekly Capy automation that scans the project for deprecated algorithms, legacy ALB policies or GODEBUG overrides and opens a pull request when it finds drift.
Coding agents update source code, IaC and container builds; they do not run live network monitors, issue external certificates or manage HSM hardware. For every appliance, firmware target or HSM blocking Step 5, open a Capy Issue (using sub-issues for segmentation or vendor follow-ups) with the NSA Step 6 fields:
- Product and patch level. Make, model, version and owning team.
- Affected algorithm. Which key establishment, signature or certificate algorithm cannot move yet.
- Mission criticality. Whether the system is internet-facing, protects long-lived sensitive data or sits in a shared critical path.
- Path forward. Plan of action and milestones (POA&M), hardware refresh, or both, plus the active CNSA 1.0 or isolation control.
Keeping those Issues next to the migration threads ties the hardware backlog directly to the repositories that depend on it.
What still needs a person
Coding agents absorb repetitive edits and CI loops across dozens of repositories, while four responsibilities stay with engineers and security owners.
- Merging pull requests. Capy never merges a pull request unless someone asks for that merge or a merge rule is committed in the repository's root
AGENTS.md. Review and merge bandwidth usually sets batch size before cloud machine capacity does. - Production cutover order. An engineer owns rollout order across dual-key waves, load balancer flips and trust-anchor removals, watching telemetry for middlebox drops on larger TLS 1.3 ClientHellos and confirming verifiers ship before issuers rotate.
- Root key generation and signing. Offline CA setup, HSM provisioning, root key generation and signing, and trust-store distribution stay under human custody and your key-management controls.
- Vendor asks and hardware acquisition. Pushing CDN, SaaS, firewall and HSM vendors for ML-KEM and ML-DSA schedules, and requiring quantum-resistant firmware and hardware roots of trust on new purchases, stay with security and procurement owners.
Frequently Asked Questions
Should teams pause ML-KEM and ML-DSA migration work after the November 2026 lattice research?+
What are the NIST IR 8547 and OMB M-26-15 deadlines for post-quantum cryptography?+
Are RSA-3072 and P-384 long-term replacements for P-256 and Ed25519?+
What order should an engineering team migrate cryptography across its repositories?+
How do coding agents migrate dozens of repositories without breaking production?+
How do you stop RSA-2048 or P-256 from creeping back into a migrated codebase?+
Sources
- CISA: Joint statement from ONCD, NSA and CISA on recent advances in cryptographic and cybersecurity capabilities
- NSA: NSA advises immediate transition to post-quantum cryptography
- NSA: Immediate Actions to Push Toward Post-Quantum (PP-26-4956)
- NIST IR 8547: Transition to Post-Quantum Cryptography Standards
- CIRG: Statement 1 on lattice cryptography results
- Filippo Valsorda: What to Make of the NSA Advisory
- IETF RFC 10024: Post-Quantum Traditional (PQ/T) Hybrid Key Agreement Mechanisms for TLS 1.3
- IETF RFC 9964: ML-DSA for JOSE and COSE
- Capy docs: Captains
- Capy docs: Reviews
Spotted something out of date? Tell us at support@capy.ai.
Ship your next feature with Capy
- Deadlines under NIST IR 8547 and OMB M-26-15
- Target algorithms and interim stopgaps
- Order of work from NSA Steps 1 to 6
- Quick wins, interim stopgaps, and the full ML-DSA rollout
- Running the migration across many repositories with coding agents
- Preventing regressions and tracking non-upgradable systems
- Post-quantum cryptography rules
- What still needs a person
- FAQ
- Sources




