Docs / Guides

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 finds RSA, ECDSA and ECDH in code, configs and certificates and writes a CycloneDX CBOM.
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 remains

Scan output never contains key material. Triage by what an attacker can record today and decrypt later:

FindingHarvest-now riskMove to
RSA-OAEP, ECDH or ECIES protecting stored or sent dataHighseal
TLS key exchange (X25519, P-256 ECDHE)High for long-lived secretsHybrid TLS
Short-lived RS256 or ES256 login tokensLow todaytokens
Code, release and webhook signaturesMedium: long-lived trustsign, webhooks
SSH host keys, X.509 certificatesDepends on the PKIOutside v0.1; tracked in the CBOM

02Commit a policy

pql.policy.yaml
suite: PQL-DEFAULT
legacy: verify-only      # old classical tokens and data readable, never created
rotate_every: 90d
cbom: ./cbom.json

03Dual-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

pqlock v0.1.0 · unaudited preview · source of truth: spec/