Skip to main content

derive

Function derive 

Source
pub fn derive(
    a: &Admitted,
    secret: &[u8],
    spec: &Spec<'_>,
    len: usize,
) -> Result<DerivedKey, CryptoError>
Expand description

Derives len bytes from secret as spec says. Refuses, in this order: Spec::Dhkem, which needs the keys only ecdh’s agree has, and a spec whose algorithm is not of its kind (CryptoError::KdfSpecMismatch); an algorithm a’s profile does not admit, or its module line lacks (Admitted::admit_kdf); an empty info or fixed_info unless kdf_info_may_be_empty; an output outside 1..=algorithm.max_output_len() bytes; an empty secret.