Skip to main content

AeadCipherAlgorithm

Trait AeadCipherAlgorithm 

Source
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§

Source

const ALG: AeadAlgorithm

The AEAD algorithm selector this adapter implements.

Required Methods§

Source

fn encrypt( params: &AeadParams<'_>, plaintext: &[u8], ) -> Result<Vec<u8>, AlgorithmError>

Encrypt plaintext under params, returning ciphertext || tag.

Source

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".

Implementors§