pub enum CryptoError {
Show 18 variants
InvalidKeyLength {
algorithm: &'static str,
expected: usize,
got: usize,
},
InvalidKey(String),
InvalidNonceLength {
algorithm: &'static str,
expected: usize,
got: usize,
},
AuthenticationFailed,
Encryption(String),
Decryption(String),
Kdf(String),
Pqc(String),
ReedSolomon(String),
InvalidParameter(String),
Serialization(String),
Compression(String),
Io(Error),
ChecksumMismatch {
expected: u32,
got: u32,
},
InvalidNormalization {
codepoint: char,
reason: &'static str,
},
RejectedCodepointClass {
codepoint: char,
class: &'static str,
},
InsufficientEntropy {
got_bits: f64,
required_min: f64,
},
RecoveryPhrase(String),
}Expand description
Unified error type for cryptographic operations.
See module-level documentation for a description of each variant.
Variants§
InvalidKeyLength
Key bytes are the wrong length for the algorithm.
Example: passed 16 bytes to a function expecting a 32-byte key.
Fields
InvalidKey(String)
Key is structurally valid in length but fails algorithmic validation.
Example: Ed25519 public key does not encode a valid curve point, or Falcon secret key fails deserialization.
InvalidNonceLength
Nonce bytes are the wrong length.
Fields
AuthenticationFailed
Authentication tag or signature verification failed.
This is the normal “wrong key / tampered data” error. No further detail is given to avoid oracle attacks.
Encryption(String)
Encryption failed.
Decryption(String)
Decryption failed (wrong key, tampered ciphertext, etc.).
Kdf(String)
Key derivation failed.
Pqc(String)
Post-quantum primitive operation failed.
ReedSolomon(String)
Reed-Solomon encode/decode error.
InvalidParameter(String)
Invalid input parameter.
Serialization(String)
Serialization or deserialization error.
Compression(String)
Compression or decompression error.
Io(Error)
Underlying I/O error.
ChecksumMismatch
Recovery phrase truncated-SHA-3-256 checksum did not match the encoded entropy.
Fields
InvalidNormalization
Recovery phrase contained a codepoint whose NFKC canonical form differs from the input. We strictly reject — silent canonicalization would enable malleability attacks.
Fields
RejectedCodepointClass
Recovery phrase contained a codepoint from a forbidden class (ZWJ, Variation Selector, combining mark, BIDI mark, default-ignorable, or control).
Fields
InsufficientEntropy
Custom-alphabet phrase would encode fewer than the safety floor of entropy bits.
Fields
RecoveryPhrase(String)
A recovery-phrase operation failed in a way not captured by the structured variants above. Reserved for future subclasses.
Trait Implementations§
Source§impl Clone for CryptoError
impl Clone for CryptoError
Source§impl Debug for CryptoError
impl Debug for CryptoError
Source§impl Display for CryptoError
impl Display for CryptoError
Source§impl Error for CryptoError
impl Error for CryptoError
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()
Source§impl From<Error> for CryptoError
impl From<Error> for CryptoError
Source§impl From<SchnorrError> for CryptoError
impl From<SchnorrError> for CryptoError
Source§fn from(e: SchnorrError) -> Self
fn from(e: SchnorrError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for CryptoError
impl !UnwindSafe for CryptoError
impl Freeze for CryptoError
impl Send for CryptoError
impl Sync for CryptoError
impl Unpin for CryptoError
impl UnsafeUnpin for CryptoError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more