pub struct HkdfBuilder<'a> { /* private fields */ }Expand description
HKDF key-derivation builder (RFC 5869).
ⓘ
let okm = HkdfBuilder::new(&sha256)
.key(ikm)
.salt(salt)
.info(info)
.derive_to_vec(32)?;Implementations§
Source§impl<'a> HkdfBuilder<'a>
impl<'a> HkdfBuilder<'a>
Sourcepub fn new(digest: &'a DigestAlg) -> Self
pub fn new(digest: &'a DigestAlg) -> Self
Create an HKDF builder bound to digest.
The mode defaults to ExtractAndExpand.
Sourcepub fn salt(self, salt: &'a [u8]) -> Self
pub fn salt(self, salt: &'a [u8]) -> Self
Set the salt (optional; defaults to zero-length within OpenSSL).
Sourcepub fn info(self, info: &'a [u8]) -> Self
pub fn info(self, info: &'a [u8]) -> Self
Set the context/application-specific information bytes.
Sourcepub fn derive(self, out: &mut [u8]) -> Result<(), ErrorStack>
pub fn derive(self, out: &mut [u8]) -> Result<(), ErrorStack>
Derive key material, writing into out.
§Errors
Sourcepub fn derive_to_vec(self, len: usize) -> Result<Vec<u8>, ErrorStack>
pub fn derive_to_vec(self, len: usize) -> Result<Vec<u8>, ErrorStack>
Derive len bytes of key material, returning them in a freshly allocated Vec<u8>.
§Errors
Auto Trait Implementations§
impl<'a> Freeze for HkdfBuilder<'a>
impl<'a> RefUnwindSafe for HkdfBuilder<'a>
impl<'a> Send for HkdfBuilder<'a>
impl<'a> Sync for HkdfBuilder<'a>
impl<'a> Unpin for HkdfBuilder<'a>
impl<'a> UnsafeUnpin for HkdfBuilder<'a>
impl<'a> UnwindSafe for HkdfBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more