Skip to Content
oxcrypto

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
VariantPrivate key (seed)Public keySignature
ML_DSA_4432 bytes1312 bytes2420 bytes
ML_DSA_6532 bytes1952 bytes3309 bytes
ML_DSA_8732 bytes2592 bytes4627 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-dsa 0.1.2 from RustCrypto, a stable release with no published audit. It builds with Rust 1.88.
  • Tests: NIST ACVP-Server ML-DSA-keyGen-FIPS204 and ML-DSA-sigVer-FIPS204 vectors, and Rust tests that compare key generation and signatures with libcrux-ml-dsa 0.0.10.