pub enum SigAlgorithm {
Show 17 variants
MlDsa44,
MlDsa65,
MlDsa87,
SlhDsaSha2_128s,
SlhDsaSha2_128f,
SlhDsaSha2_192s,
SlhDsaSha2_192f,
SlhDsaSha2_256s,
SlhDsaSha2_256f,
SlhDsaShake128s,
SlhDsaShake128f,
SlhDsaShake192s,
SlhDsaShake192f,
SlhDsaShake256s,
SlhDsaShake256f,
FnDsa512,
FnDsa1024,
}Expand description
Identifies the post-quantum signature algorithm used.
Variants§
MlDsa44
ML-DSA-44 (NIST FIPS 204, Security Level 2)
MlDsa65
ML-DSA-65 (NIST FIPS 204, Security Level 3) — recommended default
MlDsa87
ML-DSA-87 (NIST FIPS 204, Security Level 5)
SlhDsaSha2_128s
SLH-DSA-SHA2-128s (NIST FIPS 205, Security Level 1, small signatures)
SlhDsaSha2_128f
SLH-DSA-SHA2-128f (NIST FIPS 205, Security Level 1, fast signing)
SlhDsaSha2_192s
SLH-DSA-SHA2-192s (NIST FIPS 205, Security Level 3, small signatures)
SlhDsaSha2_192f
SLH-DSA-SHA2-192f (NIST FIPS 205, Security Level 3, fast signing)
SlhDsaSha2_256s
SLH-DSA-SHA2-256s (NIST FIPS 205, Security Level 5, small signatures)
SlhDsaSha2_256f
SLH-DSA-SHA2-256f (NIST FIPS 205, Security Level 5, fast signing)
SlhDsaShake128s
SLH-DSA-SHAKE-128s (NIST FIPS 205, Security Level 1, small signatures)
SlhDsaShake128f
SLH-DSA-SHAKE-128f (NIST FIPS 205, Security Level 1, fast signing)
SlhDsaShake192s
SLH-DSA-SHAKE-192s (NIST FIPS 205, Security Level 3, small signatures)
SlhDsaShake192f
SLH-DSA-SHAKE-192f (NIST FIPS 205, Security Level 3, fast signing)
SlhDsaShake256s
SLH-DSA-SHAKE-256s (NIST FIPS 205, Security Level 5, small signatures)
SlhDsaShake256f
SLH-DSA-SHAKE-256f (NIST FIPS 205, Security Level 5, fast signing)
FnDsa512
FN-DSA-512 (NIST FIPS 206, Security Level 1) — requires fndsa feature
FnDsa1024
FN-DSA-1024 (NIST FIPS 206, Security Level 5) — requires fndsa feature
Implementations§
Source§impl SigAlgorithm
impl SigAlgorithm
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Returns the canonical string identifier for this algorithm.
Sourcepub fn public_key_size(&self) -> usize
pub fn public_key_size(&self) -> usize
Returns the public key size in bytes for this algorithm.
Sourcepub fn secret_key_size(&self) -> usize
pub fn secret_key_size(&self) -> usize
Returns the secret key size in bytes for this algorithm.
For ML-DSA variants, this returns 32 (the seed size), which is the preferred
serialization per the ml-dsa crate. The full expanded key form (2560/4032/4896 bytes)
is deprecated in favor of the compact 32-byte seed.
For FN-DSA variants, this is the fn-dsa crate’s own encoded signing-key format
(1345/2369 bytes), not the raw 1281/2305-byte NIST secret-key size — implementation-defined,
like the ML-DSA seed above.
Sourcepub fn signature_size(&self) -> usize
pub fn signature_size(&self) -> usize
Returns the maximum signature size in bytes for this algorithm.
Sourcepub fn fips_standard(&self) -> &'static str
pub fn fips_standard(&self) -> &'static str
Returns the FIPS standard number for this algorithm.
Sourcepub fn multicodec_code(&self) -> SigResult<u32>
pub fn multicodec_code(&self) -> SigResult<u32>
Returns the multicodec code for this algorithm’s public key.
ML-DSA and SLH-DSA codes (0x1210–0x122b) are registered (draft status) in the
upstream multicodec table. FN-DSA (FIPS 206 / Falcon) has no upstream-registered
multicodec code as of this writing — see FN_DSA_PRIVATE_USE_BASE for the
provisional, 0x307-namespaced private-use codes this crate assigns instead, and its
doc comment for the full rationale, scope, and revisit trigger.
Sourcepub fn is_private_use_multicodec(&self) -> bool
pub fn is_private_use_multicodec(&self) -> bool
Returns true if this algorithm’s multicodec_code is one of
this crate’s own provisional private-use reservations (currently just FN-DSA), rather
than an upstream-registered multiformats/multicodec table entry.
Useful for callers who want to warn, log, or otherwise flag when a DID Document / Multikey they’re producing embeds a non-standard code that other multicodec implementations will not recognize.