[−][src]Trait aead::AeadMutInPlace
In-place stateful AEAD trait.
This trait is both object safe and has no dependencies on alloc
or std
.
Associated Types
type NonceSize: ArrayLength<u8>
The length of a nonce.
type TagSize: ArrayLength<u8>
The maximum length of the nonce.
type CiphertextOverhead: ArrayLength<u8> + Unsigned
The upper bound amount of additional space required to support a ciphertext vs. a plaintext.
Required methods
fn encrypt_in_place_detached(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8]
) -> Result<Tag<Self::TagSize>, Error>
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8]
) -> Result<Tag<Self::TagSize>, Error>
Encrypt the data in-place, returning the authentication tag
fn decrypt_in_place_detached(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &Tag<Self::TagSize>
) -> Result<(), Error>
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &Tag<Self::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)
Provided methods
fn encrypt_in_place(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
Encrypt the given buffer containing a plaintext message in-place.
The buffer must have sufficient capacity to store the ciphertext message, which will always be larger than the original plaintext. The exact size needed is cipher-dependent, but generally includes the size of an authentication tag.
Returns an error if the buffer has insufficient capacity to store the resulting ciphertext message.
fn decrypt_in_place(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
&mut self,
nonce: &Nonce<Self::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.
The buffer will be truncated to the length of the original plaintext message upon success.
Implementors
impl<Alg: AeadInPlace> AeadMutInPlace for Alg
[src]
type NonceSize = Alg::NonceSize
type TagSize = Alg::TagSize
type CiphertextOverhead = Alg::CiphertextOverhead
fn encrypt_in_place(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
[src]
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
fn encrypt_in_place_detached(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8]
) -> Result<Tag<Self::TagSize>, Error>
[src]
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8]
) -> Result<Tag<Self::TagSize>, Error>
fn decrypt_in_place(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
[src]
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut impl Buffer
) -> Result<(), Error>
fn decrypt_in_place_detached(
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &Tag<Self::TagSize>
) -> Result<(), Error>
[src]
&mut self,
nonce: &Nonce<Self::NonceSize>,
associated_data: &[u8],
buffer: &mut [u8],
tag: &Tag<Self::TagSize>
) -> Result<(), Error>