Struct dco3_crypto::Crypter
source · pub struct Crypter<'b, C, State = Open> {
pub crypter: C,
pub buffer: &'b mut Vec<u8>,
pub count: usize,
pub plain_file_key: PlainFileKey,
pub mode: Mode,
pub state: PhantomData<State>,
}
Expand description
Allows chunked en- and decryption. Holds a reference to a buffer to store the mssage, processed bytes as count and the used plain file key and mode. Requires generic type annotation The type ‘C’ represents an internal handler for the encryption functions with chunking
Fields§
§crypter: C
§buffer: &'b mut Vec<u8>
§count: usize
§plain_file_key: PlainFileKey
§mode: Mode
§state: PhantomData<State>
Trait Implementations§
source§impl<'b> ChunkedEncryption<'b, Crypter> for Crypter<'b, Crypter>
impl<'b> ChunkedEncryption<'b, Crypter> for Crypter<'b, Crypter>
source§fn try_new_for_decryption(
plain_file_key: PlainFileKey,
buffer: &'b mut Vec<u8>
) -> Result<Self, DracoonCryptoError>
fn try_new_for_decryption( plain_file_key: PlainFileKey, buffer: &'b mut Vec<u8> ) -> Result<Self, DracoonCryptoError>
Returns a Crypter for decryption by passing the plain file key and a writable (mutable) buffer
source§fn try_new_for_encryption(
buffer: &'b mut Vec<u8>
) -> Result<Self, DracoonCryptoError>
fn try_new_for_encryption( buffer: &'b mut Vec<u8> ) -> Result<Self, DracoonCryptoError>
Returns a Crypter for enryption by passing a writable (mutable) buffer
source§fn update(&mut self, data: &[u8]) -> Result<usize, DracoonCryptoError>
fn update(&mut self, data: &[u8]) -> Result<usize, DracoonCryptoError>
Update the Crypter with given data
source§fn set_tag(&mut self, tag: &[u8]) -> Result<(), DracoonCryptoError>
fn set_tag(&mut self, tag: &[u8]) -> Result<(), DracoonCryptoError>
Set the tag before finalizing the encryption
source§fn get_message(&mut self) -> &Vec<u8>
fn get_message(&mut self) -> &Vec<u8>
Get the message (result of encryption / decryption) from buffer
source§fn get_plain_file_key(&self) -> PlainFileKey
fn get_plain_file_key(&self) -> PlainFileKey
Get the plain file key used for either encryption or decryption
Auto Trait Implementations§
impl<'b, C, State> Freeze for Crypter<'b, C, State>where
C: Freeze,
impl<'b, C, State> RefUnwindSafe for Crypter<'b, C, State>where
C: RefUnwindSafe,
State: RefUnwindSafe,
impl<'b, C, State> Send for Crypter<'b, C, State>
impl<'b, C, State> Sync for Crypter<'b, C, State>
impl<'b, C, State> Unpin for Crypter<'b, C, State>
impl<'b, C, State = Open> !UnwindSafe for Crypter<'b, C, State>
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