#[derive(Debug, thiserror::Error)]
pub enum BdeError {
#[error("i/o error reading BitLocker volume: {0}")]
Io(#[from] std::io::Error),
#[error("not a BitLocker volume: signature at offset 3 is {signature:02x?} (expected \"-FVE-FS-\" or \"MSWIN4.1\")")]
NotBitLocker {
signature: [u8; 8],
},
#[error("no valid FVE metadata block found at candidate offsets {offsets:?}")]
NoValidMetadata {
offsets: [u64; 3],
},
#[error("unsupported encryption method 0x{method:04x} (not a recognized BitLocker cipher; this build decrypts 0x8000 AES-128-CBC + Elephant Diffuser and 0x8002 AES-128-CBC)")]
UnsupportedEncryptionMethod {
method: u16,
},
#[error("recognized but unvalidated encryption method 0x{method:04x} (no oracle yet; this build decrypts only 0x8000 and 0x8002)")]
UnvalidatedEncryptionMethod {
method: u16,
},
#[error("no {protector} protector present; protectors found: {found:?}")]
NoUnlockProtector {
protector: &'static str,
found: Vec<u16>,
},
#[error("invalid recovery password: {reason}")]
InvalidRecoveryPassword {
reason: &'static str,
},
#[error("password protector is malformed: missing {what}")]
MissingKeyMaterial {
what: &'static str,
},
#[error(
"AES-CCM authentication failed unwrapping the {what} (wrong password or corrupt metadata)"
)]
AuthenticationFailed {
what: &'static str,
},
#[error("decrypted {what} key container is malformed (got {got} bytes, need at least {need})")]
MalformedKeyContainer {
what: &'static str,
got: usize,
need: usize,
},
}
pub type Result<T> = std::result::Result<T, BdeError>;