Trait cipher::KeyIvInit

source ·
pub trait KeyIvInit: KeySizeUser + IvSizeUser + Sized {
    // Required method
    fn new(key: &Array<u8, Self::KeySize>, iv: &Array<u8, Self::IvSize>) -> Self;

    // Provided methods
    fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength> { ... }
    fn generate_key_with_rng(
        rng: &mut impl CryptoRngCore
    ) -> Result<Array<u8, Self::KeySize>, Error> { ... }
    fn generate_iv_with_rng(
        rng: &mut impl CryptoRngCore
    ) -> Result<Array<u8, Self::IvSize>, Error> { ... }
    fn generate_key_iv_with_rng(
        rng: &mut impl CryptoRngCore
    ) -> Result<(Array<u8, Self::KeySize>, Array<u8, Self::IvSize>), Error> { ... }
}
Expand description

Types which can be initialized from key and initialization vector (nonce).

Required Methods§

source

fn new(key: &Array<u8, Self::KeySize>, iv: &Array<u8, Self::IvSize>) -> Self

Create new value from fixed length key and nonce.

Provided Methods§

source

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

Create new value from variable length key and nonce.

source

fn generate_key_with_rng( rng: &mut impl CryptoRngCore ) -> Result<Array<u8, Self::KeySize>, Error>

Available on crate feature rand_core only.

Generate random key using the provided CryptoRngCore.

source

fn generate_iv_with_rng( rng: &mut impl CryptoRngCore ) -> Result<Array<u8, Self::IvSize>, Error>

Available on crate feature rand_core only.

Generate random IV using the provided CryptoRngCore.

source

fn generate_key_iv_with_rng( rng: &mut impl CryptoRngCore ) -> Result<(Array<u8, Self::KeySize>, Array<u8, Self::IvSize>), Error>

Available on crate feature rand_core only.

Generate random key and IV using the provided CryptoRngCore.

Object Safety§

This trait is not object safe.

Implementors§