pub struct Chacha20Poly1305(/* private fields */);Expand description
The AEAD built from ChaCha20 and Poly1305 as described in https://datatracker.ietf.org/doc/html/rfc8439.
Implementations§
Trait Implementations§
Source§impl Aead for Chacha20Poly1305
impl Aead for Chacha20Poly1305
Source§type Tag = [u8; 16]
type Tag = [u8; 16]
The type of tags produced by this AEAD. Generally a u8 array of fixed
length.
Source§type Nonce = [u8; 12]
type Nonce = [u8; 12]
The type of nonces used by this AEAD. Generally a u8 array of fixed
length.
Source§fn seal(&self, nonce: &Self::Nonce, plaintext: &[u8], ad: &[u8]) -> Vec<u8>
fn seal(&self, nonce: &Self::Nonce, plaintext: &[u8], ad: &[u8]) -> Vec<u8>
Encrypt and authenticate
plaintext, and authenticate ad, returning
the result as a freshly allocated Vec. The nonce must never
be used in any sealing operation with the same key, ever again.Source§fn seal_in_place(
&self,
nonce: &Self::Nonce,
plaintext: &mut [u8],
ad: &[u8],
) -> Self::Tag
fn seal_in_place( &self, nonce: &Self::Nonce, plaintext: &mut [u8], ad: &[u8], ) -> Self::Tag
Encrypt and authenticate
plaintext, and authenticate ad, writing
the ciphertext over plaintext and additionally returning the calculated
tag, which is usually appended to the ciphertext. The nonce must never
be used in any sealing operation with the same key, ever again.Source§fn open(
&self,
nonce: &Self::Nonce,
ciphertext: &[u8],
ad: &[u8],
) -> Option<Vec<u8>>
fn open( &self, nonce: &Self::Nonce, ciphertext: &[u8], ad: &[u8], ) -> Option<Vec<u8>>
Authenticate
ciphertext and ad and, if valid, decrypt ciphertext,
returning the original plaintext in a newly allocated Vec. The nonce
must be the same value as given to the sealing operation that produced
ciphertext.Source§fn open_in_place(
&self,
nonce: &Self::Nonce,
ciphertext: &mut [u8],
tag: &Self::Tag,
ad: &[u8],
) -> Result<(), InvalidCiphertext>
fn open_in_place( &self, nonce: &Self::Nonce, ciphertext: &mut [u8], tag: &Self::Tag, ad: &[u8], ) -> Result<(), InvalidCiphertext>
Authenticate
ciphertext and ad using tag and, if valid, decrypt
ciphertext in place. The nonce must be the same value as given to
the sealing operation that produced ciphertext.Auto Trait Implementations§
impl Freeze for Chacha20Poly1305
impl RefUnwindSafe for Chacha20Poly1305
impl !Send for Chacha20Poly1305
impl !Sync for Chacha20Poly1305
impl Unpin for Chacha20Poly1305
impl UnsafeUnpin for Chacha20Poly1305
impl UnwindSafe for Chacha20Poly1305
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