AEAD

Trait AEAD 

Source
pub trait AEAD {
    const NONCE_SIZE: usize;
    const TAG_SIZE: usize;

    // Required methods
    fn encrypt(
        &self,
        key: &SecretKey,
        nonce: &[u8],
        plaintext: &[u8],
        associated_data: &[u8],
    ) -> Result<Vec<u8>>;
    fn decrypt(
        &self,
        key: &SecretKey,
        nonce: &[u8],
        ciphertext: &[u8],
        associated_data: &[u8],
    ) -> Result<Vec<u8>>;
}
Expand description

Trait for AEAD (Authenticated Encryption with Associated Data)

Required Associated Constants§

Source

const NONCE_SIZE: usize

Nonce size in bytes

Source

const TAG_SIZE: usize

Tag size in bytes

Required Methods§

Source

fn encrypt( &self, key: &SecretKey, nonce: &[u8], plaintext: &[u8], associated_data: &[u8], ) -> Result<Vec<u8>>

Encrypt plaintext with associated data

Source

fn decrypt( &self, key: &SecretKey, nonce: &[u8], ciphertext: &[u8], associated_data: &[u8], ) -> Result<Vec<u8>>

Decrypt ciphertext with associated data

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl AEAD for RuntimeAead

Source§

const NONCE_SIZE: usize = 24usize

Source§

const TAG_SIZE: usize = 16usize