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§

Source§

impl AeadCipherAlgorithm for Aes128GcmAlgo

Source§

const ALG: AeadAlgorithm = AeadAlgorithm::Aes128Gcm

Source§

impl AeadCipherAlgorithm for Aes192GcmAlgo

Source§

const ALG: AeadAlgorithm = AeadAlgorithm::Aes192Gcm

Source§

impl AeadCipherAlgorithm for Aes256GcmAlgo

Source§

const ALG: AeadAlgorithm = AeadAlgorithm::Aes256Gcm

Source§

impl AeadCipherAlgorithm for Aes256GcmSivAlgo

Source§

const ALG: AeadAlgorithm = AeadAlgorithm::Aes256GcmSiv

Source§

impl AeadCipherAlgorithm for ChaCha20Poly1305Algo

Source§

const ALG: AeadAlgorithm = AeadAlgorithm::ChaCha20Poly1305

Source§

impl AeadCipherAlgorithm for XChaCha20Poly1305Algo

Source§

const ALG: AeadAlgorithm = AeadAlgorithm::XChaCha20Poly1305