pub trait NewAead {
type KeySize: ArrayLength<u8>;
// Required method
fn new(key: &GenericArray<u8, Self::KeySize>) -> Self;
// Provided methods
fn new_from_slice(key: &[u8]) -> Result<Self, Error>
where Self: Sized { ... }
fn generate_key(
rng: impl CryptoRng + RngCore
) -> GenericArray<u8, Self::KeySize> { ... }
}
Expand description
Instantiate either a stateless Aead
or stateful AeadMut
algorithm.
The size of the key array required by this algorithm.
Create a new AEAD instance with the given key.
Create new AEAD instance from key given as a byte slice..
Default implementation will accept only keys with length equal to KeySize
.
Generate a random key for this AEAD using the provided CryptoRng
.