Skip to main content

bitwarden_importers/importers/keeper/crypto/
error.rs

1/// Errors produced by the Keeper crypto layer.
2///
3/// Messages are intentionally coarse and never include key material, plaintext or ciphertext, so an
4/// error can be surfaced to a client or logged without leaking secrets.
5#[derive(Debug, thiserror::Error)]
6pub enum KeeperCryptoError {
7    /// Decryption or authentication failed (bad key, tampered ciphertext, or invalid padding).
8    #[error("Keeper decryption failed")]
9    Decryption,
10    /// A key could not be parsed or has the wrong size.
11    #[error("Invalid Keeper key material")]
12    InvalidKey,
13    /// A private key required to decrypt the given record key type was not supplied.
14    /// Currently unreachable (RSA and ECC record-key decryption not yet supported); will be used
15    /// when ECC record-key support is added.
16    #[error("Missing Keeper private key")]
17    MissingPrivateKey,
18    /// The input was malformed (too short, wrong length, or not a valid encoding).
19    #[error("Malformed Keeper input")]
20    InvalidData,
21    /// A Keeper `encryptionParams` blob was corrupted or failed its integrity check.
22    #[error("Corrupted Keeper encryption parameters")]
23    CorruptEncryptionParams,
24    /// The record key type is not supported for decryption.
25    #[error("Unsupported Keeper record key type")]
26    UnsupportedKeyType,
27}