Arduino Cryptography Library
|
Implementation of the HKDF mode for hash algorithms. More...
#include <HKDF.h>
Public Member Functions | |
HKDF () | |
Constructs a new HKDF object for the hash algorithm T. | |
~HKDF () | |
Destroys a HKDF instance and all sensitive data within it. | |
Public Member Functions inherited from HKDFCommon | |
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. | |
Additional Inherited Members | |
Protected Member Functions inherited from HKDFCommon | |
HKDFCommon () | |
Constructs a new HKDF instance. More... | |
void | setHashAlgorithm (Hash *hashAlg, uint8_t *buffer) |
Sets the hash algorithm to use for HKDF operations. More... | |
Implementation of the HKDF mode for hash algorithms.
HKDF expands a key to a larger amount of material that can be used for cryptographic operations. It is based around a hash algorithm.
The template parameter T must be a concrete subclass of Hash indicating the specific hash algorithm to use.
The following example expands a 32-byte / 256-bit key into 128 bytes / 1024 bits of key material for use in a cryptographic session:
Usually the key will be salted, which can be passed to the setKey() function:
It is also possible to acheive the same effect with a single function call using the hkdf() templated function: