pub trait AeadCipherAlgorithm {
const ALG: AeadAlgorithm;
// Required methods
fn encrypt(
params: &AeadParams<'_>,
plaintext: &[u8],
) -> Result<Vec<u8>, AlgorithmError>;
fn decrypt(
params: &AeadParams<'_>,
ciphertext_with_tag: &[u8],
) -> Result<Zeroizing<Vec<u8>>, AlgorithmError>;
}Expand description
Adapter contract for an AEAD cipher algorithm.
Required Associated Constants§
Sourceconst ALG: AeadAlgorithm
const ALG: AeadAlgorithm
The AEAD algorithm selector this adapter implements.
Required Methods§
Sourcefn encrypt(
params: &AeadParams<'_>,
plaintext: &[u8],
) -> Result<Vec<u8>, AlgorithmError>
fn encrypt( params: &AeadParams<'_>, plaintext: &[u8], ) -> Result<Vec<u8>, AlgorithmError>
Encrypt plaintext under params, returning ciphertext || tag.
Sourcefn decrypt(
params: &AeadParams<'_>,
ciphertext_with_tag: &[u8],
) -> Result<Zeroizing<Vec<u8>>, AlgorithmError>
fn decrypt( params: &AeadParams<'_>, ciphertext_with_tag: &[u8], ) -> Result<Zeroizing<Vec<u8>>, AlgorithmError>
Decrypt and authenticate ciphertext || tag; fails closed on a
tampered ciphertext or AAD. Returned plaintext zeroizes on drop.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".