Struct jwt_compact::alg::StrongKey[][src]

pub struct StrongKey<T>(_);
Expand description

Wrapper around keys allowing to enforce key strength requirements.

The wrapper signifies that the key has supported strength as per the corresponding algorithm spec. For example, RSA keys must have length at least 2,048 bits per RFC 7518. Likewise, HS* keys must have at least the length of the hash output (e.g., 32 bytes for HS256). Since these requirements sometimes clash with backward compatibility (and sometimes a lesser level of security is enough), notion of key strength is implemented in such an opt-in, composable way.

It’s easy to convert a StrongKey<T> to T via into_inner() or to access &T via AsRef impl. In contrast, the reverse transformation is fallible, and is defined with the help of TryFrom. The error type for TryFrom is WeakKeyError, a simple wrapper around a weak key.

Examples

See StrongAlg docs for an example of usage.

Implementations

Converts this private key to a public key.

Returns the wrapped value.

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.