pub enum CryptoError {
Hashing(HashError),
Signature(SignatureError),
KeyManagement(KeyError),
KeyDerivation(KeyDerivationError),
Encryption,
Decryption,
Json(Error),
Hex(FromHexError),
InvalidSignatureLength,
InvalidKeyLength,
VerificationFailed,
ConfigAlreadySet,
}Expand description
Comprehensive error type for all sentinel-crypto operations. This enum wraps all possible errors that can occur during cryptographic operations, providing a unified error handling interface. We use thiserror for ergonomic error handling while ensuring all sensitive information is properly abstracted.
Design choice: Single error enum prevents error type proliferation and allows for consistent error handling across the entire crypto crate. All errors are wrapped to avoid leaking implementation details. Sub-enums (HashError, SignatureError, KeyError) provide specific categorization while maintaining a flat top-level API.
Security consideration: Error messages are designed to not leak sensitive information about keys, signatures, or internal state. All cryptographic failures are abstracted to prevent side-channel attacks or information disclosure.
Variants§
Hashing(HashError)
Errors related to hashing operations
Signature(SignatureError)
Errors related to signature operations
KeyManagement(KeyError)
Errors related to key management
KeyDerivation(KeyDerivationError)
Errors related to key derivation operations
Encryption
Errors related to encryption operations
Decryption
Errors related to decryption operations
Json(Error)
JSON serialization/deserialization errors
Hex(FromHexError)
Hex decoding errors
InvalidSignatureLength
Invalid signature length
InvalidKeyLength
Invalid key length
VerificationFailed
Verification failed
ConfigAlreadySet
Global config already set