Skip to main content

AuthenticatedCipherMode

Trait AuthenticatedCipherMode 

Source
pub trait AuthenticatedCipherMode<C: BlockCipher>: BlockCipherMode<C> {
    type Tag: AsRef<[u8]> + AsMut<[u8]> + Clone;

    // Required methods
    fn encrypt_with_aad(&self, plaintext: &[u8], aad: &[u8]) -> Result<Vec<u8>>;
    fn decrypt_with_aad(&self, ciphertext: &[u8], aad: &[u8]) -> Result<Vec<u8>>;

    // Provided method
    fn tag_size() -> usize { ... }
}
Expand description

Trait for authenticated block cipher modes

Required Associated Types§

Source

type Tag: AsRef<[u8]> + AsMut<[u8]> + Clone

Tag type with appropriate size constraint

Required Methods§

Source

fn encrypt_with_aad(&self, plaintext: &[u8], aad: &[u8]) -> Result<Vec<u8>>

Encrypts plaintext with associated data

Source

fn decrypt_with_aad(&self, ciphertext: &[u8], aad: &[u8]) -> Result<Vec<u8>>

Decrypts ciphertext with associated data

Provided Methods§

Source

fn tag_size() -> usize

Returns the tag size in bytes

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§