pub trait HkdfExpander: Send + Sync {
// Required methods
fn expand_slice(
&self,
info: &[&[u8]],
output: &mut [u8],
) -> Result<(), OutputLengthError>;
fn expand_block(&self, info: &[&[u8]]) -> OkmBlock;
fn hash_len(&self) -> usize;
}
Expand description
Implementation of HKDF-Expand
with an implicitly stored and immutable PRK
.
Required Methods§
sourcefn expand_slice(
&self,
info: &[&[u8]],
output: &mut [u8],
) -> Result<(), OutputLengthError>
fn expand_slice( &self, info: &[&[u8]], output: &mut [u8], ) -> Result<(), OutputLengthError>
HKDF-Expand(PRK, info, L)
into a slice.
Where:
PRK
is the implicit key material represented by this instance.L
isoutput.len()
.info
is a slice of byte slices, which should be processed sequentially (or concatenated if that is not possible).
Returns Err(OutputLengthError)
if L
is larger than 255 * HashLen
.
Otherwise, writes to output
.
sourcefn expand_block(&self, info: &[&[u8]]) -> OkmBlock
fn expand_block(&self, info: &[&[u8]]) -> OkmBlock
HKDF-Expand(PRK, info, L=HashLen)
returned as a value.
PRK
is the implicit key material represented by this instance.L := HashLen
.info
is a slice of byte slices, which should be processed sequentially (or concatenated if that is not possible).
This is infallible, because by definition OkmBlock
is always exactly
HashLen
bytes long.
sourcefn hash_len(&self) -> usize
fn hash_len(&self) -> usize
Return what HashLen
is for this instance.
This must be no larger than OkmBlock::MAX_LEN
.