Trait aes_gcm::KeyInit

source ·
pub trait KeyInit: Sized + KeySizeUser {
    // Required method
    fn new(key: &GenericArray<u8, Self::KeySize>) -> Self;

    // Provided methods
    fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength> { ... }
    fn generate_key(
        rng: impl CryptoRng + RngCore,
    ) -> GenericArray<u8, Self::KeySize> { ... }
}
Expand description

Types which can be initialized from key.

Required Methods§

source

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

Create new value from fixed size key.

Provided Methods§

source

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

Create new value from variable size key.

source

fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>

Generate random key using the provided CryptoRng.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl KeyInit for Aes128

source§

impl KeyInit for Aes128Dec

source§

impl KeyInit for Aes128Enc

source§

impl KeyInit for Aes192

source§

impl KeyInit for Aes192Dec

source§

impl KeyInit for Aes192Enc

source§

impl KeyInit for Aes256

source§

impl KeyInit for Aes256Dec

source§

impl KeyInit for Aes256Enc

source§

impl KeyInit for GHash

source§

fn new(h: &GenericArray<u8, <GHash as KeySizeUser>::KeySize>) -> GHash

Initialize GHASH with the given H field element

source§

impl KeyInit for Polyval

source§

fn new(h: &GenericArray<u8, <Polyval as KeySizeUser>::KeySize>) -> Polyval

Initialize POLYVAL with the given H field element

source§

impl<T> KeyInit for StreamCipherCoreWrapper<T>

Implementors§

source§

impl<Aes, NonceSize, TagSize> KeyInit for AesGcm<Aes, NonceSize, TagSize>
where Aes: BlockSizeUser<BlockSize = U16> + BlockEncrypt + KeyInit, TagSize: TagSize,

source§

impl<T> KeyInit for T
where T: InnerInit, <T as InnerUser>::Inner: KeyInit,