Skip to main content

StreamSealer

Struct StreamSealer 

Source
pub struct StreamSealer { /* private fields */ }
Expand description

Incremental encryption of one file’s content stream.

Implementations§

Source§

impl StreamSealer

Source

pub fn begin( metadata: &FileMetadata, key: &SecureKey, kdf_params: KeyDerivationParams, salt: [u8; 16], nonce_prefix: [u8; 16], metadata_nonce: [u8; 24], ) -> Result<(FileHeader, StreamSealer), FileError>

Starts sealing a new v3 file: encrypts the metadata envelope, builds the header, and returns it together with the sealer for the content chunks. The caller supplies the derived key and fresh random salt/nonces, keeping this deterministic.

Source

pub fn begin_with_chunk_size( metadata: &FileMetadata, key: &SecureKey, kdf_params: KeyDerivationParams, salt: [u8; 16], nonce_prefix: [u8; 16], metadata_nonce: [u8; 24], chunk_size: u32, ) -> Result<(FileHeader, StreamSealer), FileError>

StreamSealer::begin with an explicit chunk size, for callers with unusual chunking needs. The size must satisfy the same bounds the header enforces.

Source

pub fn chunk_plaintext_len(&self) -> usize

Plaintext bytes to feed per StreamSealer::seal_chunk call; only the final chunk may be shorter.

Source

pub fn seal_chunk( &mut self, plaintext: &[u8], is_last: bool, ) -> Result<Vec<u8>, FileError>

Seals the next chunk. Every chunk except the last must be exactly chunk_plaintext_len bytes; the last may be shorter (or empty).

Source

pub fn finished(&self) -> bool

True once the final chunk has been sealed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.