pub trait KeyAeadInPlace {
// Required methods
fn encrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<usize, Error>;
fn decrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<(), Error>;
fn aead_params(&self) -> KeyAeadParams;
// Provided method
fn aead_padding(&self, _msg_len: usize) -> usize { ... }
}Expand description
Object-safe trait for key types which perform AEAD encryption
Required Methods§
Sourcefn encrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<usize, Error>
fn encrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<usize, Error>
Encrypt a secret value in place, appending the verification tag and returning the length of the ciphertext
Sourcefn decrypt_in_place(
&self,
buffer: &mut dyn ResizeBuffer,
nonce: &[u8],
aad: &[u8],
) -> Result<(), Error>
fn decrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<(), Error>
Decrypt an encrypted (verification tag appended) value in place
Sourcefn aead_params(&self) -> KeyAeadParams
fn aead_params(&self) -> KeyAeadParams
Get the nonce and tag length for encryption
Provided Methods§
Sourcefn aead_padding(&self, _msg_len: usize) -> usize
fn aead_padding(&self, _msg_len: usize) -> usize
Get the ciphertext padding required
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl KeyAeadInPlace for AnyKey
Available on crate feature
any_key only.impl<C, D> KeyAeadInPlace for AesKey<AesCbcHmac<C, D>>where
AesCbcHmac<C, D>: AesType,
C: BlockCipher + KeyInit + BlockEncryptMut + BlockDecryptMut,
D: Digest + BlockSizeUser,
C::KeySize: Shl<B1>,
<C::KeySize as Shl<B1>>::Output: ArrayLength<u8>,
Available on crate feature
aes only.impl<C> KeyAeadInPlace for AesKey<AesKeyWrap<C>>where
AesKeyWrap<C>: AesType,
C: KeyInit + KeySizeUser<KeySize = <AesKeyWrap<C> as AesType>::KeySize> + BlockCipher<BlockSize = U16> + BlockDecrypt + BlockEncrypt,
Available on crate feature
aes only.impl<T: Chacha20Type> KeyAeadInPlace for Chacha20Key<T>
Available on crate feature
chacha only.impl<T> KeyAeadInPlace for AesKey<T>
Available on crate feature
aes only.