Struct jwt_compact::alg::Rsa[][src]

pub struct Rsa { /* fields omitted */ }
This is supported on crate feature with_rsa only.
Expand description

Integrity algorithm using RSA digital signatures.

Depending on the variation, the algorithm employs PKCS#1 v1.5 or PSS padding and one of the hash functions from the SHA-2 family: SHA-256, SHA-384, or SHA-512. See RFC 7518 for more details. Depending on the chosen parameters, the name of the algorithm is one of RS256, RS384, RS512, PS256, PS384, PS512:

  • R / P denote the padding scheme: PKCS#1 v1.5 for R, PSS for P
  • 256 / 384 / 512 denote the hash function

The length of RSA keys is not unequivocally specified by the algorithm; nevertheless, it MUST be at least 2048 bits as per RFC 7518. To minimize risks of misconfiguration, use StrongAlg wrapper around Rsa:

const ALG: StrongAlg<Rsa> = StrongAlg(Rsa::rs256());
// `ALG` will not support RSA keys with unsecure lengths by design!

Implementations

RSA with SHA-256 and PKCS#1 v1.5 padding.

RSA with SHA-384 and PKCS#1 v1.5 padding.

RSA with SHA-512 and PKCS#1 v1.5 padding.

RSA with SHA-256 and PSS padding.

RSA with SHA-384 and PSS padding.

RSA with SHA-512 and PSS padding.

RSA based on the specified algorithm name.

Panics
  • Panics if the name is not one of the six RSA-based JWS algorithms. Prefer using the FromStr trait if the conversion is potentially fallible.

Generates a new key pair with the specified modulus bit length (aka key length).

Trait Implementations

Key used when issuing new tokens.

Key used when verifying tokens. May coincide with Self::SigningKey for symmetric algorithms (e.g., HS*). Read more

Signature produced by the algorithm.

Returns the name of this algorithm, as mentioned in the alg field of the JWT header.

Signs a message with the signing_key.

Verifies the message against the signature and verifying_key.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

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

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

This method tests for !=.

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

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.