#[non_exhaustive]pub enum SignAlgorithm {
RsaPkcs1Sha256,
RsaPssSha256,
EcdsaSha256,
EcdsaSha384,
Ed25519,
MlDsa44,
MlDsa65,
MlDsa87,
}Expand description
Signature algorithm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RsaPkcs1Sha256
RSASSA-PKCS1-v1_5 with SHA-256.
RsaPssSha256
RSASSA-PSS with SHA-256.
EcdsaSha256
ECDSA with SHA-256.
EcdsaSha384
ECDSA with SHA-384.
Ed25519
Ed25519 (pure EdDSA, no hash function).
MlDsa44
ML-DSA-44 (pure, no pre-hash). FIPS 204.
MlDsa65
ML-DSA-65 (pure, no pre-hash). FIPS 204.
MlDsa87
ML-DSA-87 (pure, no pre-hash). FIPS 204.
Implementations§
Source§impl SignAlgorithm
impl SignAlgorithm
Sourcepub fn key_algorithm(self) -> KeyAlgorithm
pub fn key_algorithm(self) -> KeyAlgorithm
A representative key algorithm for this signature algorithm.
Used where a signature request must be turned into a concrete key algorithm: selecting a card algorithm, or minting a stand-in key for a rehearsal. Keeping that mapping here means those callers cannot drift apart from each other.
The mapping is deliberately lossy for RSA: both RSA schemes answer
Rsa2048, because a signature algorithm does not name a modulus size.
Use accepts_key to test whether a key may be used
with this algorithm; the equality alg.key_algorithm() == key is not
that test and rejects RSA-4096 keys.
Sourcepub fn accepts_key(self, key_algorithm: KeyAlgorithm) -> bool
pub fn accepts_key(self, key_algorithm: KeyAlgorithm) -> bool
Whether a key of key_algorithm may be used with this signature algorithm.
The compatibility check every signing backend needs, kept in one place. Curve and parameter set are pinned: ECDSA-SHA256 will not take a P-384 key. Only the RSA schemes span more than one key algorithm, since they are defined for any modulus size.