qudag_crypto/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during cryptographic operations
4#[derive(Debug, Error)]
5pub enum CryptoError {
6    #[error("Invalid key size")]
7    InvalidKeySize,
8
9    #[error("Invalid signature size")]
10    InvalidSignatureSize,
11
12    #[error("Invalid ciphertext size")]
13    InvalidCiphertextSize,
14
15    #[error("Invalid shared secret size")]
16    InvalidSharedSecretSize,
17
18    #[error("Key generation failed")]
19    KeyGenerationError,
20
21    #[error("Signature verification failed")]
22    VerificationError,
23
24    #[error("Encryption failed")]
25    EncryptionError,
26
27    #[error("Decryption failed")]
28    DecryptionError,
29
30    #[error("Invalid message size")]
31    InvalidMessageSize,
32
33    #[error("Invalid parameters")]
34    InvalidParameters,
35
36    #[error("Operation not supported")]
37    UnsupportedOperation,
38
39    #[error("Internal error: {0}")]
40    InternalError(String),
41
42    #[error("Invalid length")]
43    InvalidLength,
44
45    #[error("Encapsulation failed")]
46    EncapsulationError,
47
48    #[error("Decapsulation failed")]
49    DecapsulationError,
50}