Expand description
SignAlgorithm trait and ML-DSA/SLH-DSA implementations (FIPS 204/205). Digital signature backend trait and FIPS 204/205 implementations.
§Responsibility scope
This module owns the abstract [SignAlgorithm] trait, the [SignatureMode] markers,
the generic [hub::Signature<A, S>] struct, and the concrete algorithm implementations:
- ML-DSA 44/65/87 (FIPS 204, behind
ml-dsa-backendfeature) - SLH-DSA Shake128f/s, 192f/s, 256f/s (FIPS 205, behind
sign-slhdsafeature)
§Feature gates
| Feature | Module | Types added |
|---|---|---|
ml-dsa-backend | ml_dsa | MlDsa44Impl, MlDsa65Impl, MlDsa87Impl |
sign-slhdsa | slh_dsa | SlhDsaShake128fImpl, … (6 variants) |
The algorithm and hub modules are unconditionally compiled.
§Key types exported
- [
SignAlgorithm] — core trait - [
algorithm::Detached], [algorithm::MessageMode] — mode markers - [
hub::Signature] — generic container
§Concurrency
All types are Send + Sync.
§Examples
#[cfg(feature = "ml-dsa-backend")]
{
use crypt_guard::sign::{SignAlgorithm, ml_dsa::MlDsa65Impl};
use crypt_guard::kem::backend::OsRng;
let mut rng = OsRng;
let (sk, vk) = MlDsa65Impl::keypair(&mut rng).unwrap();
let sig = MlDsa65Impl::sign(&sk, b"hello").unwrap();
MlDsa65Impl::verify(&vk, b"hello", &sig).unwrap();
}Re-exports§
pub use algorithm::Detached;pub use algorithm::Keypair;pub use algorithm::MessageMode;pub use algorithm::SignAlgorithm;pub use algorithm::SignatureMode;pub use hub::Signature as NewSignature;
Modules§
- algorithm
SignAlgorithmtrait and supporting types.- hub
- Blanket
Signature<A, S>struct wrapping anySignAlgorithm + SignatureMode. - ml_dsa
- ML-DSA implementations of
SignAlgorithm(FIPS 204).