Crypto++ 8.9
Free C++ class library of cryptographic schemes
|
Interface for key derivation functions. More...
#include <cryptlib.h>
Public Member Functions | |
virtual std::string | AlgorithmName () const =0 |
Provides the name of this algorithm. | |
virtual size_t | MinDerivedKeyLength () const |
Determine minimum number of bytes. | |
virtual size_t | MaxDerivedKeyLength () const |
Determine maximum number of bytes. | |
virtual size_t | GetValidDerivedLength (size_t keylength) const =0 |
Returns a valid key length for the derivation function. | |
virtual bool | IsValidDerivedLength (size_t keylength) const |
Returns whether keylength is a valid key length. | |
virtual size_t | DeriveKey (byte *derived, size_t derivedLen, const byte *secret, size_t secretLen, const NameValuePairs ¶ms=g_nullNameValuePairs) const =0 |
Derive a key from a seed. | |
virtual void | SetParameters (const NameValuePairs ¶ms) |
Set or change parameters. | |
Public Member Functions inherited from Algorithm | |
Algorithm (bool checkSelfTestStatus=true) | |
Interface for all crypto algorithms. | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. | |
Public Member Functions inherited from Clonable | |
virtual Clonable * | Clone () const |
Copies this object. | |
Interface for key derivation functions.
Definition at line 1527 of file cryptlib.h.
|
inlinevirtual |
Definition at line 1530 of file cryptlib.h.
|
pure virtual |
Provides the name of this algorithm.
Reimplemented from Algorithm.
Implemented in HKDF< T >, PKCS5_PBKDF1< T >, PKCS5_PBKDF2_HMAC< T >, PKCS12_PBKDF< T >, and Scrypt.
|
virtual |
Determine minimum number of bytes.
|
virtual |
Determine maximum number of bytes.
Reimplemented in HKDF< T >, PKCS5_PBKDF1< T >, PKCS5_PBKDF2_HMAC< T >, PKCS12_PBKDF< T >, and Scrypt.
|
pure virtual |
Returns a valid key length for the derivation function.
keylength | the size of the derived key, in bytes |
Implemented in HKDF< T >, PKCS5_PBKDF1< T >, PKCS5_PBKDF2_HMAC< T >, PKCS12_PBKDF< T >, and Scrypt.
|
inlinevirtual |
Returns whether keylength is a valid key length.
keylength | the requested keylength |
Internally the function calls GetValidKeyLength()
Definition at line 1553 of file cryptlib.h.
|
pure virtual |
Derive a key from a seed.
derived | the derived output buffer |
derivedLen | the size of the derived buffer, in bytes |
secret | the seed input buffer |
secretLen | the size of the secret buffer, in bytes |
params | additional initialization parameters to configure this object |
InvalidDerivedKeyLength | if derivedLen is invalid for the scheme |
DeriveKey() provides a standard interface to derive a key from a secret seed and other parameters. Each class that derives from KeyDerivationFunction provides an overload that accepts most parameters used by the derivation function.
the number of iterations performed by DeriveKey() may be 1. For example, a scheme like HKDF does not use the iteration count so it returns 1.
Implemented in HKDF< T >, Scrypt, PKCS5_PBKDF1< T >, PKCS5_PBKDF2_HMAC< T >, and PKCS12_PBKDF< T >.
|
virtual |
Set or change parameters.
params | additional initialization parameters to configure this object |
SetParameters() is useful for setting common parameters when an object is reused. Some derivation function classes may choose to implement it.