pub trait Aead<const KEY_LEN: usize, const NONCE_LEN: usize> {
// Required methods
fn encrypt_in_place<'a>(
&mut self,
key: CryptoSensitiveRef<'_, KEY_LEN>,
nonce: CryptoSensitiveRef<'_, NONCE_LEN>,
aad: &[u8],
data: &'a mut [u8],
data_len: usize,
) -> Result<&'a [u8], Error>;
fn decrypt_in_place<'a>(
&mut self,
key: CryptoSensitiveRef<'_, KEY_LEN>,
nonce: CryptoSensitiveRef<'_, NONCE_LEN>,
aad: &[u8],
data: &'a mut [u8],
) -> Result<&'a [u8], Error>;
}Expand description
Trait representing an Authenticated Encryption with Associated Data (AEAD) algorithm.
Required Methods§
Sourcefn encrypt_in_place<'a>(
&mut self,
key: CryptoSensitiveRef<'_, KEY_LEN>,
nonce: CryptoSensitiveRef<'_, NONCE_LEN>,
aad: &[u8],
data: &'a mut [u8],
data_len: usize,
) -> Result<&'a [u8], Error>
fn encrypt_in_place<'a>( &mut self, key: CryptoSensitiveRef<'_, KEY_LEN>, nonce: CryptoSensitiveRef<'_, NONCE_LEN>, aad: &[u8], data: &'a mut [u8], data_len: usize, ) -> Result<&'a [u8], Error>
Encrypt the given data in place, using the given key, nonce and additional authenticated data (AAD).
§Arguments
key: The AEAD key.nonce: The AEAD nonce.aad: The additional authenticated data.data: The data to encrypt, which will be modified in place to contain the ciphertext and tag.data_len: The length of the plaintext data indata.
§Returns
- On success, returns a slice containing the ciphertext and tag.
- On failure, returns an
Error.
Sourcefn decrypt_in_place<'a>(
&mut self,
key: CryptoSensitiveRef<'_, KEY_LEN>,
nonce: CryptoSensitiveRef<'_, NONCE_LEN>,
aad: &[u8],
data: &'a mut [u8],
) -> Result<&'a [u8], Error>
fn decrypt_in_place<'a>( &mut self, key: CryptoSensitiveRef<'_, KEY_LEN>, nonce: CryptoSensitiveRef<'_, NONCE_LEN>, aad: &[u8], data: &'a mut [u8], ) -> Result<&'a [u8], Error>
Decrypt the given data in place, using the given key, nonce and additional authenticated data (AAD).
§Arguments
key: The AEAD key.nonce: The AEAD nonce.aad: The additional authenticated data.data: The data to decrypt, which will be modified in place to contain the plaintext.
§Returns
- On success, returns a slice containing the plaintext.
- On failure, returns an
Error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".