Skip to main content

Algorithm

Enum Algorithm 

Source
#[non_exhaustive]
pub enum Algorithm {
Show 42 variants Hs256, Hs384, Hs512, Rs256, Rs384, Rs512, Ps256, Ps384, Ps512, Es256, Es384, Es512, Es256k, EdDsa, Ed25519, Ed448, RsaOaep, RsaOaep256, RsaOaep384, RsaOaep512, 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 (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.
§

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 (legacy JOSE identifier).

RFC 9864 deprecates this generic identifier in favor of the fully specified Algorithm::Ed25519 and Algorithm::Ed448 values.

§

Ed25519

Ed25519 signature algorithm (RFC 9864 JOSE algorithm identifier).

§

Ed448

Ed448 signature algorithm (RFC 9864 JOSE algorithm identifier).

§

RsaOaep

RSAES-OAEP using default parameters.

§

RsaOaep256

RSAES-OAEP using SHA-256 and MGF1 with SHA-256.

§

RsaOaep384

RSAES-OAEP using SHA-384 and MGF1 with SHA-384.

§

RsaOaep512

RSAES-OAEP using SHA-512 and MGF1 with SHA-512.

§

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

Source

pub fn as_str(&self) -> &str

Returns the algorithm as a string.

For unknown algorithms, this returns the original algorithm name.

Source

pub fn is_unknown(&self) -> bool

Returns true if this is an unknown/unrecognized algorithm.

Source

pub fn is_deprecated(&self) -> bool

Returns true if this algorithm identifier is deprecated.

Per RFC 9864, EdDSA is deprecated in JOSE in favor of the fully specified Ed25519 and Ed448 identifiers.

Trait Implementations§

Source§

impl Clone for Algorithm

Source§

fn clone(&self) -> Algorithm

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Algorithm

Source§

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

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

impl<'de> Deserialize<'de> for Algorithm

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Algorithm

Source§

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

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

impl From<&str> for Algorithm

Source§

fn from(s: &str) -> Self

Parses an algorithm string.

Per RFC 7517, unknown algorithm values are accepted and stored as Unknown.

Source§

impl FromStr for Algorithm

Source§

type Err = Infallible

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 Algorithm

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 Algorithm

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Algorithm

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Algorithm

Source§

impl StructuralPartialEq for Algorithm

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,