Skip to main content

CryptoError

Enum CryptoError 

Source
#[non_exhaustive]
pub enum CryptoError {
Show 45 variants Unavailable(Algorithm), PolicyEmpty(Family), PolicyDuplicate(Algorithm), PolicyDrift, PolicyVersionUnusable { version: TlsVersion, family: Family, }, NotFips, SelfTest, SelfTestUnavailable, KeyGeneration(Algorithm), Verify, Sign, Csr(CsrError), Tls(TlsError), Random, AeadKey, AeadSeal, AeadOpen, SealPlaintext, SealDomainEmpty, SealBlob, SealVersion, SealEphemeralKey, SealPublicKey, SealPrivateKey, SealOpen, Primitive,
#[non_exhaustive]
EmptyProfile { profile: Profile, options: Options, category: Family, }, SignaturePrivateKey { algorithm: SignatureAlgorithm, }, SignaturePublicKey { algorithm: SignatureAlgorithm, }, KeyNotInProfile { profile: Profile, algorithm: SignatureAlgorithm, }, NotApproved { algorithm: Algorithm, approval: Approval, }, NotInProfile { profile: Profile, algorithm: Algorithm, }, MacKeyLength { profile: Profile, bytes: usize, min_bits: usize, max_bits: usize, }, MacVerify, KdfOutputLength { algorithm: KdfAlgorithm, bytes: usize, max_bytes: usize, }, KdfSecretEmpty, KdfInfoEmpty { profile: Profile, }, KdfInfoMayBeEmpty { profile: Profile, }, KdfSpecMismatch { algorithm: KdfAlgorithm, }, KeyAgreementPeerKey { algorithm: KeyAgreementAlgorithm, }, KeyAgreementPrivateKey { algorithm: KeyAgreementAlgorithm, }, AeadKeyLength { algorithm: AeadAlgorithm, bytes: usize, }, AeadPlaintextLength { algorithm: AeadAlgorithm, bytes: usize, }, AeadLimit { algorithm: AeadAlgorithm, }, FamilyNotAdmitted(Family),
}
Expand description

A refusal from one of the crate’s operations. It never carries key or plaintext material.

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

Unavailable(Algorithm)

The algorithm is not available on this backend’s module.

§

PolicyEmpty(Family)

A TLS policy names nothing in this family.

§

PolicyDuplicate(Algorithm)

A TLS policy names this algorithm more than once.

§

PolicyDrift

A provider does not carry exactly a policy’s algorithms.

§

PolicyVersionUnusable

A TLS policy lists a version but names nothing in this family usable with it.

Fields

§version: TlsVersion

The listed version.

§family: Family

The family with nothing usable at that version.

§

NotFips

The process is not running the AWS-LC FIPS module, or a provider is not FIPS.

§

SelfTest

The module’s on-demand self-test (fips::self_test) failed without aborting the process.

§

SelfTestUnavailable

This backend does not expose the module’s on-demand self-test.

§

KeyGeneration(Algorithm)

Key generation failed.

§

Verify

A signature did not verify.

§

Sign

Signing failed.

§

Csr(CsrError)

A certificate signing request could not be produced.

§

Tls(TlsError)

A TLS configuration step was refused.

§

Random

The random generator failed.

§

AeadKey

The AEAD key was refused.

§

AeadSeal

AEAD sealing failed.

§

AeadOpen

The AEAD ciphertext did not authenticate.

§

SealPlaintext

A sealed-box plaintext is empty.

§

SealDomainEmpty

A sealed-box domain is empty. The domain is the HKDF salt, and the module does not mark an HKDF call with an empty salt approved.

§

SealBlob

A sealed blob is shorter than a header, one byte and a tag.

§

SealVersion

A sealed blob carries an unknown version.

§

SealEphemeralKey

A sealed blob’s ephemeral key is not an uncompressed P-384 point.

§

SealPublicKey

A sealing public key is not a canonical P-384 SubjectPublicKeyInfo.

§

SealPrivateKey

A sealing private key is not a P-384 PKCS#8 key.

§

SealOpen

A sealed blob does not open under this key, domain and AAD.

§

Primitive

A cryptographic primitive failed.

§

#[non_exhaustive]
EmptyProfile

A profile, narrowed by its options, names nothing in a family.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§profile: Profile

The profile.

§options: Options

The options it was narrowed by.

§category: Family

The family left empty.

§

SignaturePrivateKey

A signature private key that cannot be imported: its PKCS#8 structure is not the one its RFCs define for the algorithm, or the module refuses it.

Fields

§algorithm: SignatureAlgorithm

The signature algorithm.

§

SignaturePublicKey

A public key that is not the raw key of the signature algorithm’s shape, such as a SubjectPublicKeyInfo or a compressed point.

Fields

§algorithm: SignatureAlgorithm

The signature algorithm.

§

KeyNotInProfile

A key algorithm the profile does not admit.

Fields

§profile: Profile

The profile.

§algorithm: SignatureAlgorithm

The refused key algorithm.

§

NotApproved

An algorithm the running module does not approve.

Fields

§algorithm: Algorithm

The first algorithm found not approved.

§approval: Approval

Its approval.

§

NotInProfile

An algorithm, outside TLS, the profile does not admit.

Fields

§profile: Profile

The profile.

§algorithm: Algorithm

The refused algorithm.

§

MacKeyLength

An HMAC key whose length is outside the profile’s range.

Fields

§profile: Profile

The profile.

§bytes: usize

The key’s length in bytes.

§min_bits: usize

The shortest key the profile admits, in bits.

§max_bits: usize

The longest key the module admits, in bits.

§

MacVerify

A MAC did not verify.

§

KdfOutputLength

A KDF output length outside 1 to the KDF’s max_output_len().

Fields

§algorithm: KdfAlgorithm

The KDF.

§bytes: usize

The requested length in bytes.

§max_bytes: usize

The longest output the KDF gives, in bytes.

§

KdfSecretEmpty

An empty KDF secret.

§

KdfInfoEmpty

An empty KDF info under a profile that refuses one.

Fields

§profile: Profile

The profile.

§

KdfInfoMayBeEmpty

A profile that admits an empty KDF info, which the module does not approve; refused by assert_admitted_approved when the caller names Family::Kdf and the profile admits any KDF.

Fields

§profile: Profile

The profile.

§

KdfSpecMismatch

A KDF specification whose variant does not match its algorithm.

Fields

§algorithm: KdfAlgorithm

The algorithm the specification carries.

§

KeyAgreementPeerKey

A peer public key that is malformed for the curve, or that the module’s validation refused.

Fields

§algorithm: KeyAgreementAlgorithm

The key-agreement algorithm.

§

KeyAgreementPrivateKey

A static key-agreement private key that cannot be imported.

Fields

§algorithm: KeyAgreementAlgorithm

The key-agreement algorithm.

§

AeadKeyLength

An AEAD key whose length is not the algorithm’s key_len().

Fields

§algorithm: AeadAlgorithm

The AEAD algorithm.

§bytes: usize

The key’s length in bytes.

§

AeadPlaintextLength

A plaintext longer than the AEAD algorithm’s max_plaintext_len().

Fields

§algorithm: AeadAlgorithm

The AEAD algorithm.

§bytes: usize

The plaintext’s length in bytes.

§

AeadLimit

An AEAD key that has sealed 2^32 times (SP 800-38D §8.3); a new key is needed.

Fields

§algorithm: AeadAlgorithm

The AEAD algorithm.

§

FamilyNotAdmitted(Family)

A family assert_admitted_approved does not check: a TLS family, which assert_module_approves checks, or one this backend does not walk.

Trait Implementations§

Source§

impl Clone for CryptoError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for CryptoError

Source§

impl Debug for CryptoError

Source§

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

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

impl Display for CryptoError

Source§

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

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

impl Eq for CryptoError

Source§

impl Error for CryptoError

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 CryptoError

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 CryptoError

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