Crypto-Agility Engineering — Designing Systems for Algorithm Replacement Beyond Post-Quantum

Manish Garg
Manish Garg Associate of (ISC)² · RingSafe
May 8, 2026
4 min read
Read as
Crypto-agility is the engineering practice of designing systems so that cryptographic algorithms can be swapped via configuration, not via code re-architecture. The PQ migration is the forcing function for crypto-agility; once implemented, future algorithm changes (next-PQ generation in 2030+, post-PQ in 2040+) become routine. This module covers the design patterns: pluggable algorithm registries, multi-algorithm certificates, hybrid signatures, key-rotation infrastructure, and the organizational habits that make agility durable.

If your PQ migration ends with “we replaced RSA with ML-DSA and called it done,” you’ve done half the work. The other half: ensure that when ML-DSA is replaced by something else in 2032, you don’t go through the same painful inventory-and-replace cycle. Build the agility into the system; the migration is the opportunity.

What crypto-agility means in practice

A crypto-agile system has these properties:

  • Cryptographic algorithm choices live in configuration, not code. A YAML / TOML / DB-row says “for this purpose, use this algorithm.”
  • Multiple algorithms can be supported simultaneously. Migration period: producers sign with old + new; verifiers accept either. After full migration: drop old.
  • Algorithm identifiers are versioned: the wire format includes “alg=ML-DSA-65” not just “alg=signed.”
  • Library abstractions hide algorithm details from application code. Application says “give me a signature”; library handles which algorithm.
  • Key rotation is automated and well-rehearsed. New keys can be generated, distributed, and old keys retired without service disruption.

Pattern 1 — Pluggable algorithm registry

Application code should not name specific algorithms. Instead, register algorithm purposes:

// Bad: hardcoded
signature = sign_rsa_2048(message, key);

// Better: configurable
signature = crypto.sign(purpose="document_signing", message, key);

// Where crypto.sign reads from config:
// purpose: document_signing
//   algorithm: ml-dsa-65
//   key_source: hsm
//   fallback: rsa-2048  // for verifying old signatures

Libraries that already do this well: HashiCorp Vault (transit secrets engine), AWS KMS (alias-based keys), Google Cloud KMS (key purpose abstraction).

Pattern 2 — Multi-algorithm certificates

X.509 certificates traditionally have one signing algorithm. The “composite signature” extension (RFC 6916) and similar drafts allow a cert to carry multiple signatures (e.g., RSA AND ML-DSA). Verifiers check whichever they support.

For PQ migration, the practical pattern:

  1. Issue legacy ECDSA-signed leaf cert.
  2. Add a “certificate transparency”-style attestation containing an ML-DSA signature over the same cert content.
  3. Modern verifiers check both; legacy verifiers check only ECDSA.

Production-ready in 2025-2027 timeframe; experimental today via OQS-OpenSSL.

Pattern 3 — Hybrid signatures in JWT

JWT extension for hybrid:

{
  "alg": "PS256+ML-DSA-65",
  "typ": "JWT"
}
.
{
  "sub": "user-123",
  "iss": "auth.example.com",
  "exp": 1735689600
}
.
{
  "ps256_sig": "<base64>",
  "mldsa_sig": "<base64>"
}

Verifier checks based on its capability. Token is larger but explicit about the hybrid.

Pattern 4 — Algorithm versioning in stored data

Encrypted-at-rest data should carry algorithm metadata:

{
  "version": "v3",
  "kem_alg": "ml-kem-768",
  "kem_ciphertext": "<base64>",
  "aead_alg": "aes-256-gcm",
  "iv": "<base64>",
  "ciphertext": "<base64>",
  "tag": "<base64>"
}

When you migrate algorithms in 2030, the new format is “v4” with different alg names. Old encrypted blobs are still readable; new blobs use new algorithms. Decryption code handles both.

Pattern 5 — Automated key-rotation

If rotating a key requires manual operations across multiple systems, you’ll never do it preventatively. Automate:

  • Application keys: HashiCorp Vault, AWS Secrets Manager, GCP Secret Manager — auto-rotation with versioning.
  • TLS certificates: cert-manager (Kubernetes), Let’s Encrypt + acme.sh, AWS ACM.
  • SSH host keys: configuration management (Ansible, Salt) with playbook for rotation.
  • Code-signing keys: HSM-resident, with documented rotation runbook tested annually.

Pattern 6 — Forward-secrecy at the protocol layer

Even if your long-term keys are compromised in 2035, sessions encrypted with ephemeral PQ KEM keys remain confidential. TLS 1.3 enforces forward secrecy by design; ensure your stack negotiates only PFS-providing cipher suites (which all TLS 1.3 do).

Organizational habits for crypto-agility

  1. Quarterly cryptographic-inventory refresh. Don’t let the inventory go stale.
  2. Annual algorithm-deprecation review. NIST issues guidance; review and align.
  3. Cryptographic-design review for any new system handling sensitive data. Force engineers to specify algorithm choices and crypto-agility plan up-front.
  4. Centralised crypto library / service instead of every team rolling its own. Reduces inconsistency, simplifies migration.
  5. Documentation: maintain a cryptographic-bill-of-materials (CBOM). Like SBOM but for cryptographic primitives.

Anti-patterns to avoid

  • Hardcoded algorithm strings in application code. Always go through a library/abstraction.
  • “We’ll add agility later” — adding it to a deployed system is harder than designing for it.
  • One-time migration sprints without ongoing inventory. Migration is continuous.
  • “Vendor will handle it” — vendors handle their products; the integration glue is yours.
  • Mixing algorithm choices in unmanaged ways: half your microservices use ML-DSA-65, half use ML-DSA-44. Standardise.

FAQ

How do we balance agility with simplicity?

Start with the smallest set of supported algorithms (e.g., one classical + one PQ per purpose). Add support only when needed. Excess agility is expensive too.

Should every microservice be crypto-agile?

If it touches cryptography, yes. The cost of retrofitting is much higher than designing for it. Make crypto-agility a default architectural principle.

Are there frameworks for this?

HashiCorp Vault is the strongest open-source option; AWS KMS and GCP KMS are managed equivalents. For self-built apps: libsodium abstracts most cryptography; combine with config-driven algorithm selection.

How does crypto-agility interact with FIPS compliance?

FIPS validates specific algorithms in specific modes. Crypto-agility means your system supports multiple FIPS-validated algorithms with config-driven selection. Both compatible.

Will this matter beyond the PQ migration?

Yes. The next migration (post-PQ to whatever-comes-next) and the migration after that all benefit from agility. Build it once, harvest forever.


⚖️ Module 13 of 20. Advanced. Module 14 covers PQ-resistant PKI; Module 15 covers blockchain.

Want this for your team?

Custom team training + practitioner advisory

Beyond the free academy — we run private workshops, vCISO advisory, and red-team exercises tailored to your stack. For Indian SMBs scaling past their first hire.

Book team training call Replies in 4 working hrs · India-only · Senior consultants