pub enum Algorithm {
Show 38 variants
Hs256,
Hs384,
Hs512,
Rs256,
Rs384,
Rs512,
Ps256,
Ps384,
Ps512,
Es256,
Es384,
Es512,
Es256k,
EdDsa,
RsaOaep,
RsaOaep256,
Rsa1_5,
A128kw,
A192kw,
A256kw,
Dir,
EcdhEs,
EcdhEsA128kw,
EcdhEsA192kw,
EcdhEsA256kw,
A128gcmkw,
A192gcmkw,
A256gcmkw,
Pbes2Hs256A128kw,
Pbes2Hs384A192kw,
Pbes2Hs512A256kw,
A128cbcHs256,
A192cbcHs384,
A256cbcHs512,
A128gcm,
A192gcm,
A256gcm,
Unknown(String),
}Expand description
JWK Algorithm (RFC 7518).
Per RFC 7517, unknown algorithm values should be accepted and preserved to allow for future extensions and private-use algorithms.
Variants§
Hs256
HMAC using SHA-256.
Hs384
HMAC using SHA-384.
Hs512
HMAC using SHA-512.
Rs256
RSASSA-PKCS1-v1_5 using SHA-256.
Rs384
RSASSA-PKCS1-v1_5 using SHA-384.
Rs512
RSASSA-PKCS1-v1_5 using SHA-512.
Ps256
RSASSA-PSS using SHA-256 and MGF1 with SHA-256.
Ps384
RSASSA-PSS using SHA-384 and MGF1 with SHA-384.
Ps512
RSASSA-PSS using SHA-512 and MGF1 with SHA-512.
Es256
ECDSA using P-256 and SHA-256.
Es384
ECDSA using P-384 and SHA-384.
Es512
ECDSA using P-521 and SHA-512.
Es256k
ECDSA using secp256k1 and SHA-256.
EdDsa
Edwards-curve Digital Signature Algorithm (Ed25519/Ed448).
RsaOaep
RSAES-OAEP using default parameters.
RsaOaep256
RSAES-OAEP using SHA-256 and MGF1 with SHA-256.
Rsa1_5
RSAES-PKCS1-v1_5.
A128kw
AES Key Wrap with 128-bit key.
A192kw
AES Key Wrap with 192-bit key.
A256kw
AES Key Wrap with 256-bit key.
Dir
Direct use of a shared symmetric key.
EcdhEs
ECDH-ES using Concat KDF.
EcdhEsA128kw
ECDH-ES using Concat KDF and A128KW wrapping.
EcdhEsA192kw
ECDH-ES using Concat KDF and A192KW wrapping.
EcdhEsA256kw
ECDH-ES using Concat KDF and A256KW wrapping.
A128gcmkw
Key wrapping with AES-GCM using 128-bit key.
A192gcmkw
Key wrapping with AES-GCM using 192-bit key.
A256gcmkw
Key wrapping with AES-GCM using 256-bit key.
Pbes2Hs256A128kw
PBES2 with HMAC SHA-256 and A128KW wrapping.
Pbes2Hs384A192kw
PBES2 with HMAC SHA-384 and A192KW wrapping.
Pbes2Hs512A256kw
PBES2 with HMAC SHA-512 and A256KW wrapping.
A128cbcHs256
AES-CBC with HMAC SHA-256 using 128-bit keys.
A192cbcHs384
AES-CBC with HMAC SHA-384 using 192-bit keys.
A256cbcHs512
AES-CBC with HMAC SHA-512 using 256-bit keys.
A128gcm
AES-GCM using 128-bit key.
A192gcm
AES-GCM using 192-bit key.
A256gcm
AES-GCM using 256-bit key.
Unknown(String)
Unknown or private-use algorithm.
Per RFC 7517, implementations should accept unknown algorithm values to support future extensions and collision-resistant names.
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the algorithm as a string.
For unknown algorithms, this returns a static “unknown” string.
Use [Algorithm::to_string()] to get the actual algorithm name for unknown variants.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this is an unknown/unrecognized algorithm.
Sourcepub fn is_signing(&self) -> bool
pub fn is_signing(&self) -> bool
Returns true if this is a signing algorithm.
Unknown algorithms return false since their purpose cannot be determined.
Sourcepub fn is_key_encryption(&self) -> bool
pub fn is_key_encryption(&self) -> bool
Returns true if this is a key encryption algorithm.
Unknown algorithms return false since their purpose cannot be determined.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Algorithm
impl<'de> Deserialize<'de> for Algorithm
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl FromStr for Algorithm
impl FromStr for Algorithm
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses an algorithm string.
Per RFC 7517, unknown algorithm values are accepted and stored as Unknown.
This function never fails - unrecognized values become Algorithm::Unknown(s).
Source§type Err = Infallible
type Err = Infallible
impl Eq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnwindSafe for Algorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.