ML-DSA
Sign with ML-DSA-44, ML-DSA-65 or ML-DSA-87 (FIPS 204).
from oxcrypto.signature.ml_dsa import ML_DSA
key = ML_DSA.ML_DSA_65.generate()
signature = key.sign(b"hello", context=b"app v1")
assert key.public_key().verify(signature, b"hello", context=b"app v1")
pem = key.to_pem(password=b"secret")
assert ML_DSA.ML_DSA_65.load_pem_private_key(pem, password=b"secret") == key| Variant | Private key (seed) | Public key | Signature |
|---|---|---|---|
ML_DSA_44 | 32 bytes | 1312 bytes | 2420 bytes |
ML_DSA_65 | 32 bytes | 1952 bytes | 3309 bytes |
ML_DSA_87 | 32 bytes | 2592 bytes | 4627 bytes |
This is pure ML-DSA from FIPS 204 with a context string of up to 255 bytes.
sign is hedged (uses fresh randomness) by default; deterministic=True
uses the FIPS 204 deterministic variant. to_bytes() returns the 32-byte seed,
and PKCS#8 stores the seed only.
- Crate:
ml-dsa0.1.2 from RustCrypto, a stable release with no published audit. It builds with Rust 1.88. - Tests: NIST ACVP-Server
ML-DSA-keyGen-FIPS204andML-DSA-sigVer-FIPS204vectors, and Rust tests that compare key generation and signatures withlibcrux-ml-dsa0.0.10.