-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy patherror.rs
More file actions
61 lines (43 loc) · 1.5 KB
/
error.rs
File metadata and controls
61 lines (43 loc) · 1.5 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Invalid auth secret")]
InvalidAuthSecret,
#[error("Invalid salt")]
InvalidSalt,
#[error("Invalid key length")]
InvalidKeyLength,
#[error("Invalid record size")]
InvalidRecordSize,
#[error("Invalid header size (too short)")]
HeaderTooShort,
#[error("Truncated ciphertext")]
DecryptTruncated,
#[error("Zero-length ciphertext")]
ZeroCiphertext,
#[error("Zero-length plaintext")]
ZeroPlaintext,
#[error("Block too short")]
BlockTooShort,
#[error("Plaintext is too long to fit in a single block")]
PlaintextTooLong,
#[error("Decryption across multiple records is not supported")]
MultipleRecordsNotSupported,
#[error("Invalid decryption padding")]
DecryptPadding,
#[error("Invalid encryption padding")]
EncryptPadding,
#[error("Could not decode base64 entry")]
DecodeError(#[from] base64::DecodeError),
#[error("Crypto backend error")]
CryptoError,
#[cfg(feature = "backend-openssl")]
#[error("OpenSSL error: {0}")]
OpenSSLError(#[from] openssl::error::ErrorStack),
#[cfg(feature = "backend-rustcrypto")]
#[error("RustCrypto error: {0}")]
RustCryptoError(String),
}