KeyIvInit

Trait KeyIvInit 

Source
pub trait KeyIvInit:
    KeySizeUser
    + IvSizeUser
    + Sized {
Show 13 methods // Required method fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self; // Provided methods fn weak_key_test(_key: &Key<Self>) -> Result<(), WeakKeyError> { ... } fn new_checked(key: &Key<Self>, iv: &Iv<Self>) -> Result<Self, WeakKeyError> { ... } fn new_from_slices(key: &[u8], iv: &[u8]) -> Result<Self, InvalidLength> { ... } fn generate_key() -> Result<Key<Self>, OsError> { ... } fn generate_key_with_rng<R: CryptoRng + ?Sized>(rng: &mut R) -> Key<Self> { ... } fn try_generate_key_with_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Key<Self>, R::Error> { ... } fn generate_iv() -> Result<Iv<Self>, OsError> { ... } fn generate_iv_with_rng<R: CryptoRng + ?Sized>(rng: &mut R) -> Iv<Self> { ... } fn try_generate_iv_with_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Iv<Self>, R::Error> { ... } fn generate_key_iv() -> Result<(Key<Self>, Iv<Self>), OsError> { ... } fn generate_key_iv_with_rng<R: CryptoRng + ?Sized>( rng: &mut R, ) -> (Key<Self>, Iv<Self>) { ... } fn try_generate_key_iv_with_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<(Key<Self>, Iv<Self>), R::Error> { ... }
}
Expand description

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

Required Methods§

Source

fn new(key: &Key<Self>, iv: &Iv<Self>) -> Self

Create new value from fixed length key and nonce.

Provided Methods§

Source

fn weak_key_test(_key: &Key<Self>) -> Result<(), WeakKeyError>

Check if the key might be considered weak.

Source

fn new_checked(key: &Key<Self>, iv: &Iv<Self>) -> Result<Self, WeakKeyError>

Create new value from fixed length key and nonce after checking the key for weakness.

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() -> Result<Key<Self>, OsError>

Available on crate feature os_rng only.

Generate random key using the operating system’s secure RNG.

Source

fn generate_key_with_rng<R: CryptoRng + ?Sized>(rng: &mut R) -> Key<Self>

Available on crate feature rand_core only.

Generate random key using the provided CryptoRng.

Source

fn try_generate_key_with_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Key<Self>, R::Error>

Available on crate feature rand_core only.

Generate random key using the provided TryCryptoRng.

Source

fn generate_iv() -> Result<Iv<Self>, OsError>

Available on crate feature os_rng only.

Generate random IV using the operating system’s secure RNG.

Source

fn generate_iv_with_rng<R: CryptoRng + ?Sized>(rng: &mut R) -> Iv<Self>

Available on crate feature rand_core only.

Generate random IV using the provided CryptoRng.

Source

fn try_generate_iv_with_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Iv<Self>, R::Error>

Available on crate feature rand_core only.

Generate random IV using the provided TryCryptoRng.

Source

fn generate_key_iv() -> Result<(Key<Self>, Iv<Self>), OsError>

Available on crate feature os_rng only.

Generate random key and IV using the operating system’s secure RNG.

Source

fn generate_key_iv_with_rng<R: CryptoRng + ?Sized>( rng: &mut R, ) -> (Key<Self>, Iv<Self>)

Available on crate feature rand_core only.

Generate random key and IV using the provided CryptoRng.

Source

fn try_generate_key_iv_with_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<(Key<Self>, Iv<Self>), R::Error>

Available on crate feature rand_core only.

Generate random key and IV using the provided TryCryptoRng.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> KeyIvInit for T
where T: InnerIvInit, T::Inner: KeyInit,