Function engine::snapshot::decrypt_content_with_work_factor

source ·
pub fn decrypt_content_with_work_factor<I: Read>(
    input: &mut I,
    key: &Key,
    max_work_factor: u8
) -> Result<Zeroizing<Vec<u8>>, ReadError>
Expand description

Decrypt snapshot content with key using custom maximum work factor.

Decryption may fail if the required amount of computation (work factor) exceeds the provided value. In this case a larger maximum work factor value can be used.

Strong keys are expected to use small/zero work factor. Small/zero maximum work factor can be used in such case.

§Security

Key derivation time grows exponentially with work factor. Maximum work factor should not be too large. Large values of maximum work factor when exploited by an attacker can cause Denial-of-Service.