Skip to main content

proton_sdk/crypto/
errors.rs

1//! Crypto error type.
2
3/// Failure of a PGP operation.
4#[derive(Debug, thiserror::Error)]
5pub enum CryptoError {
6    /// An armored or binary key/message failed to parse.
7    #[error("failed to parse PGP data: {0}")]
8    Parse(String),
9
10    /// A locked private key could not be unlocked with the supplied passphrase.
11    #[error("failed to unlock private key: {0}")]
12    Unlock(String),
13
14    /// Decryption of a message or session key failed.
15    #[error("failed to decrypt: {0}")]
16    Decrypt(String),
17
18    /// Encryption, signing or key generation failed.
19    #[error("failed to encrypt: {0}")]
20    Encrypt(String),
21
22    /// Signature verification failed (when verification is enforced).
23    #[error("signature verification failed: {0}")]
24    Verification(String),
25}