pub struct CipherState<C: Cipher> { /* private fields */ }Expand description
Cipherstate for encrypting and decrypting messages
Contains the encryption key and nonce and provides methods for encrypting and decrypting data. Will automatically increment the nonce and return an error if that overflows.
Implementations§
Source§impl<C: Cipher> CipherState<C>
impl<C: Cipher> CipherState<C>
Sourcepub fn encrypt_with_ad(
&mut self,
ad: &[u8],
plaintext: &[u8],
out: &mut [u8],
) -> CipherResult<()>
pub fn encrypt_with_ad( &mut self, ad: &[u8], plaintext: &[u8], out: &mut [u8], ) -> CipherResult<()>
AEAD encryption
Sourcepub fn encrypt_with_ad_in_place(
&mut self,
ad: &[u8],
in_out: &mut [u8],
plaintext_len: usize,
) -> CipherResult<usize>
pub fn encrypt_with_ad_in_place( &mut self, ad: &[u8], in_out: &mut [u8], plaintext_len: usize, ) -> CipherResult<usize>
AEAD encryption in place
Sourcepub fn decrypt_with_ad(
&mut self,
ad: &[u8],
ciphertext: &[u8],
out: &mut [u8],
) -> CipherResult<()>
pub fn decrypt_with_ad( &mut self, ad: &[u8], ciphertext: &[u8], out: &mut [u8], ) -> CipherResult<()>
AEAD decryption
Sourcepub fn decrypt_with_ad_in_place(
&mut self,
ad: &[u8],
in_out: &mut [u8],
ciphertext_len: usize,
) -> CipherResult<usize>
pub fn decrypt_with_ad_in_place( &mut self, ad: &[u8], in_out: &mut [u8], ciphertext_len: usize, ) -> CipherResult<usize>
AEAD decryption in place
Sourcepub fn rekey(&mut self) -> CipherResult<()>
pub fn rekey(&mut self) -> CipherResult<()>
Rekey
Rekeys as per Noise spec parts 4.2 and 11.3
Trait Implementations§
Source§impl<C: Clone + Cipher> Clone for CipherState<C>
impl<C: Clone + Cipher> Clone for CipherState<C>
Source§fn clone(&self) -> CipherState<C>
fn clone(&self) -> CipherState<C>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<C: Cipher> CryptoComponent for CipherState<C>
impl<C: Cipher> CryptoComponent for CipherState<C>
Source§impl<C: Cipher> Drop for CipherState<C>
impl<C: Cipher> Drop for CipherState<C>
Auto Trait Implementations§
impl<C> Freeze for CipherState<C>
impl<C> RefUnwindSafe for CipherState<C>
impl<C> Send for CipherState<C>
impl<C> Sync for CipherState<C>
impl<C> Unpin for CipherState<C>
impl<C> UnwindSafe for CipherState<C>
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