Migrating from RSA and ECC
Old data stays readable, new data is post-quantum, and nothing is switched off before it is unused. The worked example is the uc8-migration use case.
01Inventory
pql scan --format json -o scan.json . # source, manifests, JWT/JWKS, TLS/SSH configs, PEM certs
pql cbom --from scan.json -o cbom.json # CycloneDX 1.7 CBOM
pql scan --fail-on-vulnerable . # exit 3 while anything quantum-vulnerable remainsScan output never contains key material. Triage by what an attacker can record today and decrypt later:
| Finding | Harvest-now risk | Move to |
|---|---|---|
| RSA-OAEP, ECDH or ECIES protecting stored or sent data | High | seal |
| TLS key exchange (X25519, P-256 ECDHE) | High for long-lived secrets | Hybrid TLS |
| Short-lived RS256 or ES256 login tokens | Low today | tokens |
| Code, release and webhook signatures | Medium: long-lived trust | sign, webhooks |
| SSH host keys, X.509 certificates | Depends on the PKI | Outside v0.1; tracked in the CBOM |
02Commit a policy
suite: PQL-DEFAULT
legacy: verify-only # old classical tokens and data readable, never created
rotate_every: 90d
cbom: ./cbom.json03Dual-read, post-quantum write
Data. Seal all new writes. On read, try the pqlock envelope first (pql1. text or PQL1 bytes) and fall back to the old decryption for older records. Re-encrypt old records in the background, then delete the legacy path when the backfill reaches zero.
Tokens. Issue only ML-DSA-65 tokens. Until the longest-lived old token expires, check old tokens with legacy.verifyJwt:
import { legacy, tokens } from 'pqlock';
const oldKeys = legacy.loadJwks(jwksJson);
function authenticate(token: string) {
try { return tokens.check(tokenKeys, token, { iss, aud }); }
catch { return legacy.verifyJwt(token, oldKeys, { iss, aud }); } // RS256 (2048+) and ES256 only
}old_keys = legacy.load_jwks(jwks_json)
claims = legacy.verify_jwt(token, old_keys, iss=iss, aud=aud)legacy.verifyJwt accepts only RS256 with keys of at least 2,048 bits and ES256, refuses none and HS256 confusion, and never issues. tokens.check never accepts a classical algorithm, so the two paths cannot be confused.
Transport. Put hybrid TLS in front and watch negotiatedGroup() to see how many clients still fall back.
04Done means
pql scan --fail-on-vulnerableexits 0, or lists only findings accepted in the CBOM.- The CBOM shows no quantum-vulnerable algorithms in use.
legacy: denyis set in the policy.
pqlock v0.1.0 · unaudited preview · source of truth: spec/