Trait rustls::crypto::tls13::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;
}
Expand description

Implementation of HKDF-Expand with an implicitly stored and immutable PRK.

Required Methods§

source

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 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 to output.

source

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.

source

fn hash_len(&self) -> usize

Return what HashLen is for this instance.

This must be no larger than OkmBlock::MAX_LEN.

Implementors§