pub trait AeadInOut: AeadCore {
// Required methods
fn encrypt_inout_detached(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: InOutBuf<'_, '_, u8>,
) -> Result<Tag<Self>>;
fn decrypt_inout_detached(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &Tag<Self>,
) -> Result<()>;
// Provided methods
fn encrypt_in_place(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: &mut dyn Buffer,
) -> Result<()> { ... }
fn decrypt_in_place(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: &mut dyn Buffer,
) -> Result<()> { ... }
}Expand description
In-place and inout AEAD trait which handles the authentication tag as a return value/separate parameter.
Required Methods§
Sourcefn encrypt_inout_detached(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: InOutBuf<'_, '_, u8>,
) -> Result<Tag<Self>>
fn encrypt_inout_detached( &self, nonce: &Nonce<Self>, associated_data: &[u8], buffer: InOutBuf<'_, '_, u8>, ) -> Result<Tag<Self>>
Sourcefn decrypt_inout_detached(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: InOutBuf<'_, '_, u8>,
tag: &Tag<Self>,
) -> Result<()>
fn decrypt_inout_detached( &self, nonce: &Nonce<Self>, associated_data: &[u8], buffer: InOutBuf<'_, '_, u8>, tag: &Tag<Self>, ) -> Result<()>
Decrypt the data in the provided InOutBuf, returning an error in the event the
provided authentication tag is invalid for the given ciphertext (i.e. ciphertext
is modified/unauthentic).
§Errors
- if the
ciphertextis inauthentic (i.e. tag verification failure) - if the
ciphertextis too long - if the
aadis too long
Provided Methods§
Sourcefn encrypt_in_place(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: &mut dyn Buffer,
) -> Result<()>
fn encrypt_in_place( &self, nonce: &Nonce<Self>, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<()>
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.
§Errors
Returns an error if the buffer has insufficient capacity to store the resulting ciphertext message.
Sourcefn decrypt_in_place(
&self,
nonce: &Nonce<Self>,
associated_data: &[u8],
buffer: &mut dyn Buffer,
) -> Result<()>
fn decrypt_in_place( &self, nonce: &Nonce<Self>, associated_data: &[u8], buffer: &mut dyn Buffer, ) -> Result<()>
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.
§Errors
- if the
ciphertextis inauthentic (i.e. tag verification failure)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".