Skip to content

Commit

Permalink
Add hkdf::Prk::expand_to_secret()
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Aug 23, 2019
1 parent 63c0364 commit 5212a82
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/hkdf.rs
Expand Up @@ -136,6 +136,15 @@ impl Prk {
len_cached,
})
}

/// Expand the `Prk` directly to target secret type
pub fn expand_to_secret<L, K>(&self, info: &[&[u8]], len: L) -> Result<K, error::Unspecified>
where
L: KeyType,
K: for<'a> From<Okm<'a, L>>,
{
Ok(self.expand(info, len)?.into())
}
}

impl From<Okm<'_, Algorithm>> for Prk {
Expand Down

0 comments on commit 5212a82

Please sign in to comment.