pub enum CryptoError {
Show 16 variants
InvalidKey,
InvalidAeadKeyLength {
expected: usize,
actual: usize,
},
InvalidAeadNonceLength {
expected: usize,
actual: usize,
},
InvalidCiphertextLength {
minimum: usize,
actual: usize,
},
AeadEncrypt {
backend: AeadBackend,
kind: AeadFailureKind,
},
AeadDecrypt {
backend: AeadBackend,
kind: AeadFailureKind,
},
Signature {
backend: SignatureBackend,
operation: SignatureOperation,
kind: SignatureFailureKind,
},
KeyAgreementFailure {
kind: KeyAgreementFailureKind,
},
KemFailure {
kind: KemFailureKind,
},
KeyWrap {
algorithm: KeyWrapAlgorithm,
operation: KeyWrapOperation,
kind: KeyWrapFailureKind,
},
Kdf {
algorithm: KdfAlgorithm,
profile: KdfProfile,
kind: KdfFailureKind,
},
Hkdf {
hash: HkdfHash,
kind: HkdfFailureKind,
},
Mac {
hash: MacHash,
kind: MacFailureKind,
},
Rng {
output: RngOutputKind,
kind: RngFailureKind,
},
ConstantTimeComparison {
kind: ConstantTimeFailureKind,
left_len: usize,
right_len: usize,
},
Unsupported,
}Expand description
Typed error taxonomy for all crypto operations in the workspace.
Variants§
InvalidKey
Supplied key material was malformed or otherwise invalid.
InvalidAeadKeyLength
An AEAD key did not have the length the cipher requires.
Fields
InvalidAeadNonceLength
An AEAD nonce did not have the length the cipher requires.
Fields
InvalidCiphertextLength
A ciphertext was shorter than the minimum (tag) length.
Fields
AeadEncrypt
AEAD encryption failed in the given backend for the given reason.
Fields
backend: AeadBackendBackend lane in which the failure occurred.
kind: AeadFailureKindSpecific encryption failure cause.
AeadDecrypt
AEAD decryption failed in the given backend for the given reason.
Fields
backend: AeadBackendBackend lane in which the failure occurred.
kind: AeadFailureKindSpecific decryption failure cause (includes authentication failure).
Signature
A signature operation failed in the given backend for the given reason.
Fields
backend: SignatureBackendBackend lane in which the failure occurred.
operation: SignatureOperationOperation (sign, verify, keygen, encode) that failed.
kind: SignatureFailureKindSpecific signature failure cause.
KeyAgreementFailure
A key agreement operation failed for the given reason.
Fields
kind: KeyAgreementFailureKindSpecific key-agreement failure cause.
KemFailure
A KEM (key encapsulation) operation failed for the given reason.
Fields
kind: KemFailureKindSpecific KEM failure cause.
KeyWrap
A key-wrap operation failed for the given algorithm and reason.
Fields
algorithm: KeyWrapAlgorithmKey-wrap algorithm that failed.
operation: KeyWrapOperationOperation (wrap or unwrap) that failed.
kind: KeyWrapFailureKindSpecific key-wrap failure cause.
Kdf
A password-based KDF operation failed for the given algorithm/profile.
Fields
algorithm: KdfAlgorithmKDF algorithm that failed.
profile: KdfProfileCost profile in effect at the time of failure.
kind: KdfFailureKindSpecific KDF failure cause.
Hkdf
An HKDF operation failed for the given hash and reason.
Fields
kind: HkdfFailureKindSpecific HKDF failure cause.
Mac
An HMAC operation failed for the given hash and reason.
Fields
kind: MacFailureKindSpecific HMAC failure cause.
Rng
Secure random generation failed for the given output purpose.
Fields
output: RngOutputKindPurpose the requested random bytes were being generated for.
kind: RngFailureKindSpecific RNG failure cause.
ConstantTimeComparison
A constant-time comparison did not match, with the two input lengths.
Fields
kind: ConstantTimeFailureKindSpecific comparison failure cause.
Unsupported
The requested operation is not supported.
Trait Implementations§
Source§impl Clone for CryptoError
impl Clone for CryptoError
Source§fn clone(&self) -> CryptoError
fn clone(&self) -> CryptoError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CryptoError
impl Debug for CryptoError
Source§impl Display for CryptoError
impl Display for CryptoError
impl Eq for CryptoError
Source§impl Error for CryptoError
impl Error for CryptoError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()