Skip to main content

KeyAeadInPlace

Trait KeyAeadInPlace 

Source
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§

Source

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

Source

fn decrypt_in_place( &self, buffer: &mut dyn ResizeBuffer, nonce: &[u8], aad: &[u8], ) -> Result<(), Error>

Decrypt an encrypted (verification tag appended) value in place

Source

fn aead_params(&self) -> KeyAeadParams

Get the nonce and tag length for encryption

Provided Methods§

Source

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§

Source§

impl KeyAeadInPlace for AnyKey

Available on crate feature any_key only.
Source§

impl<C, D> KeyAeadInPlace for AesKey<AesCbcHmac<C, D>>

Available on crate feature aes only.
Source§

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.
Source§

impl<T: Chacha20Type> KeyAeadInPlace for Chacha20Key<T>

Available on crate feature chacha only.
Source§

impl<T> KeyAeadInPlace for AesKey<T>
where T: KeyInit + AeadInPlace + AesType<KeySize = <T as KeySizeUser>::KeySize>,

Available on crate feature aes only.