Get started
Guide · updated 4 Dec 2026

Crypto-agility: architecture patterns, CI gates and swap drills

December 2026 proved algorithms can weaken faster than expected. The end state isn't 'migrated' — it's 'can swap again in weeks'.

Principles

  1. Centralize crypto behind platform services — KMS, PKI, service mesh, TLS termination — instead of per-app code.
  2. Algorithm choice is config and policy, not code. Versioned, reviewable, deployable.
  3. No hard-coded assumptions. Remove fixed algorithms, OIDs, key sizes and signature lengths from code and database schemas (that VARCHAR(512) signature column won't hold 3,309 bytes).
  4. Negotiate, don't assume. Protocols that negotiate (TLS 1.3, SSH, HPKE) are agile by design; custom formats need explicit algorithm identifiers.
  5. Short-lived credentials. Automated issuance and rotation make re-keying routine.

Policy as config

# crypto-policy.yaml — consumed by platform libraries, mesh and CI
version: 2026-12
kex:
  allow: [X25519MLKEM768, SecP384r1MLKEM1024]
  fallback_until: 2028-12-31   # classical X25519 allowed for legacy clients
signatures:
  allow: [ML-DSA-65, ML-DSA-87, ECDSA-P256+ML-DSA-65]   # composite permitted
  firmware: [LMS, XMSS, SLH-DSA-128s]
symmetric: { min: AES-256-GCM }
banned: [RSA-1024, SHA1, 3DES, TLSv1.0, TLSv1.1]
exceptions_require: [owner, expiry, compensating_control]

Gate it in CI

A crude but useful first gate — fail the build when new code introduces quantum-vulnerable primitives outside approved wrappers:

#!/usr/bin/env bash
# ci/crypto-gate.sh — starting point; replace with a proper SAST/CBOM rule set
set -euo pipefail
PATTERN='RSA_generate_key|EC_KEY_new|ECDH_compute_key|generateKeyPair\("RSA"|KeyPairGenerator\.getInstance\("(RSA|EC)"|rsa\.GenerateKey|ecdsa\.GenerateKey'
if git diff --unified=0 origin/main... -- '*.c' '*.go' '*.java' '*.py' '*.ts' | grep -E "^\+" | grep -E "$PATTERN"; then
  echo "Quantum-vulnerable primitive added outside the crypto platform. See crypto-policy.yaml." >&2
  exit 1
fi

Track the KPI: number of quantum-vulnerable algorithm uses blocked by CI gates.

Run an algorithm-swap drill

Can you change a signature algorithm across a service tier in under 30 days? Pick a tier, swap ECDSA → ML-DSA (or composite) in staging, and time it.

Step What you learn
Change policy file Is algorithm choice really config?
Reissue certs/keys Is issuance automated? HSM throughput?
Deploy Which services hard-code sizes or OIDs?
Verify Do monitoring and logs show the new algorithm?
Roll back Can you reverse cleanly?

Report algorithm-swap drill time (days) to leadership. It's the single best measure of agility.

Maturity target

Level 5 ("Agile"): algorithms swappable via policy/config; automated detection of non-compliant crypto; PQ/PQ hybrids for crown jewels; drills tested. Aim for Level 3 by end-2027 and Level 4 on high-risk systems by 2029.