[][src]Trait aead::Aead

pub trait Aead {
    type NonceSize: ArrayLength<u8>;
    type TagSize: ArrayLength<u8>;
    type CiphertextOverhead: ArrayLength<u8> + Unsigned;
    fn encrypt<'msg, 'aad>(
        &self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        plaintext: impl Into<Payload<'msg, 'aad>>
    ) -> Result<Vec<u8>, Error>;
fn decrypt<'msg, 'aad>(
        &self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        ciphertext: impl Into<Payload<'msg, 'aad>>
    ) -> Result<Vec<u8>, Error>; }

Authenticated Encryption with Associated Data (AEAD) algorithm.

This trait is intended for use with stateless AEAD algorithms. The AeadMut trait provides a stateful interface.

Associated Types

type NonceSize: ArrayLength<u8>

The length of a nonce.

type TagSize: ArrayLength<u8>

The maximum length of the nonce.

type CiphertextOverhead: ArrayLength<u8> + Unsigned

The upper bound amount of additional space required to support a ciphertext vs. a plaintext.

Loading content...

Required methods

fn encrypt<'msg, 'aad>(
    &self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    plaintext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>, Error>

Encrypt the given plaintext slice, and return the resulting ciphertext as a vector of bytes.

See notes on Aead::encrypt() about allowable message payloads and Associated Additional Data (AAD).

fn decrypt<'msg, 'aad>(
    &self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    ciphertext: impl Into<Payload<'msg, 'aad>>
) -> Result<Vec<u8>, Error>

Decrypt the given ciphertext slice, and return the resulting plaintext as a vector of bytes.

See notes on Aead::encrypt() and Aead::decrypt() about allowable message payloads and Associated Additional Data (AAD).

Loading content...

Implementors

Loading content...