Arduino Cryptography Library
Public Member Functions | Protected Member Functions | List of all members
HKDFCommon Class Reference

Concrete base class to assist with implementing HKDF mode for hash algorithms. More...

#include <HKDF.h>

Inheritance diagram for HKDFCommon:
HKDF< T >

Public Member Functions

virtual ~HKDFCommon ()
 Destroys this HKDF instance.
 
void setKey (const void *key, size_t keyLen, const void *salt=0, size_t saltLen=0)
 Sets the key and salt for a HKDF session. More...
 
void extract (void *out, size_t outLen, const void *info=0, size_t infoLen=0)
 Extracts data from a HKDF session. More...
 
void clear ()
 Clears sensitive information from this HKDF instance.
 

Protected Member Functions

 HKDFCommon ()
 Constructs a new HKDF instance. More...
 
void setHashAlgorithm (Hash *hashAlg, uint8_t *buffer)
 Sets the hash algorithm to use for HKDF operations. More...
 

Detailed Description

Concrete base class to assist with implementing HKDF mode for hash algorithms.

Reference: https://datatracker.ietf.org/doc/html/rfc5869

See also
HKDF

Definition at line 29 of file HKDF.h.

Constructor & Destructor Documentation

◆ HKDFCommon()

HKDFCommon::HKDFCommon ( )
protected

Constructs a new HKDF instance.

This constructor must be followed by a call to setHashAlgorithm().

Definition at line 41 of file HKDF.cpp.

Member Function Documentation

◆ extract()

void HKDFCommon::extract ( void *  out,
size_t  outLen,
const void *  info = 0,
size_t  infoLen = 0 
)

Extracts data from a HKDF session.

Parameters
outPoints to the buffer to fill with extracted data.
outLenNumber of bytes to extract into the out buffer.
infoPoints to the application-specific information string.
infoLenLength of the info string in bytes.
Note
RFC 5869 specifies that a maximum of 255 * HashLen bytes should be extracted from a HKDF session. This maximum is not enforced by this function.

Definition at line 96 of file HKDF.cpp.

◆ setHashAlgorithm()

void HKDFCommon::setHashAlgorithm ( Hash hashAlg,
uint8_t *  buffer 
)
inlineprotected

Sets the hash algorithm to use for HKDF operations.

Parameters
hashAlgPoints to the hash algorithm instance to use.
bufferPoints to a buffer that must be at least twice the size of the hash output from hashAlg.

Definition at line 42 of file HKDF.h.

◆ setKey()

void HKDFCommon::setKey ( const void *  key,
size_t  keyLen,
const void *  salt = 0,
size_t  saltLen = 0 
)

Sets the key and salt for a HKDF session.

Parameters
keyPoints to the key.
keyLenLength of the key in bytes.
saltPoints to the salt.
saltLenLength of the salt in bytes.

Definition at line 64 of file HKDF.cpp.


The documentation for this class was generated from the following files: