Botan 1.10.17
Botan::KDF1 Class Reference

#include <kdf1.h>

Inheritance diagram for Botan::KDF1:
Botan::KDF Botan::Algorithm

Public Member Functions

void clear ()
KDFclone () const
SecureVector< bytederive (size_t, const byte secret[], size_t secret_len, const byte P[], size_t P_len) const
SecureVector< bytederive_key (size_t key_len, const byte secret[], size_t secret_len, const byte salt[], size_t salt_len) const
SecureVector< bytederive_key (size_t key_len, const byte secret[], size_t secret_len, const std::string &salt="") const
SecureVector< bytederive_key (size_t key_len, const MemoryRegion< byte > &secret, const byte salt[], size_t salt_len) const
SecureVector< bytederive_key (size_t key_len, const MemoryRegion< byte > &secret, const MemoryRegion< byte > &salt) const
SecureVector< bytederive_key (size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
 KDF1 (const KDF1 &other)
 KDF1 (HashFunction *h)
std::string name () const
 ~KDF1 ()

Detailed Description

KDF1, from IEEE 1363

Definition at line 19 of file kdf1.h.

Constructor & Destructor Documentation

◆ KDF1() [1/2]

Botan::KDF1::KDF1 ( HashFunction * h)
inline

Definition at line 29 of file kdf1.h.

29: hash(h) {}

Referenced by clone(), Botan::get_kdf(), and KDF1().

◆ KDF1() [2/2]

Botan::KDF1::KDF1 ( const KDF1 & other)
inline

Definition at line 30 of file kdf1.h.

30: KDF(), hash(other.hash->clone()) {}

References clone(), and KDF1().

◆ ~KDF1()

Botan::KDF1::~KDF1 ( )
inline

Definition at line 32 of file kdf1.h.

32{ delete hash; }

Member Function Documentation

◆ clear()

void Botan::KDF::clear ( )
inlinevirtualinherited

Zeroize internal state

Implements Botan::Algorithm.

Definition at line 81 of file kdf.h.

81{}

◆ clone()

KDF * Botan::KDF1::clone ( ) const
inlinevirtual

Implements Botan::KDF.

Definition at line 27 of file kdf1.h.

27{ return new KDF1(hash->clone()); }
KDF1(HashFunction *h)
Definition kdf1.h:29

References KDF1().

Referenced by KDF1().

◆ derive()

SecureVector< byte > Botan::KDF1::derive ( size_t ,
const byte secret[],
size_t secret_len,
const byte P[],
size_t P_len ) const
virtual

Implements Botan::KDF.

Definition at line 15 of file kdf1.cpp.

18 {
19 hash->update(secret, secret_len);
20 hash->update(P, P_len);
21 return hash->final();
22 }

◆ derive_key() [1/5]

SecureVector< byte > Botan::KDF::derive_key ( size_t key_len,
const byte secret[],
size_t secret_len,
const byte salt[],
size_t salt_len ) const
inherited

Derive a key

Parameters
key_lenthe desired output length in bytes
secretthe secret input
secret_lensize of secret in bytes
salta diversifier
salt_lensize of salt in bytes

Definition at line 61 of file kdf.cpp.

64 {
65 return derive(key_len, secret, secret_len, salt, salt_len);
66 }

◆ derive_key() [2/5]

SecureVector< byte > Botan::KDF::derive_key ( size_t key_len,
const byte secret[],
size_t secret_len,
const std::string & salt = "" ) const
inherited

Derive a key

Parameters
key_lenthe desired output length in bytes
secretthe secret input
secret_lensize of secret in bytes
salta diversifier

Definition at line 49 of file kdf.cpp.

52 {
53 return derive_key(key_len, secret, secret_len,
54 reinterpret_cast<const byte*>(salt.data()),
55 salt.length());
56 }
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
Definition kdf.cpp:15

References derive_key().

◆ derive_key() [3/5]

SecureVector< byte > Botan::KDF::derive_key ( size_t key_len,
const MemoryRegion< byte > & secret,
const byte salt[],
size_t salt_len ) const
inherited

Derive a key

Parameters
key_lenthe desired output length in bytes
secretthe secret input
salta diversifier
salt_lensize of salt in bytes

Definition at line 27 of file kdf.cpp.

30 {
31 return derive_key(key_len, &secret[0], secret.size(),
32 salt, salt_len);
33 }

References derive_key(), and Botan::MemoryRegion< T >::size().

◆ derive_key() [4/5]

SecureVector< byte > Botan::KDF::derive_key ( size_t key_len,
const MemoryRegion< byte > & secret,
const MemoryRegion< byte > & salt ) const
inherited

Derive a key

Parameters
key_lenthe desired output length in bytes
secretthe secret input
salta diversifier

Definition at line 38 of file kdf.cpp.

41 {
42 return derive_key(key_len, &secret[0], secret.size(),
43 &salt[0], salt.size());
44 }

References derive_key(), and Botan::MemoryRegion< T >::size().

◆ derive_key() [5/5]

SecureVector< byte > Botan::KDF::derive_key ( size_t key_len,
const MemoryRegion< byte > & secret,
const std::string & salt = "" ) const
inherited

Derive a key

Parameters
key_lenthe desired output length in bytes
secretthe secret input
salta diversifier

Definition at line 15 of file kdf.cpp.

18 {
19 return derive_key(key_len, &secret[0], secret.size(),
20 reinterpret_cast<const byte*>(salt.data()),
21 salt.length());
22 }

References derive_key(), and Botan::MemoryRegion< T >::size().

Referenced by derive_key(), derive_key(), derive_key(), and derive_key().

◆ name()

std::string Botan::KDF1::name ( ) const
inlinevirtual
Returns
name of this algorithm

Implements Botan::Algorithm.

Definition at line 26 of file kdf1.h.

26{ return "KDF1(" + hash->name() + ")"; }

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