1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use thiserror;
#[derive(thiserror::Error, Copy, Clone, Debug, PartialEq)]
pub enum Error {
#[error("The provided buffer is shorter than expected")]
BufferTooSmall,
#[error("The provided passphrase is shorter than expected")]
PassphraseTooSmall,
#[error(
"The provided key does not have the required length for the \
encryption algorithm"
)]
KeySizeMismatch,
#[error("The provided parameters for the encryption are too weak")]
CryptoParamsWeak,
#[error("Could not decrypt the ciphertext")]
DecryptionError,
#[error("The provided buffer does not include a metadata header")]
MetadataMissing,
#[error("The provided buffer has an invalid metadata header")]
MetadataInvalid,
}