Trait t_rust_less_lib::secrets_store::cipher::KeyDerivation[][src]

pub trait KeyDerivation: Send + Sync {
    fn key_derivation_type(&self) -> KeyDerivationType;
fn default_preset(&self) -> u8;
fn min_nonce_len(&self) -> usize;
fn derive(
        &self,
        passphrase: &SecretBytes,
        preset: u8,
        nonce: &[u8],
        key_length: usize
    ) -> SecretStoreResult<SecretBytes>; }
Expand description

Common interface for a key-derivation method.

An implmentation of KeyDerivation is used to derive the seal-key of a Cipher.

Each method may have multiple presets for internal parameters that have to be adjusted to common CPU power and use-case. Each preset is identified by a simple number.

Required methods

Get the key derivation type of the implmenetation.

Get the default preset to use (for new keys).

Get the minmal length of a nonce for key-derivation.

Derive a seal-key from a passphrase.

  • passphrase provided by the user
  • preset key-derivation preset to use
  • nonce random nonce to use, ensured to have at least min_nonce_len bytes
  • key_length the required key-length of the seal-key. The output must have exactly this length.

Implementors