[−][src]Module ring::hkdf
HMAC-based Extract-and-Expand Key Derivation Function.
HKDF is specified in RFC 5869.
use ring::{aead, digest, error, hkdf}; fn derive_opening_key( key_algorithm: &'static aead::Algorithm, salt: [u8; 32], ikm: [u8; 32], info: &[u8], ) -> Result<aead::OpeningKey, error::Unspecified> { let salt = hkdf::Salt::new(&digest::SHA512, &salt); let prk = salt.extract(&ikm); let mut key_bytes = vec![0; key_algorithm.key_len()]; let out = prk.expand(info).fill(&mut key_bytes)?; aead::OpeningKey::new(key_algorithm, &key_bytes) }
Structs
Okm | An HKDF OKM (Output Keying Material) |
Prk | A HKDF PRK (pseudorandom key). |
Salt | A salt for HKDF operations. |
Functions
extract_and_expand | Deprecated Deprecated shortcut for
|