Expand description
ML-DSA post-quantum signatures standardized in FIPS 204.
This module implements the ML-DSA-44, ML-DSA-65 and ML-DSA-87 parameter sets through distinct key types:
| Parameter set | Secret key | Public key | Public key size | Signature size |
|---|---|---|---|---|
| ML-DSA-44 | MlDsa44SecretKey | MlDsa44PublicKey | 1312 B | 2420 B |
| ML-DSA-65 | MlDsa65SecretKey | MlDsa65PublicKey | 1952 B | 3309 B |
| ML-DSA-87 | MlDsa87SecretKey | MlDsa87PublicKey | 2592 B | 4627 B |
§Signing
Signing is stateful: build a secret key from a 32-byte seed with new (or
with generate for a fresh random key), then call sign (randomized) or
sign_derand (deterministic for a fixed nonce).
The expanded key caches the NTT-domain matrix and secret vectors, so repeated signatures skip key generation. It is a fixed-size value with no heap allocation:
let key = MlDsa65SecretKey::new(&seed);
let signature = key.sign_derand(b"message", b"", &[0u8; 32]).unwrap();
assert!(key.public_key().verify(b"message", &signature, b"").is_ok());§Verification
Verification is stateless: the public key returned by the secret key’s
public_key method (or built from raw bytes with from_bytes)
exposes verify for a message and optional context, and
verify_external_mu for a precomputed 64-byte message representative
(FIPS 204 “external μ”). Both return MlDsaError on failure.
Structs§
- MlDsa44
Public Key - An ML-DSA-44 public key.
- MlDsa44
Secret Key - An expanded ML-DSA-44 secret key.
- MlDsa65
Public Key - An ML-DSA-65 public key.
- MlDsa65
Secret Key - An expanded ML-DSA-65 secret key.
- MlDsa87
Public Key - An ML-DSA-87 public key.
- MlDsa87
Secret Key - An expanded ML-DSA-87 secret key.
Enums§
Constants§
- ML_
DSA_ 44_ CONTEXT_ MAX_ LEN - Maximum length in bytes of an ML-DSA-44 context string.
- ML_
DSA_ 44_ PUBLIC_ KEY_ SIZE - Size in bytes of an encoded ML-DSA-44 public key.
- ML_
DSA_ 44_ SECRET_ KEY_ SIZE - Size in bytes of an initialized
MlDsa44SecretKey. - ML_
DSA_ 44_ SEED_ SIZE - Size in bytes of an ML-DSA-44 seed (private key).
- ML_
DSA_ 44_ SIGNATURE_ SIZE - Size in bytes of an encoded ML-DSA-44 signature.
- ML_
DSA_ 65_ CONTEXT_ MAX_ LEN - Maximum length in bytes of an ML-DSA-65 context string.
- ML_
DSA_ 65_ PUBLIC_ KEY_ SIZE - Size in bytes of an encoded ML-DSA-65 public key.
- ML_
DSA_ 65_ SECRET_ KEY_ SIZE - Size in bytes of an initialized
MlDsa65SecretKey. - ML_
DSA_ 65_ SEED_ SIZE - Size in bytes of an ML-DSA-65 seed (private key).
- ML_
DSA_ 65_ SIGNATURE_ SIZE - Size in bytes of an encoded ML-DSA-65 signature.
- ML_
DSA_ 87_ CONTEXT_ MAX_ LEN - Maximum length in bytes of an ML-DSA-87 context string.
- ML_
DSA_ 87_ PUBLIC_ KEY_ SIZE - Size in bytes of an encoded ML-DSA-87 public key.
- ML_
DSA_ 87_ SECRET_ KEY_ SIZE - Size in bytes of an initialized
MlDsa87SecretKey. - ML_
DSA_ 87_ SEED_ SIZE - Size in bytes of an ML-DSA-87 seed (private key).
- ML_
DSA_ 87_ SIGNATURE_ SIZE - Size in bytes of an encoded ML-DSA-87 signature.