Trait AeadCipher

Source
pub trait AeadCipher: Cipher {
    // Required methods
    fn seal(
        &self,
        buf: &mut [u8],
        plaintext_len: usize,
        ad: &[u8],
        key: &[u8],
        nonce: &[u8],
    ) -> Result<usize, Box<dyn Error + 'static>>;
    fn seal_to(
        &self,
        buf: &mut [u8],
        plaintext: &[u8],
        ad: &[u8],
        key: &[u8],
        nonce: &[u8],
    ) -> Result<usize, Box<dyn Error + 'static>>;
    fn open(
        &self,
        buf: &mut [u8],
        ciphertext_len: usize,
        ad: &[u8],
        key: &[u8],
        nonce: &[u8],
    ) -> Result<usize, Box<dyn Error + 'static>>;
    fn open_to(
        &self,
        buf: &mut [u8],
        ciphertext: &[u8],
        ad: &[u8],
        key: &[u8],
        nonce: &[u8],
    ) -> Result<usize, Box<dyn Error + 'static>>;
}
Expand description

An AEAD extension for Cipher

Required Methods§

Source

fn seal( &self, buf: &mut [u8], plaintext_len: usize, ad: &[u8], key: &[u8], nonce: &[u8], ) -> Result<usize, Box<dyn Error + 'static>>

AEAD-seals plaintext_len bytes in-place in buf together with ad using key and nonce and returns the ciphertext length

Source

fn seal_to( &self, buf: &mut [u8], plaintext: &[u8], ad: &[u8], key: &[u8], nonce: &[u8], ) -> Result<usize, Box<dyn Error + 'static>>

AEAD-seals plaintext into buf together with ad using key and nonce and returns the ciphertext length

Source

fn open( &self, buf: &mut [u8], ciphertext_len: usize, ad: &[u8], key: &[u8], nonce: &[u8], ) -> Result<usize, Box<dyn Error + 'static>>

AEAD-opens ciphertext_len bytes in-place in buf together with ad using key and nonce and returns the plaintext length

Source

fn open_to( &self, buf: &mut [u8], ciphertext: &[u8], ad: &[u8], key: &[u8], nonce: &[u8], ) -> Result<usize, Box<dyn Error + 'static>>

AEAD-opens ciphertext into buf together with ad using key and nonce and returns the plaintext length

Implementors§