Trait aes_gcm::NewAead

source ·
pub trait NewAead {
    type KeySize: ArrayLength<u8>;

    // Required method
    fn new(key: &GenericArray<u8, Self::KeySize>) -> Self;

    // Provided method
    fn new_from_slice(key: &[u8]) -> Result<Self, Error>
       where Self: Sized { ... }
}
Expand description

Instantiate either a stateless Aead or stateful AeadMut algorithm.

Required Associated Types§

source

type KeySize: ArrayLength<u8>

The size of the key array required by this algorithm.

Required Methods§

source

fn new(key: &GenericArray<u8, Self::KeySize>) -> Self

Create a new AEAD instance with the given key.

Provided Methods§

source

fn new_from_slice(key: &[u8]) -> Result<Self, Error>where Self: Sized,

Create new AEAD instance from key given as a byte slice..

Default implementation will accept only keys with length equal to KeySize.

Implementors§

source§

impl<Aes, NonceSize> NewAead for AesGcm<Aes, NonceSize>where Aes: NewBlockCipher + BlockCipher<BlockSize = U16> + BlockEncrypt, Aes::ParBlocks: ArrayLength<Block<Aes>>, NonceSize: ArrayLength<u8>,