[][src]Trait aead::AeadMut

pub trait AeadMut {
    type NonceSize: ArrayLength<u8>;
    type TagSize: ArrayLength<u8>;
    type CiphertextOverhead: ArrayLength<u8> + Unsigned;
    fn encrypt_in_place_detached(
        &mut self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        associated_data: &[u8],
        buffer: &mut [u8]
    ) -> Result<GenericArray<u8, Self::TagSize>, Error>;
fn decrypt_in_place_detached(
        &mut self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        associated_data: &[u8],
        buffer: &mut [u8],
        tag: &GenericArray<u8, Self::TagSize>
    ) -> Result<(), Error>; fn encrypt<'msg, 'aad>(
        &mut self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        plaintext: impl Into<Payload<'msg, 'aad>>
    ) -> Result<Vec<u8>, Error> { ... }
fn encrypt_in_place(
        &mut self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        associated_data: &[u8],
        buffer: &mut impl Buffer
    ) -> Result<(), Error> { ... }
fn decrypt<'msg, 'aad>(
        &mut self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        ciphertext: impl Into<Payload<'msg, 'aad>>
    ) -> Result<Vec<u8>, Error> { ... }
fn decrypt_in_place(
        &mut self,
        nonce: &GenericArray<u8, Self::NonceSize>,
        associated_data: &[u8],
        buffer: &mut impl Buffer
    ) -> Result<(), Error> { ... } }

Stateful Authenticated Encryption with Associated Data algorithm.

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_in_place_detached(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut [u8]
) -> Result<GenericArray<u8, Self::TagSize>, Error>

Encrypt the data in-place, returning the authentication tag

fn decrypt_in_place_detached(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut [u8],
    tag: &GenericArray<u8, Self::TagSize>
) -> Result<(), Error>

Decrypt the data in-place, returning an error in the event the provided authentication tag does not match the given ciphertext (i.e. ciphertext is modified/unauthentic)

Loading content...

Provided methods

fn encrypt<'msg, 'aad>(
    &mut 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 encrypt_in_place(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut impl Buffer
) -> Result<(), Error>

Encrypt the given buffer containing a plaintext message in-place.

The buffer must have sufficient capacity to store the ciphertext message, which will always be larger than the original plaintext. The exact size needed is cipher-dependent, but generally includes the size of an authentication tag.

Returns an error if the buffer has insufficient capacity to store the resulting ciphertext message.

fn decrypt<'msg, 'aad>(
    &mut 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).

fn decrypt_in_place(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut impl Buffer
) -> Result<(), Error>

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext.

The buffer will be truncated to the length of the original plaintext message upon success.

Loading content...

Implementors

impl<Algo: Aead> AeadMut for Algo[src]

A blanket implementation of the Stateful AEAD interface for Stateless AEAD implementations.

type NonceSize = Algo::NonceSize

type TagSize = Algo::TagSize

type CiphertextOverhead = Algo::CiphertextOverhead

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

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

fn encrypt_in_place(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut impl Buffer
) -> Result<(), Error>
[src]

Encrypt the given buffer containing a plaintext message in-place.

fn encrypt_in_place_detached(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut [u8]
) -> Result<GenericArray<u8, Self::TagSize>, Error>
[src]

Encrypt the data in-place, returning the authentication tag

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

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

fn decrypt_in_place(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut impl Buffer
) -> Result<(), Error>
[src]

Decrypt the message in-place, returning an error in the event the provided authentication tag does not match the given ciphertext.

fn decrypt_in_place_detached(
    &mut self,
    nonce: &GenericArray<u8, Self::NonceSize>,
    associated_data: &[u8],
    buffer: &mut [u8],
    tag: &GenericArray<u8, Self::TagSize>
) -> Result<(), Error>
[src]

Decrypt the data in-place, returning an error in the event the provided authentication tag does not match the given ciphertext (i.e. ciphertext is modified/unauthentic)

Loading content...