Skip to main content

dpapi_core/
error.rs

1//! Error type shared across the DPAPI blob parser, decryptor, and Chrome cookie
2//! unwrapper.
3
4#[derive(Debug, thiserror::Error)]
5pub enum DpapiError {
6    #[error("data too short: need at least {needed} bytes, got {got}")]
7    TooShort { needed: usize, got: usize },
8    #[error("unsupported version: {0}")]
9    UnsupportedVersion(u32),
10    #[error("not a DPAPI blob: provider GUID {0} != the DPAPI provider")]
11    NotDpapiProvider(String),
12    #[error("unsupported algorithm ID: {0:#010x}")]
13    UnsupportedAlgId(u32),
14    #[error("invalid key or IV length")]
15    InvalidKeyLength,
16    #[error("decryption failed")]
17    DecryptionFailed,
18    #[error("HMAC verification failed")]
19    HmacMismatch,
20    #[error("UTF-16 decode error")]
21    Utf16Error,
22}