QuantLayer Quantum

Design document, published from the repository at docs/pqc/QUANTLAYER_QUANTUM.md.

Status: implemented (FEAT-07). Decision record: ADR-0014. Benchmarks: BENCHMARKS.md. Code: rust/quantlayer-pqc (module), rust/quantlayer-pqc-node (Node-API bindings), packages/pqc-engine (TypeScript).

Ethereum is not made quantum-safe by this module. Ordinary Ethereum transactions are authorised by secp256k1 ECDSA. A cryptographically relevant quantum computer could derive the private key of any account whose public key is exposed, i.e. any account that has ever sent a transaction. QuantLayer Quantum protects QuantLayer-level authorizations, credentials and key agreement. It changes nothing about how the chain validates transactions. §9 lists everything that is still classical.

1. Implementation selection

No lattice or hash-based cryptography is implemented by QuantLayer. Every primitive comes from a maintained, independently developed library, pinned exactly:

StandardParameter setsLibrary (version)Assurance
FIPS 203 ML-KEM512, 768 (default), 1024libcrux-ml-kem 0.0.11 (Cryspen)Portable and AVX2 code formally verified (hax → F*: panic freedom, functional correctness against a spec). The NEON code is not covered by the proofs. QuantLayer builds the portable path only (no simd128/simd256 features).
FIPS 204 ML-DSA44, 65 (default), 87libcrux-ml-dsa 0.0.11 (Cryspen)Partially verified: field arithmetic, NTT and serialization. Portable path only.
FIPS 205 SLH-DSASHA2-128s, SHA2-128f, SHA2-256sfips205 0.5.0 (IntegrityChain)Pure Rust, ACVP-tested by its authors, documented constant-time design (control flow depends only on public data), and seeds wiped on drop. No known independent audit.

Alternatives considered (November 2026):

  • RustCrypto ml-dsa 0.1.2 / ml-kem 0.3.4. Widely used, but explicitly unaudited; ml-dsa had three 2026 advisories during its release-candidate phase (e.g. CVE-2026-24850, repeated hint indices accepted). It was kept out of the core in favour of libcrux's verification work.
  • RustCrypto slh-dsa. The 0.1.0 release no longer builds against the current signature pre-releases, and 0.2 is still a release candidate.
  • pqcrypto (PQClean). PQClean is archived and the crates are flagged unmaintained (RUSTSEC-2026-0164).
  • aws-lc-rs. Has a FIPS-validated ML-KEM, but ML-DSA sits behind an unstable flag, there is no SLH-DSA, and it needs a C/CMake toolchain. It remains a candidate for a FIPS 140-3 deployment profile.

Independent cross-checks run in the test suite:

  • Within Rust: differential tests against IntegrityChain fips204/fips203 check keys, deterministic signatures, ciphertexts and shared secrets byte for byte.
  • Against TypeScript: @noble/post-quantum 0.7.1 produces identical deterministic signatures and ciphertexts, verifies across implementations in both directions, and passes the same NIST keyGen vectors.

2. Algorithm identification and versioning

IdCodeKindNIST cat.Public keyStored seedExpanded SKSignature / ciphertext
ML-DSA-440x11signature2131232 (ξ)25602420
ML-DSA-650x12signature319523240323309
ML-DSA-870x13signature525923248964627
SLH-DSA-SHA2-128s0x21signature13248 (3n)647856
SLH-DSA-SHA2-128f0x22signature132486417088
SLH-DSA-SHA2-256s0x23signature5649612829792
ML-KEM-5120x31kem180064 (d‖z)1632768
ML-KEM-7680x32kem311846424001088
ML-KEM-10240x33kem515686431681568
  • Ids and codes. Ids equal the protocol registry in @quantlayer-protocol/crypto, which is append-only; codes are stable bytes used in QuantLayer's binary formats. The suite is quantlayer.pqc.v1 (SUITE_VERSION = 1). Every QuantLayer format carries a version byte: protected keys QLPQKEY1, hybrid signatures VH 0x01, and transition statements QUANTLAYER-PQC-TRANSITION-V1.
  • Fingerprints. SHA3-256("QUANTLAYER-PQC-FP-V1\0" ‖ code ‖ publicKey). Binding the code means one key encoding can't be read under another parameter set.
  • Private keys. A private key is its FIPS key-generation seed. The expanded encoding is derived from it in memory, which is the smallest and most portable form.

3. Interfaces (@quantlayer-protocol/pqc-engine)

InterfaceResponsibilityImplementation
PQCKeyProvidergenerate, activate, publicKey, exportProtected, importProtected. Secrets never returned.createNativePqcProvider()
PQCSignatureProvidersign(keyId, message, context?): hedged, FIPS 204/205 external "pure" interfacesame
PQCVerificationProviderstateless verify({algorithm, publicKey, message, context, signature}), fails closed (false)same, plus a @quantlayer-protocol/crypto SignatureVerifier adapter
HybridAuthorizationProviderauthorize (classical signer + ML-DSA-65) and verify (both halves required)createHybridAuthorizationProvider()
PQCKeyManagercreate, rotate, migrate, revoke, destroy, keyRing, custody, verifyTransitioncreatePqcKeyManager()
PQCKemProviderML-KEM encapsulate / decapsulatecreateNativePqcProvider()

The Rust crate exposes the same functionality: KeyPair, sign, kem, protect, hybrid and keystore::KeyStore. Through the p.signatureVerifier adapter, any QuantLayer component that uses composeSignatureVerifiers (identity, credentials) verifies ML-DSA and SLH-DSA signatures over signingInput(...) payloads with an empty FIPS context.

4. Key lifecycle (explicit states)

            activate             rotate / migrate (next version → active)
  pending ───────────▶ active ─────────────────────────▶ retired
     │                   │                                  │
     └──── revoke ───────┴──────────── revoke ──────────────┴──▶ revoked   (secret wiped)
  any state ──────────────────── destroy ──────────────────────▶ destroyed (secret wiped, terminal)
StateSignVerifyDecapsulateExport (sealed)Notes
pendingnononoyesFreshly generated or imported
activeyesyesyesyesAt most one per key id
retirednoyesyesyesKeeps old signatures and ciphertexts usable
revokednonononoCompromise or withdrawal; reason recorded
destroyednonononoEnd of retention; public metadata kept

The states are enforced where the secret lives (Rust KeyStore). PQCKeyManager mirrors every transition into the published @quantlayer-protocol/crypto KeyRing (pending, active, retired, revoked). That ring is the same model used for classical keys, so canSignWith and canVerifyWith behave identically everywhere. destroyed is custody-only: the published ring keeps a destroyed version's last public status. If create fails validation, for example on a key-agreement purpose for a signature key, the generated secret is destroyed immediately.

5. Private-key protection

  • At rest. The seed is sealed with XChaCha20-Poly1305 (the chacha20poly1305 crate) under a 256-bit KEK held in a KMS or HSM: "QLPQKEY1" ‖ 0x01 ‖ code ‖ len ‖ keyId ‖ version ‖ fingerprint ‖ nonce(24) ‖ ct ‖ tag. Everything before the nonce is associated data, so changing the algorithm, id, version or public key fails authentication. Nonces are 192-bit random values. Unsealing re-derives the key and checks the fingerprint, and the expected label is checked before anything is stored. Every failure returns the same PROTECTED_KEY_INVALID, so errors can't act as an oracle.
  • In memory.
    • Seeds and expanded keys live in Zeroizing buffers inside KeyStore, wiped on revoke, destroy and drop.
    • Libcrux ML-DSA signing keys are wiped after use; fips205 wipes its own.
    • Debug never prints secrets.
    • No API returns a private key; the only exception is sealed export.
  • Limits.
    • libcrux's ML-KEM key-pair value and the libraries' stack temporaries are not wiped; there is no safe API for that.
    • KEKs, shared secrets and messages cross into JavaScript as Buffers, and V8 may copy them. QuantLayer overwrites the buffers it owns, but it can't guarantee erasure in a garbage-collected heap.
    • The key store is in memory: persistence is the sealed blobs, and keys must be re-imported after a restart.

6. Hybrid classical + ML-DSA authorization

input     = "QUANTLAYER-HYBRID-V1" ‖ 0x00 ‖ len(scheme) ‖ scheme ‖ len(ctx) ‖ ctx ‖ message
classical = Ed25519.Sign(input)                     (RFC 8032; strict verification)
          | ECDSA-secp256k1-SHA256.Sign(input)      (low-S, 64-byte r‖s)
pq        = ML-DSA-65.Sign(input, ctx = "QUANTLAYER-HYBRID-V1")
signature = "VH" ‖ 0x01 ‖ code ‖ u16 BE len(classical) ‖ classical ‖ pq     (3,379 B for Ed25519)
  • Composition (AND). A hybrid signature verifies only if both halves verify over the same input. It stays unforgeable as long as at least one component is unforgeable: Ed25519/ECDSA against classical attackers and ML-DSA-65 against quantum ones.
  • Binding. The scheme id is inside the signed input, and the ML-DSA half uses a dedicated FIPS context. Neither half verifies as a standalone QuantLayer signature on the message, which signs "QUANTLAYER-SIG-V1:…", and a signature can't be relabelled under the other scheme. Tests check these cases, including high-S ECDSA rejection.
  • Who holds which key. The classical half comes from the caller's signer (a wallet or KMS); QuantLayer never holds that private key. The ML-DSA half comes from QuantLayer custody. authorize verifies the result and fails closed if the classical signer misbehaves.
  • What this is not. This is QuantLayer's own construction, modelled on the IETF LAMPS composite ML-DSA work but not conformant to it. ES256K here means raw ECDSA over SHA-256 (for KMS keys). It is not an Ethereum wallet signature (personal_sign / EIP-712), and it doesn't make Ethereum accounts quantum-safe.

7. Rotation, revocation and algorithm migration

  • Rotation. Version n+1 is generated (same algorithm) and becomes active; version n becomes retired.
  • Migration. A rotation to another parameter set of the same kind: for example ML-DSA-44 → ML-DSA-87, ML-DSA → SLH-DSA (lattice → hash-based), or ML-KEM-512 → ML-KEM-1024. Signature ↔ KEM migrations are rejected.
  • Transition records. For signature keys, both the outgoing and the incoming key sign the canonical statement QUANTLAYER-PQC-TRANSITION-V1\nkey=…\nfrom=v:alg:fingerprint\nto=v:alg:fingerprint\n, under the context QUANTLAYER-PQC-TRANSITION-V1. Verifiers can then follow the chain: the old key authorised its successor, and the new key is possessed. verifyTransition checks both signatures and that the statement matches the published keys.
  • Revocation. Allowed from pending, active or retired. It requires a reason, wipes the secret, and is published in the KeyRing. Revoked versions no longer verify.
  • Caveat. A transition record proves the old key consented. If the old key was compromised before the migration, the attacker could have produced that consent. Compromise-driven re-keying must therefore be authorised out of band, through identity recovery or governance, not by the old key alone.

8. Test vectors and interoperability

SuiteWhereCasesWhat
NIST ACVP (FIPS 203/204/205)rust/quantlayer-pqc/tests/acvp (subset of usnistgov/ACVP-Server @ 975de31, source SHA-256 pinned, subset.py)291ML-DSA keyGen/sigGen/sigVer (external pure and internal, deterministic and hedged); ML-KEM keyGen/encaps/decaps (incl. invalid ciphertexts)/ek and dk checks; SLH-DSA keyGen/sigGen/sigVer
ACVP through the TS bindingspackages/pqc-engine/src/acvp.test.tskeyGen, sigVer, ek-checkSame vectors, via Node-API; noble re-derives the keyGen results
Differential (Rust)rust/quantlayer-pqc/tests/differential.rs48libcrux vs fips204/fips203 byte for byte
Interop vectorsrust/quantlayer-pqc/tests/vectors/interop-v1.json9 + 2Seed → key → fingerprint, deterministic signatures, KEM outputs, hybrid signatures. Checked by Rust, the TS bindings, noble, and an independent TS re-implementation of the hybrid encoding

To regenerate the interop vectors, run QUANTLAYER_UPDATE_VECTORS=1 cargo test -p quantlayer-pqc --test interop.

9. Security properties, assumptions and limitations

Properties (when the assumptions hold).

  • ML-DSA (FIPS 204). Strong unforgeability under chosen-message attack. This rests on the hardness of Module-LWE and Module-SIS (and the SelfTargetMSIS variant), with SHAKE modelled as a random oracle, in the quantum random-oracle model. Signing is hedged (fresh 32-byte rnd), as FIPS 204 recommends against fault and side-channel attacks.
  • SLH-DSA (FIPS 205). Existential unforgeability resting only on properties of the hash function (SHA-256 for these sets), which is the most conservative assumption available. Signing is hedged with opt_rand.
  • ML-KEM (FIPS 203). IND-CCA2 under Module-LWE via the Fujisaki–Okamoto transform.
    • Decapsulation. It uses implicit rejection: a malformed ciphertext of the right length yields an unrelated pseudo-random secret, never an error. Callers must authenticate what they derive from it, for example with an AEAD key confirmation.
    • Key checks. Encapsulation keys are modulus-checked (FIPS 203 §7.2) before use.
  • Security categories. These are NIST's: category 1 means at least as hard as AES-128 key search, category 3 AES-192, category 5 AES-256. The defaults (ML-DSA-65, ML-KEM-768) are category 3.
  • Hybrid. Unforgeable if either component is.
  • Key protection. Confidentiality and integrity of sealed keys under XChaCha20-Poly1305, with the KEK secret.

Assumptions.

  • Hardness and hash security. The lattice problems above are hard for quantum adversaries, and SHA-2/SHA-3/SHAKE behave as assumed.
  • Implementations. libcrux and fips205 implement the standards correctly and in constant time on the platforms used.
    • Evidence: formal verification where noted, 291 NIST vectors, differential and cross-language agreement.
    • What it doesn't prove: none of this establishes the absence of side channels on a specific CPU.
  • Randomness. The OS CSPRNG (getrandom) is sound.
  • KEK custody. KEKs are managed by a KMS/HSM and never stored with the sealed blobs.
  • Process integrity. Anyone with code execution or a memory dump of the process can read active keys.

Limitations.

  • Not FIPS 140-3 validated. Passing ACVP vectors is not CMVP validation; none of the selected libraries is a validated module. Regulated deployments need a validated provider (e.g. an aws-lc-rs FIPS profile or a PQC-capable HSM) behind the same interfaces.
  • Audit status. libcrux ML-DSA verification is partial; fips205 has no known independent audit; QuantLayer's composition code (protection, hybrid, lifecycle) is unaudited.
  • No browser/WASM build yet. Only Node-API is available. The local toolchain had no wasm32 target; quantlayer-crypto-wasm is the placeholder. Native addons must be built per platform (pnpm --filter @quantlayer-protocol/pqc-engine build needs cargo).
  • Synchronous calls. SLH-DSA "s" signing takes about a second (BENCHMARKS.md) and blocks the Node event loop; use worker threads or SLH-DSA-SHA2-128f.
  • Still classical elsewhere in QuantLayer.
    • Ethereum transactions and EIP-712 wallet ownership proofs (secp256k1).
    • Ed25519/ES256K identity keys that have not migrated.
    • The ZK proofs (UltraHonk/KZG over BN254, FEAT-06), whose soundness falls to a quantum adversary.
    • did:quantlayer derivation (SHA-256, fine).
    • X25519 where used without ML-KEM.
    • Data already encrypted or signed classically ("harvest now, decrypt later"); this module does not protect it retroactively.
  • No on-chain post-quantum verification. ML-DSA verification is not implemented in Solidity; it would cost several million gas.
  • Verification of revoked keys. Revoked versions are deliberately unusable, so signatures made before revocation can't be checked against them. Timestamped evidence (e.g. on-chain anchoring) is needed where that matters.

10. Operations

TaskCommand
Rust tests (incl. NIST)cd rust && cargo test --locked
Build the TS bindingspnpm --filter @quantlayer-protocol/pqc-engine build (runs cargo build --release)
TS tests (interop, ACVP)pnpm --filter @quantlayer-protocol/pqc-engine test
BenchmarksQUANTLAYER_BENCH=1 pnpm --filter @quantlayer-protocol/pqc-engine exec vitest run src/bench.test.ts
Refresh the ACVP subsetdownload the pinned files, then python3 rust/quantlayer-pqc/tests/acvp/subset.py <dir>
Regenerate interop vectorsQUANTLAYER_UPDATE_VECTORS=1 cargo test -p quantlayer-pqc --test interop
Upgrade a librarybump the exact pin, rerun every suite above, review the upstream changelog and advisories, record it in ADR-0014