Crypto++ 8.9
Free C++ class library of cryptographic schemes
Public Member Functions | Static Public Member Functions | List of all members
PKCS5_PBKDF1< T > Class Template Reference

PBKDF1 from PKCS #5. More...

#include <pwdbased.h>

+ Inheritance diagram for PKCS5_PBKDF1< T >:

Public Member Functions

std::string AlgorithmName () const
 Provides the name of this algorithm.
 
size_t MaxDerivedKeyLength () const
 Determine maximum number of bytes.
 
size_t GetValidDerivedLength (size_t keylength) const
 Returns a valid key length for the derivation function.
 
virtual size_t DeriveKey (byte *derived, size_t derivedLen, const byte *secret, size_t secretLen, const NameValuePairs &params=g_nullNameValuePairs) const
 Derive a key from a seed.
 
size_t DeriveKey (byte *derived, size_t derivedLen, byte purpose, const byte *secret, size_t secretLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds=0) const
 Derive a key from a secret seed.
 
- Public Member Functions inherited from KeyDerivationFunction
virtual size_t MinDerivedKeyLength () const
 Determine minimum number of bytes.
 
virtual bool IsValidDerivedLength (size_t keylength) const
 Returns whether keylength is a valid key length.
 
virtual void SetParameters (const NameValuePairs &params)
 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 ClonableClone () const
 Copies this object.
 

Static Public Member Functions

static std::string StaticAlgorithmName ()
 

Detailed Description

template<class T>
class PKCS5_PBKDF1< T >

PBKDF1 from PKCS #5.

Template Parameters
Ta HashTransformation class
See also
PasswordBasedKeyDerivationFunction, PKCS5_PBKDF1 on the Crypto++ wiki
Since
Crypto++ 2.0

Definition at line 29 of file pwdbased.h.

Constructor & Destructor Documentation

◆ ~PKCS5_PBKDF1()

template<class T >
virtual PKCS5_PBKDF1< T >::~PKCS5_PBKDF1 ( )
inlinevirtual

Definition at line 32 of file pwdbased.h.

Member Function Documentation

◆ StaticAlgorithmName()

template<class T >
static std::string PKCS5_PBKDF1< T >::StaticAlgorithmName ( )
inlinestatic

Definition at line 34 of file pwdbased.h.

◆ AlgorithmName()

template<class T >
std::string PKCS5_PBKDF1< T >::AlgorithmName ( ) const
inlinevirtual

Provides the name of this algorithm.

Returns
the standard algorithm name

Implements KeyDerivationFunction.

Definition at line 41 of file pwdbased.h.

◆ MaxDerivedKeyLength()

template<class T >
size_t PKCS5_PBKDF1< T >::MaxDerivedKeyLength ( ) const
inlinevirtual

Determine maximum number of bytes.

Returns
Maximum number of bytes which can be derived

Reimplemented from KeyDerivationFunction.

Definition at line 46 of file pwdbased.h.

◆ GetValidDerivedLength()

template<class T >
size_t PKCS5_PBKDF1< T >::GetValidDerivedLength ( size_t keylength) const
virtual

Returns a valid key length for the derivation function.

Parameters
keylengththe size of the derived key, in bytes
Returns
the valid key length, in bytes

Implements KeyDerivationFunction.

Definition at line 87 of file pwdbased.h.

◆ DeriveKey() [1/2]

template<class T >
size_t PKCS5_PBKDF1< T >::DeriveKey ( byte * derived,
size_t derivedLen,
const byte * secret,
size_t secretLen,
const NameValuePairs & params = g_nullNameValuePairs ) const
virtual

Derive a key from a seed.

Parameters
derivedthe derived output buffer
derivedLenthe size of the derived buffer, in bytes
secretthe seed input buffer
secretLenthe size of the secret buffer, in bytes
paramsadditional initialization parameters to configure this object
Returns
the number of iterations performed
Exceptions
InvalidDerivedKeyLengthif 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.

Implements KeyDerivationFunction.

Definition at line 95 of file pwdbased.h.

◆ DeriveKey() [2/2]

template<class T >
size_t PKCS5_PBKDF1< T >::DeriveKey ( byte * derived,
size_t derivedLen,
byte purpose,
const byte * secret,
size_t secretLen,
const byte * salt,
size_t saltLen,
unsigned int iterations,
double timeInSeconds = 0 ) const

Derive a key from a secret seed.

Parameters
derivedthe derived output buffer
derivedLenthe size of the derived buffer, in bytes
purposea purpose byte
secretthe seed input buffer
secretLenthe size of the secret buffer, in bytes
saltthe salt input buffer
saltLenthe size of the salt buffer, in bytes
iterationsthe number of iterations
timeInSecondsthe in seconds
Returns
the number of iterations performed
Exceptions
InvalidDerivedKeyLengthif derivedLen is invalid for the scheme

DeriveKey() provides a standard interface to derive a key from a seed and other parameters. Each class that derives from KeyDerivationFunction provides an overload that accepts most parameters used by the derivation function.

If timeInSeconds is > 0.0 then DeriveKey will run for the specified amount of time. If timeInSeconds is 0.0 then DeriveKey will run for the specified number of iterations.

PKCS #5 says PBKDF1 should only take 8-byte salts. This implementation allows salts of any length.

Definition at line 115 of file pwdbased.h.


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