Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 24 variants InvalidPem(String), UnexpectedPemLabel(String, &'static str), InvalidPkcs8(String), UnsupportedAlgorithm(String), UnsupportedRsaSize(u32), Crypto(&'static str), KeyGeneration(&'static str), InvalidBase64(Error), InvalidMultibase(Error), InvalidMultikeyPrefix, InvalidMultikeyLength { expected: usize, actual: usize, }, MissingHeader(&'static str), InvalidHeader { name: &'static str, reason: String, }, MalformedSignatureHeader(String), VerificationFailed, KeyResolution(String), DigestMismatch, UnsupportedDigestAlgorithm(String), RequiredHeaderAbsent(String), MissingSignatureParameter(&'static str), TimestampMissing, TimestampTooOld { timestamp: DateTime<Utc>, now: DateTime<Utc>, }, TimestampInFuture { timestamp: DateTime<Utc>, now: DateTime<Utc>, }, TimestampExpired { expires: DateTime<Utc>, now: DateTime<Utc>, },
}
Expand description

Enumeration of every failure mode that this crate can surface.

The enum is non-exhaustive so that additional signature schemes or cryptographic algorithms can be added in minor releases without breaking downstream code.

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

InvalidPem(String)

The provided PEM document could not be parsed.

§

UnexpectedPemLabel(String, &'static str)

The PEM document had an unexpected -----BEGIN <LABEL>----- line.

§

InvalidPkcs8(String)

A PKCS#8 DER blob could not be decoded.

§

UnsupportedAlgorithm(String)

The key’s algorithm identifier was not supported.

§

UnsupportedRsaSize(u32)

The RSA key size was outside the supported range.

The bounds mirror aws-lc-rs’s RSA_PKCS1_2048_8192_SHA256 verification profile: any modulus width between 2048 and 8192 bits (inclusive) whose byte count is whole (i.e. divisible by 8) is accepted.

§

Crypto(&'static str)

An underlying aws-lc-rs primitive failed.

§

KeyGeneration(&'static str)

Generation of a new key failed at the RNG layer.

§

InvalidBase64(Error)

A signature’s Base64 encoding was malformed.

§

InvalidMultibase(Error)

Multibase decoding of a FEP-521a publicKeyMultibase failed.

§

InvalidMultikeyPrefix

The multicodec prefix on a Multikey was unrecognised or truncated.

§

InvalidMultikeyLength

The raw key material following the multicodec prefix had the wrong length.

Fields

§expected: usize

Expected number of key bytes.

§actual: usize

Actual number of key bytes.

§

MissingHeader(&'static str)

A required HTTP header is missing.

§

InvalidHeader

An HTTP header’s value was not valid UTF-8 or otherwise unparseable.

Fields

§name: &'static str

Header name that could not be parsed.

§reason: String

Human-readable reason.

§

MalformedSignatureHeader(String)

The Signature header’s parameter list was malformed.

§

VerificationFailed

The signature did not verify against the provided key.

§

KeyResolution(String)

The resolver closure returned an error while fetching the signer’s key.

§

DigestMismatch

The Digest / Content-Digest header did not match the body.

§

UnsupportedDigestAlgorithm(String)

The requested digest algorithm is not supported.

§

RequiredHeaderAbsent(String)

The signature-base string includes a header that the request does not carry.

§

MissingSignatureParameter(&'static str)

A signature parameter required by the standard is missing.

§

TimestampMissing

The signature carried no created parameter and no Date header, and the active VerifyPolicy requires one.

§

TimestampTooOld

The signature is older than the policy’s max_age.

Fields

§timestamp: DateTime<Utc>

The signed timestamp, either from created or the Date header.

§now: DateTime<Utc>

The verifier’s current wall-clock time.

§

TimestampInFuture

The signature claims to have been produced further in the future than the policy’s max_clock_skew_future tolerance allows.

Fields

§timestamp: DateTime<Utc>

The signed timestamp.

§now: DateTime<Utc>

The verifier’s current wall-clock time.

§

TimestampExpired

The signature’s expires parameter indicates it has lapsed.

Fields

§expires: DateTime<Utc>

The expires parameter interpreted as a UTC timestamp.

§now: DateTime<Utc>

The verifier’s current wall-clock time.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

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> 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> 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 = 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<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