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;
}展开描述
Implementation of HKDF-Expand with an implicitly stored 并 immutable PRK。
必需方法§
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 一个 slice.
其中:
PRKis the implicit key material represented by this instance.Lisoutput.len().infois 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 到 output。
Sourcefn expand_block(&self, info: &[&[u8]]) -> OkmBlock
fn expand_block(&self, info: &[&[u8]]) -> OkmBlock
HKDF-Expand(PRK, info, L=HashLen) returned as 一个 value.
PRKis the implicit key material represented by this instance.L := HashLen.infois a slice of byte slices, which should be processed sequentially (or concatenated if that is not possible).
这是不可能失败的,因为根据定义 OkmBlock 总是准确 HashLen 个字节长。
Sourcefn hash_len(&self) -> usize
fn hash_len(&self) -> usize
Return what HashLen is 用于 this instance.
This must be no larger than OkmBlock::MAX_LEN。