KeyDerivationFunction

Trait KeyDerivationFunction 

Source
pub trait KeyDerivationFunction {
    // Required method
    fn derive_to(
        input_key_material: &[u8],
        salt: &[u8],
        info: &[u8],
        output: &mut [u8],
    ) -> Result<usize>;

    // Provided method
    fn derive(
        input_key_material: &[u8],
        salt: &[u8],
        info: &[u8],
        output_length: usize,
    ) -> Result<Vec<u8>> { ... }
}
Expand description

Generic trait for key derivation functions

Required Methods§

Source

fn derive_to( input_key_material: &[u8], salt: &[u8], info: &[u8], output: &mut [u8], ) -> Result<usize>

Derive key from input key material to the provided buffer (zero-allocation)

§Parameters
  • output: Buffer whose length determines the length of the derived key
§Returns

Number of bytes written (same as output.len())

Provided Methods§

Source

fn derive( input_key_material: &[u8], salt: &[u8], info: &[u8], output_length: usize, ) -> Result<Vec<u8>>

Derive key from input key material

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§