pub struct StreamEncryptor<C: ChunkGenerator> { /* private fields */ }Implementations§
Source§impl StreamEncryptor<RandomChunkGenerator>
impl StreamEncryptor<RandomChunkGenerator>
pub fn with_rand_chunks( file_name: &str, password: &str, chunking_threshold: u64, min_chunk_size: u64, max_chunk_size: u64, ) -> Result<Self, Error>
pub fn with_rand_chunks_seed( file_name: &str, password: &str, chunking_threshold: u64, min_chunk_size: u64, max_chunk_size: u64, seed: u128, ) -> Result<Self, Error>
Source§impl<C: ChunkGenerator> StreamEncryptor<C>
impl<C: ChunkGenerator> StreamEncryptor<C>
Sourcepub fn process_data(&mut self, data: &[u8]) -> Vec<Chunk>
pub fn process_data(&mut self, data: &[u8]) -> Vec<Chunk>
Processes given data.
This is the main processing loop to be called repetitively until end of stream.
Sourcepub fn on_end_of_data(&mut self) -> Vec<Chunk>
pub fn on_end_of_data(&mut self) -> Vec<Chunk>
Finalizes the encryption
Must be called when the stream is exhausted to get the last remaining chunks to encrypt.
Sourcepub fn chunk_hash_algorithm(&self) -> ChecksumAlgorithm
pub fn chunk_hash_algorithm(&self) -> ChecksumAlgorithm
Returns the identifier of the algorithm to use for computing chunk checksums
Sourcepub fn encrypt_chunk(&self, chunk: &Chunk) -> Result<Blob, Error>
pub fn encrypt_chunk(&self, chunk: &Chunk) -> Result<Blob, Error>
Returns the given chunk as encrypted data
Sourcepub fn encrypt_chunks(
&self,
chunks: &Vec<Chunk>,
) -> Result<Vec<(u64, Blob)>, Error>
pub fn encrypt_chunks( &self, chunks: &Vec<Chunk>, ) -> Result<Vec<(u64, Blob)>, Error>
Returns the given chunks as encrypted data
@pre c.is_ready() for all c in chunks
pub fn parallel_encrypt_chunks( &mut self, max_threads: u32, chunks: &Vec<Chunk>, ) -> Result<Vec<(u64, Blob)>, Error>
Sourcepub fn register_encrypted_chunk(
&self,
chunk_index: u64,
id: &str,
) -> Result<(), Error>
pub fn register_encrypted_chunk( &self, chunk_index: u64, id: &str, ) -> Result<(), Error>
Associates a string id to an encrypted chunk identified by its index
Sourcepub fn finalize(&mut self) -> Result<Blob, Error>
pub fn finalize(&mut self) -> Result<Blob, Error>
Finalizes the encryption and returns the encrypted manifest @pre on_end_of_data has been called and all chunks have been encrypted and registered
Sourcepub fn get_registered_chunk_id(&self, chunk_index: u64) -> Result<String, Error>
pub fn get_registered_chunk_id(&self, chunk_index: u64) -> Result<String, Error>
Gets the id assigned to chunk at index chunk_index @pre chunk of index chunk_index as been registered by calling register_encrypted_chunk
Sourcepub fn get_chunks_count(&self) -> u64
pub fn get_chunks_count(&self) -> u64
Returns the total number of chunks so far Increases as we keep piling chunks but may decrease e.g. on finalize if merging last chunks
Sourcepub fn get_registered_chunks_count(&self) -> u64
pub fn get_registered_chunks_count(&self) -> u64
Returns the number of registered encrypted chunks i.e. the number of chunks on which register_encrypted_chunk has been called.
Sourcepub fn get_chunk_ids(&self) -> Vec<String>
pub fn get_chunk_ids(&self) -> Vec<String>
Returns the chunk ids @pre All chunks have been registered and finalize() has been called