#[non_exhaustive]pub enum SignatureAlgorithm {
MlDsa87,
EcdsaP256Sha256,
EcdsaP384Sha384,
EcdsaP521Sha384,
EcdsaP521Sha512,
Ed25519,
Rsa2048Sha384,
Rsa3072Sha384,
Rsa4096Sha384,
Rsa2048Sha384Pss,
Rsa3072Sha384Pss,
Rsa4096Sha384Pss,
}Expand description
A signature key algorithm: what a key is generated as, and what its CSR is signed with.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MlDsa87
ML-DSA-87 (FIPS 204).
EcdsaP256Sha256
ECDSA on P-256 with SHA-256.
EcdsaP384Sha384
ECDSA on P-384 with SHA-384.
EcdsaP521Sha384
ECDSA on P-521 with SHA-384.
EcdsaP521Sha512
ECDSA on P-521 with SHA-512.
Ed25519
Ed25519 (FIPS 186-5 EdDSA).
Rsa2048Sha384
A 2048-bit RSA key; its CSR is signed RSASSA-PKCS1-v1_5 with SHA-384.
Rsa3072Sha384
A 3072-bit RSA key; its CSR is signed RSASSA-PKCS1-v1_5 with SHA-384.
Rsa4096Sha384
A 4096-bit RSA key; its CSR is signed RSASSA-PKCS1-v1_5 with SHA-384.
Rsa2048Sha384Pss
A 2048-bit RSA key that signs RSASSA-PSS with SHA-384, MGF1 with SHA-384 and a 48-byte salt (RFC 8017 §8.1). Outside TLS only: no TLS key list or certificate request takes it.
Rsa3072Sha384Pss
A 3072-bit RSA key that signs RSASSA-PSS with SHA-384, MGF1 with SHA-384 and a 48-byte salt (RFC 8017 §8.1). Outside TLS only: no TLS key list or certificate request takes it.
Rsa4096Sha384Pss
A 4096-bit RSA key that signs RSASSA-PSS with SHA-384, MGF1 with SHA-384 and a 48-byte salt (RFC 8017 §8.1). Outside TLS only: no TLS key list or certificate request takes it.
Implementations§
Source§impl SignatureAlgorithm
impl SignatureAlgorithm
Sourcepub const ALL: &'static [SignatureAlgorithm]
pub const ALL: &'static [SignatureAlgorithm]
Every signature key algorithm.
Sourcepub const fn signature_oid(self) -> &'static str
pub const fn signature_oid(self) -> &'static str
The X.509 signature-algorithm OID a CSR or certificate signed by this key carries
(RFC 5758, RFC 8410, RFC 4055, and draft-ietf-lamps-dilithium-certificates for ML-DSA).
For an RSA-PSS variant it is id-RSASSA-PSS (RFC 4055 §3.1), whose parameters name the
hash, MGF1 hash and salt length.
Sourcepub const fn tls_scheme(self) -> Option<TlsSignatureScheme>
pub const fn tls_scheme(self) -> Option<TlsSignatureScheme>
The TLS signature scheme this crate pairs with a key of this algorithm: the scheme the key
signs a handshake with when the peer offers this scheme alone. None for an algorithm that
is not a TLS key algorithm: the RSA-PSS variants, which sign outside TLS only.
An ECDSA, Ed25519 or ML-DSA key has no other scheme. An RSA key’s scheme comes from the
peer’s offer, whatever the key’s CSR was signed with: rustls signs with the first of RSA-PSS
with SHA-512, SHA-384 and SHA-256, then PKCS#1 v1.5 with SHA-512, SHA-384 and SHA-256, that
the peer offers (RSA_SCHEMES in crypto-profile/src/provider/sign.rs, the order rustls
0.23.46 uses), and TLS 1.3 admits only the RSA-PSS ones (src/enums.rs:554-579). So an RSA
key signs with RSA-PSS with SHA-384 only when the peer offers it and does not offer RSA-PSS
with SHA-512.