stream_unpack/decrypt/
mod.rs1use thiserror::Error;
2
3#[cfg(feature = "zipcrypto")]
5pub mod zipcrypto;
6
7#[cfg(feature = "ae-x")]
9pub mod aex;
10
11#[derive(Error, Debug)]
12pub enum DecryptionError {
13 #[error("generic decryption error: {0}")]
14 Generic(String)
15}
16
17#[derive(Error, Debug)]
18pub enum DecryptorCreationError {
19 #[error("generic decryptor creation error: {0}")]
20 Generic(String),
21
22 #[error("missing feature flag for encryption method: {0}")]
23 NoFeature(String),
24
25 #[error("incorrect password")]
26 IncorrectPassword,
27
28 #[error("data is not encrypted")]
29 NotEncrypted
30}
31
32pub trait Decryptor: std::fmt::Debug + Send + Sync {
33 fn update(&mut self, data: &[u8]) -> Result<(usize, &[u8]), DecryptionError>;
38}