跳到主要内容

HkdfExpander

特性 HkdfExpander 

Source
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

必需方法§

Source

fn expand_slice( &self, info: &[&[u8]], output: &mut [u8], ) -> Result<(), OutputLengthError>

HKDF-Expand(PRK, info, L) into 一个 slice.

其中:

  • PRK is the implicit key material represented by this instance.
  • L is output.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 到 output

Source

fn expand_block(&self, info: &[&[u8]]) -> OkmBlock

HKDF-Expand(PRK, info, L=HashLen) returned as 一个 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).

这是不可能失败的,因为根据定义 OkmBlock 总是准确 HashLen 个字节长。

Source

fn hash_len(&self) -> usize

Return what HashLen is 用于 this instance.

This must be no larger than OkmBlock::MAX_LEN

实现者§