Skip to main content

SignatureAlgorithm

Enum SignatureAlgorithm 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

pub const ALL: &'static [SignatureAlgorithm]

Every signature key algorithm.

Source

pub const fn as_str(self) -> &'static str

The algorithm’s stable configuration name.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for SignatureAlgorithm

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SignatureAlgorithm

Source§

impl Debug for SignatureAlgorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SignatureAlgorithm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SignatureAlgorithm

Source§

impl FromStr for SignatureAlgorithm

Source§

type Err = ParseAlgorithmError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for SignatureAlgorithm

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SignatureAlgorithm

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SignatureAlgorithm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.