encrypt_data_key

Function encrypt_data_key 

Source
pub fn encrypt_data_key(
    data_key: &[u8; 32],
    password_or_machine_id: &[u8],
    salt: &[u8; 16],
    nonce: &[u8; 12],
) -> Result<[u8; 48]>
Expand description

Encrypt a 32-byte data key for storage.

Used to encrypt the data_key with either machineID or secret.

§Arguments

  • data_key - 32-byte key to encrypt
  • password_or_machine_id - Password/secret or machine ID to derive encryption key from
  • salt - Salt for key derivation
  • nonce - Nonce for encryption

§Returns

48 bytes: encrypted key (32) + tag (16)