[][src]Struct aes_siv::siv::Siv

pub struct Siv<C, M> where
    C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
    M: Mac<OutputSize = U16>, 
{ /* fields omitted */ }

Synthetic Initialization Vector (SIV) mode, providing misuse-resistant authenticated encryption (MRAE).

Methods

impl<C, M> Siv<C, M> where
    C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
    M: Mac<OutputSize = U16>,
    <C as NewStreamCipher>::KeySize: Add,
    KeySize<C>: ArrayLength<u8>, 
[src]

pub fn new(key: GenericArray<u8, KeySize<C>>) -> Self[src]

Create a new AES-SIV instance

impl<C, M> Siv<C, M> where
    C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
    M: Mac<OutputSize = U16>, 
[src]

pub fn encrypt<I, T>(
    &mut self,
    headers: I,
    plaintext: &[u8]
) -> Result<Vec<u8>, Error> where
    I: IntoIterator<Item = T>,
    T: AsRef<[u8]>, 
[src]

Encrypt the given plaintext, allocating and returning a Vec<u8> for the ciphertext.

Errors

Returns Error if plaintext.len() is less than M::OutputSize. Returns Error if headers.len() is greater than MAX_ASSOCIATED_DATA.

pub fn encrypt_in_place<I, T>(
    &mut self,
    headers: I,
    buffer: &mut impl Buffer
) -> Result<(), Error> where
    I: IntoIterator<Item = T>,
    T: AsRef<[u8]>, 
[src]

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

Errors

Returns Error if plaintext.len() is less than M::OutputSize. Returns Error if headers.len() is greater than MAX_ASSOCIATED_DATA.

pub fn encrypt_in_place_detached<I, T>(
    &mut self,
    headers: I,
    plaintext: &mut [u8]
) -> Result<Tag, Error> where
    I: IntoIterator<Item = T>,
    T: AsRef<[u8]>, 
[src]

Encrypt the given plaintext in-place, returning the SIV tag on success.

Errors

Returns Error if plaintext.len() is less than M::OutputSize. Returns Error if headers.len() is greater than MAX_ASSOCIATED_DATA.

pub fn decrypt<I, T>(
    &mut self,
    headers: I,
    ciphertext: &[u8]
) -> Result<Vec<u8>, Error> where
    I: IntoIterator<Item = T>,
    T: AsRef<[u8]>, 
[src]

Decrypt the given ciphertext, allocating and returning a Vec for the plaintext

pub fn decrypt_in_place<I, T>(
    &mut self,
    headers: I,
    buffer: &mut impl Buffer
) -> Result<(), Error> where
    I: IntoIterator<Item = T>,
    T: AsRef<[u8]>, 
[src]

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.

pub fn decrypt_in_place_detached<I, T>(
    &mut self,
    headers: I,
    ciphertext: &mut [u8],
    siv_tag: &Tag
) -> Result<(), Error> where
    I: IntoIterator<Item = T>,
    T: AsRef<[u8]>, 
[src]

Decrypt the given ciphertext in-place, authenticating it against the provided SIV tag.

Errors

Returns Error if the ciphertext is not authentic

Trait Implementations

impl<C, M> Drop for Siv<C, M> where
    C: NewStreamCipher<NonceSize = U16> + SyncStreamCipher,
    M: Mac<OutputSize = U16>, 
[src]

Auto Trait Implementations

impl<C, M> Unpin for Siv<C, M> where
    M: Unpin,
    <<C as NewStreamCipher>::KeySize as ArrayLength<u8>>::ArrayType: Unpin

impl<C, M> Send for Siv<C, M> where
    M: Send,
    <C as NewStreamCipher>::KeySize: ArrayLength<u8>, 

impl<C, M> Sync for Siv<C, M> where
    M: Sync,
    <C as NewStreamCipher>::KeySize: ArrayLength<u8>, 

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self