pub struct StreamOpener {
cipher: ChaChaPoly1305<StreamCipherCoreWrapper<XChaChaCore<R20>>, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>>,
nonce_prefix: [u8; 16],
chunk_size: usize,
aad: Vec<u8>,
counter: u64,
finished: bool,
}Expand description
Incremental decryption of one file’s content stream.
Fields§
§cipher: ChaChaPoly1305<StreamCipherCoreWrapper<XChaChaCore<R20>>, UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B0>, B0>, B0>>§nonce_prefix: [u8; 16]§chunk_size: usize§aad: Vec<u8>§counter: u64§finished: boolImplementations§
Source§impl StreamOpener
impl StreamOpener
pub fn new(header: &FileHeader, key: &SecureKey) -> StreamOpener
Sourcepub fn chunk_ciphertext_len(&self) -> usize
pub fn chunk_ciphertext_len(&self) -> usize
Ciphertext bytes to feed per StreamOpener::open_chunk call; only
the final chunk may be shorter.
Sourcepub fn open_chunk(
&mut self,
ciphertext: &[u8],
is_last: bool,
) -> Result<SecureBytes, FileError>
pub fn open_chunk( &mut self, ciphertext: &[u8], is_last: bool, ) -> Result<SecureBytes, FileError>
Opens the next chunk. is_last marks that no more ciphertext
follows; sealing and opening must agree on which chunk is final or
authentication fails (this is what detects truncation).
Auto Trait Implementations§
impl Freeze for StreamOpener
impl RefUnwindSafe for StreamOpener
impl Send for StreamOpener
impl Sync for StreamOpener
impl Unpin for StreamOpener
impl UnsafeUnpin for StreamOpener
impl UnwindSafe for StreamOpener
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more