ML-DSA Reference Architecture: Aligning Memory-Safe Implementations with FIPS 204, LAMPS X.509 Profiles and ACVP Validation

A memory-safe ML-DSA implementation only delivers value if its keys, signatures and encodings interoperate exactly with FIPS 204 (August 2024) and with the identifiers registered by NIST CSOR (id-ml-dsa-44/65/87 = 2.16.840.1.101.3.4.3.17/18/19). The core architecture decisions are pure ML-DSA versus HashML-DSA, a private key stored as a 32-byte seed versus an expanded key, and hedged versus deterministic signing. Each choice trades flexibility for audit surface and must stay consistent with the IETF LAMPS certificate profile (draft-ietf-lamps-dilithium-certificates) and with NIST ACVP test vectors.

Pure ML-DSA vs HashML-DSA

Default to pure ML-DSA with an empty context string. That is the variant the LAMPS X.509 profile defines for certificates and CRLs. Choose HashML-DSA only when the signer cannot stream the whole message, for example an HSM behind a narrow API. Even then, consider the FIPS 204 external-mu split (computing mu outside the module) first, because HashML-DSA uses different OIDs and verifiers that expect pure ML-DSA will reject it. Never let one key sign under both modes.

Pre-implementation checklist

Fix the parameter set per policy: ML-DSA-65 as the general default, or ML-DSA-87 if CNSA 2.0 applies. Fix the size budget (illustrative for ML-DSA-65: public key 1952 bytes, signature 3309 bytes). Fix the private key format (seed-only, expanded, or both) and the context-string policy (at most 255 bytes, empty for X.509). Fix the signing mode: hedged with 32 fresh bytes of rnd by default, deterministic only for reproducible testing. Pin the FFI boundary (C ABI or PKCS#11) and the ACVP keyGen/sigGen/sigVer vectors that the CI pipeline must pass before merge.

Illustrative rollout scenario

A code-signing service migrates from ECDSA P-256. Phase 1 dual-signs artifacts (ECDSA plus ML-DSA-65 in a separate signature) and verifies both while only ECDSA is enforced. Phase 2 enforces ML-DSA once cross-library verification (the Rust implementation against at least one independent implementation) passes on every release. Recovery path: a feature flag reverts enforcement to ECDSA without re-issuing keys, and seed-only key backup lets the expanded key be regenerated deterministically if the expanded-key encoding has to be fixed.

How do I verify that a Rust ML-DSA implementation is interoperable and not just internally consistent?

Round-trip tests within a single library are not enough. First, run the NIST ACVP ML-DSA vectors for keyGen (seed to public and expanded key), sigGen (deterministic and hedged with the given rnd) and sigVer, including the negative cases. Second, cross-verify against an independent implementation: sign with yours and verify with theirs, then the reverse, across all three parameter sets and with non-empty context strings. Third, check the encodings: the X.509 SubjectPublicKeyInfo must carry the correct OID with absent parameters, and the private-key encodings must match the LAMPS seed, expanded and both choices. Signatures of the wrong length must be rejected before any decoding. Fourth, run constant-time checks (statistical timing tests and secret-dependent-branch analysis) on signing and key expansion. If any check fails, block the release, keep the previous build pinned, and re-derive affected expanded keys from their stored seeds.

Back to MLDSASafe · Domains

← Back to MLDSASafe
Engineering & Architecture Brief

ML-DSA Reference Architecture: Aligning Memory-Safe Implementations with FIPS 204, LAMPS X.509 Profiles and ACVP Validation

A memory-safe ML-DSA implementation only delivers value if its keys, signatures and encodings interoperate exactly with FIPS 204 (August 2024) and with the identifiers registered by NIST CSOR (id-ml-dsa-44/65/87 = 2.16.840.1.101.3.4.3.17/18/19). The core architecture decisions are pure ML-DSA versus HashML-DSA, a private key stored as a 32-byte seed versus an expanded key, and hedged versus deterministic signing. Each choice trades flexibility for audit surface and must stay consistent with the IETF LAMPS certificate profile (draft-ietf-lamps-dilithium-certificates) and with NIST ACVP test vectors.

Pure ML-DSA vs HashML-DSA

Default to pure ML-DSA with an empty context string. That is the variant the LAMPS X.509 profile defines for certificates and CRLs. Choose HashML-DSA only when the signer cannot stream the whole message, for example an HSM behind a narrow API. Even then, consider the FIPS 204 external-mu split (computing mu outside the module) first, because HashML-DSA uses different OIDs and verifiers that expect pure ML-DSA will reject it. Never let one key sign under both modes.

Pre-implementation checklist

Fix the parameter set per policy: ML-DSA-65 as the general default, or ML-DSA-87 if CNSA 2.0 applies. Fix the size budget (illustrative for ML-DSA-65: public key 1952 bytes, signature 3309 bytes). Fix the private key format (seed-only, expanded, or both) and the context-string policy (at most 255 bytes, empty for X.509). Fix the signing mode: hedged with 32 fresh bytes of rnd by default, deterministic only for reproducible testing. Pin the FFI boundary (C ABI or PKCS#11) and the ACVP keyGen/sigGen/sigVer vectors that the CI pipeline must pass before merge.

Illustrative rollout scenario

A code-signing service migrates from ECDSA P-256. Phase 1 dual-signs artifacts (ECDSA plus ML-DSA-65 in a separate signature) and verifies both while only ECDSA is enforced. Phase 2 enforces ML-DSA once cross-library verification (the Rust implementation against at least one independent implementation) passes on every release. Recovery path: a feature flag reverts enforcement to ECDSA without re-issuing keys, and seed-only key backup lets the expanded key be regenerated deterministically if the expanded-key encoding has to be fixed.

Technical FAQ: How do I verify that a Rust ML-DSA implementation is interoperable and not just internally consistent?

Round-trip tests within a single library are not enough. First, run the NIST ACVP ML-DSA vectors for keyGen (seed to public and expanded key), sigGen (deterministic and hedged with the given rnd) and sigVer, including the negative cases. Second, cross-verify against an independent implementation: sign with yours and verify with theirs, then the reverse, across all three parameter sets and with non-empty context strings. Third, check the encodings: the X.509 SubjectPublicKeyInfo must carry the correct OID with absent parameters, and the private-key encodings must match the LAMPS seed, expanded and both choices. Signatures of the wrong length must be rejected before any decoding. Fourth, run constant-time checks (statistical timing tests and secret-dependent-branch analysis) on signing and key expansion. If any check fails, block the release, keep the previous build pinned, and re-derive affected expanded keys from their stored seeds.

Related Architecture Specifications (PQCECOSYSTEM): medicaltpm.com · mlkemkey.com · mlkemstandard.com

More Technical Articles on mldsasafe.com

Benchmarking Bootloader Verification Delays: ML-DSA vs SLH-DSA vs Classical RSA-3072 →Remote Attestation for Sovereign Cloud Hyperscalers Using Post-Quantum TPM Quotes →MLDSASafe: Reference Architecture, Interoperability & Deterministic Telemetry →