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§
Sourcefn seal(
&self,
buf: &mut [u8],
plaintext_len: usize,
ad: &[u8],
key: &[u8],
nonce: &[u8],
) -> Result<usize, Box<dyn Error + 'static>>
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
Sourcefn seal_to(
&self,
buf: &mut [u8],
plaintext: &[u8],
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>>
AEAD-seals plaintext
into buf
together with ad
using key
and nonce
and returns the
ciphertext length