Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 16 variants TruncatedHeader, NonMinimalHeader, TruncatedCiphertext, UnknownKeyId(u64), KeyRoleConflict(u64), AuthenticationFailed, Replayed { kid: u64, ctr: u64, }, CounterExhausted(u64), KeyReuse(u64), EmptyBaseKey, KeyIdLayout, StaleEpoch(u64), UnknownEpoch(u64), TooManyKeys, RatchetExhausted, Crypto(CryptoError),
}
Expand description

Why an SFrame operation failed.

No variant carries key material, plaintext, a nonce or a tag.

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

TruncatedHeader

The input ends before the SFrame header does (RFC 9605 section 4.3).

§

NonMinimalHeader

The header carries a KID or CTR that is not in its shortest form (RFC 9605 section 4.3: a value below 8 goes in the config byte, a larger one in the fewest bytes).

§

TruncatedCiphertext

What follows the header is shorter than the cipher suite’s authentication tag.

§

UnknownKeyId(u64)

No key is stored for this KID.

§

KeyRoleConflict(u64)

The key stored for this KID is marked for the other direction: a key is usable for encryption or for decryption, never both (RFC 9605 section 4.4.1).

§

AuthenticationFailed

The authentication tag does not match the header, the metadata and the ciphertext.

§

Replayed

The ciphertext is authentic, but its counter was already accepted or is older than the replay window (RFC 9605 section 9.3).

Fields

§kid: u64

The KID of the ciphertext.

§ctr: u64

The CTR of the ciphertext.

§

CounterExhausted(u64)

Every counter of this key has been used: one more encryption would repeat a nonce (RFC 9605 sections 7.4 and 9.1). The sender needs a new key.

§

KeyReuse(u64)

The key is already installed for sending under this KID. Installing it again would restart its counter and repeat (key, nonce) pairs (RFC 9605 sections 7.4 and 9.1).

§

EmptyBaseKey

A base key is empty.

§

KeyIdLayout

A KID layout does not fit 64 bits, or a value does not fit its field of the KID (RFC 9605 sections 5.1 and 5.2).

§

StaleEpoch(u64)

An MLS epoch is older than, or contradicts, one already introduced with the same low-order bits (RFC 9605 section 5.2).

§

UnknownEpoch(u64)

No secret is stored for this MLS epoch.

§

TooManyKeys

The store already holds as many derived keys as its limit allows.

§

RatchetExhausted

A ratchet step counter cannot advance further.

§

Crypto(CryptoError)

The crypto provider failed, or does not implement what the cipher suite needs.

Implementations§

Source§

impl Error

Source

pub fn kind(&self) -> Option<ErrorKind>

The W3C error kind of a decryption failure, if the failure is one of the three the Encoded Transform API names. A replay, a key-management error and a provider failure are none of them.

Source

pub fn key_id(&self) -> Option<u64>

The KID a decryption failure is about, when it has one (the keyID attribute of the W3C error event).

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 Eq for Error

Source§

impl Error for Error

1.30.0 · 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

Replaced by Error::source.
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 PartialEq for Error

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move 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, 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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.