Struct chacha20poly1305::ChaChaPoly1305 
source · pub struct ChaChaPoly1305<C, N: ArrayLength<u8> = U12> { /* private fields */ }Expand description
Generic ChaCha+Poly1305 Authenticated Encryption with Additional Data (AEAD) construction.
See the toplevel documentation for a usage example.
Trait Implementations§
source§impl<C, N> AeadCore for ChaChaPoly1305<C, N>where
    N: ArrayLength<u8>,
 
impl<C, N> AeadCore for ChaChaPoly1305<C, N>where N: ArrayLength<u8>,
§type TagSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
 
type TagSize = UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>
The maximum length of the nonce.
§type CiphertextOverhead = UTerm
 
type CiphertextOverhead = UTerm
The upper bound amount of additional space required to support a
ciphertext vs. a plaintext.
source§fn generate_nonce(
    rng: impl CryptoRng + RngCore
) -> GenericArray<u8, Self::NonceSize>where
    GenericArray<u8, Self::NonceSize>: Default,
 
fn generate_nonce( rng: impl CryptoRng + RngCore ) -> GenericArray<u8, Self::NonceSize>where GenericArray<u8, Self::NonceSize>: Default,
Generate a random nonce for this AEAD algorithm. Read more
source§impl<C, N> AeadInPlace for ChaChaPoly1305<C, N>where
    C: KeyIvInit<KeySize = U32, IvSize = N> + StreamCipher + StreamCipherSeek,
    N: ArrayLength<u8>,
 
impl<C, N> AeadInPlace for ChaChaPoly1305<C, N>where C: KeyIvInit<KeySize = U32, IvSize = N> + StreamCipher + StreamCipherSeek, N: ArrayLength<u8>,
source§fn encrypt_in_place_detached(
    &self,
    nonce: &Nonce<Self>,
    associated_data: &[u8],
    buffer: &mut [u8]
) -> Result<Tag, Error>
 
fn encrypt_in_place_detached( &self, nonce: &Nonce<Self>, associated_data: &[u8], buffer: &mut [u8] ) -> Result<Tag, Error>
Encrypt the data in-place, returning the authentication tag
source§fn decrypt_in_place_detached(
    &self,
    nonce: &Nonce<Self>,
    associated_data: &[u8],
    buffer: &mut [u8],
    tag: &Tag
) -> Result<(), Error>
 
fn decrypt_in_place_detached( &self, nonce: &Nonce<Self>, associated_data: &[u8], buffer: &mut [u8], tag: &Tag ) -> Result<(), Error>
Decrypt the message in-place, returning an error in the event the provided
authentication tag does not match the given ciphertext (i.e. ciphertext
is modified/unauthentic)
source§impl<C, N> Clone for ChaChaPoly1305<C, N>where
    N: ArrayLength<u8>,
 
impl<C, N> Clone for ChaChaPoly1305<C, N>where N: ArrayLength<u8>,
source§impl<C, N> Drop for ChaChaPoly1305<C, N>where
    N: ArrayLength<u8>,
 
impl<C, N> Drop for ChaChaPoly1305<C, N>where N: ArrayLength<u8>,
source§impl<C, N> KeyInit for ChaChaPoly1305<C, N>where
    N: ArrayLength<u8>,
 
impl<C, N> KeyInit for ChaChaPoly1305<C, N>where N: ArrayLength<u8>,
source§fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
 
fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>
Create new value from variable size key.
source§fn generate_key(
    rng: impl CryptoRng + RngCore
) -> GenericArray<u8, Self::KeySize>
 
fn generate_key( rng: impl CryptoRng + RngCore ) -> GenericArray<u8, Self::KeySize>
Generate random key using the provided 
CryptoRng.source§impl<C, N> KeySizeUser for ChaChaPoly1305<C, N>where
    N: ArrayLength<u8>,
 
impl<C, N> KeySizeUser for ChaChaPoly1305<C, N>where N: ArrayLength<u8>,
impl<C, N: ArrayLength<u8>> ZeroizeOnDrop for ChaChaPoly1305<C, N>
Auto Trait Implementations§
impl<C, N> RefUnwindSafe for ChaChaPoly1305<C, N>where C: RefUnwindSafe, N: RefUnwindSafe,
impl<C, N> Send for ChaChaPoly1305<C, N>where C: Send, N: Send,
impl<C, N> Sync for ChaChaPoly1305<C, N>where C: Sync, N: Sync,
impl<C, N> Unpin for ChaChaPoly1305<C, N>where C: Unpin, N: Unpin,
impl<C, N> UnwindSafe for ChaChaPoly1305<C, N>where C: UnwindSafe, N: UnwindSafe,
Blanket Implementations§
source§impl<Alg> Aead for Algwhere
    Alg: AeadInPlace,
 
impl<Alg> Aead for Algwhere Alg: AeadInPlace,
source§impl<Alg> AeadMut for Algwhere
    Alg: AeadMutInPlace,
 
impl<Alg> AeadMut for Algwhere Alg: AeadMutInPlace,
source§impl<Alg> AeadMutInPlace for Algwhere
    Alg: AeadInPlace,
 
impl<Alg> AeadMutInPlace for Algwhere Alg: AeadInPlace,
source§fn encrypt_in_place(
    &mut self,
    nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>,
    associated_data: &[u8],
    buffer: &mut impl Buffer
) -> Result<(), Error>
 
fn encrypt_in_place( &mut self, nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut impl Buffer ) -> Result<(), Error>
Encrypt the given buffer containing a plaintext message in-place. Read more
source§fn encrypt_in_place_detached(
    &mut self,
    nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>,
    associated_data: &[u8],
    buffer: &mut [u8]
) -> Result<GenericArray<u8, <Alg as AeadCore>::TagSize>, Error>
 
fn encrypt_in_place_detached( &mut self, nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut [u8] ) -> Result<GenericArray<u8, <Alg as AeadCore>::TagSize>, Error>
Encrypt the data in-place, returning the authentication tag
source§fn decrypt_in_place(
    &mut self,
    nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>,
    associated_data: &[u8],
    buffer: &mut impl Buffer
) -> Result<(), Error>
 
fn decrypt_in_place( &mut self, nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut impl Buffer ) -> Result<(), Error>
Decrypt the message in-place, returning an error in the event the
provided authentication tag does not match the given ciphertext. Read more
source§fn decrypt_in_place_detached(
    &mut self,
    nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>,
    associated_data: &[u8],
    buffer: &mut [u8],
    tag: &GenericArray<u8, <Alg as AeadCore>::TagSize>
) -> Result<(), Error>
 
fn decrypt_in_place_detached( &mut self, nonce: &GenericArray<u8, <Alg as AeadCore>::NonceSize>, associated_data: &[u8], buffer: &mut [u8], tag: &GenericArray<u8, <Alg as AeadCore>::TagSize> ) -> Result<(), Error>
Decrypt the data in-place, returning an error in the event the provided
authentication tag does not match the given ciphertext (i.e. ciphertext
is modified/unauthentic)
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