Botan: Botan::KDF Class Reference

Botan 1.10.17

Public Member Functions | List of all members
Botan::KDF Class Referenceabstract

`#include <kdf.h>`

Inheritance diagram for Botan::KDF:

## Public Member Functions
void | clear ()
virtual KDF * | clone () const =0
SecureVector< byte > | derive_key (size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
SecureVector< byte > | derive_key (size_t key_len, const MemoryRegion< byte > &secret, const MemoryRegion< byte > &salt) const
SecureVector< byte > | derive_key (size_t key_len, const MemoryRegion< byte > &secret, const byte salt[], size_t salt_len) const
SecureVector< byte > | derive_key (size_t key_len, const byte secret[], size_t secret_len, const std::string &salt="") const
SecureVector< byte > | derive_key (size_t key_len, const byte secret[], size_t secret_len, const byte salt[], size_t salt_len) const
virtual std::string | name () const =0

## Detailed Description

Key Derivation Function

Definition at line 20 of file kdf.h.

## Member Function Documentation

## ◆ clear()

void Botan::KDF::clear | ( |  | ) |
| inlinevirtual

Zeroize internal state

Implements Botan::Algorithm.

Definition at line 81 of file kdf.h.

81 {}

## ◆ clone()

virtual KDF* Botan::KDF::clone | ( |  | ) | const
| pure virtual

Implemented in Botan::TLS_12_PRF, Botan::TLS_PRF, Botan::KDF1, Botan::KDF2, Botan::SSL3_PRF, and Botan::X942_PRF.

## ◆ derive_key() [1/5]

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

Derive a key

Parameters

  key_len | the desired output length in bytes
  secret | the secret input
  salt | a diversifier

Definition at line 15 of file kdf.cpp.

References Botan::MemoryRegion< T >::size().

Referenced by derive_key(), and Botan::PK_Key_Agreement::derive_key().

18 {
19 return derive_key(key_len, &secret[0], secret.size(),
20 reinterpret_cast<const byte*>(salt.data()),
21 salt.length());
22 }
Botan::KDF::derive_key
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
Definition: kdf.cpp:15
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

## ◆ derive_key() [2/5]

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

Derive a key

Parameters

  key_len | the desired output length in bytes
  secret | the secret input
  salt | a diversifier

Definition at line 38 of file kdf.cpp.

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

41 {
42 return derive_key(key_len, &secret[0], secret.size(),
43 &salt[0], salt.size());
44 }
Botan::KDF::derive_key
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
Definition: kdf.cpp:15
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

## ◆ 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

Derive a key

Parameters

  key_len | the desired output length in bytes
  secret | the secret input
  salt | a diversifier
  salt_len | size of salt in bytes

Definition at line 27 of file kdf.cpp.

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

30 {
31 return derive_key(key_len, &secret[0], secret.size(),
32 salt, salt_len);
33 }
Botan::KDF::derive_key
SecureVector< byte > derive_key(size_t key_len, const MemoryRegion< byte > &secret, const std::string &salt="") const
Definition: kdf.cpp:15
Botan::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

## ◆ derive_key() [4/5]

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

Derive a key

Parameters

  key_len | the desired output length in bytes
  secret | the secret input
  secret_len | size of secret in bytes
  salt | a diversifier

Definition at line 49 of file kdf.cpp.

References derive_key().

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

## ◆ derive_key() [5/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

Derive a key

Parameters

  key_len | the desired output length in bytes
  secret | the secret input
  secret_len | size of secret in bytes
  salt | a diversifier
  salt_len | size 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 }

## ◆ name()

virtual std::string Botan::Algorithm::name | ( |  | ) | const
| pure virtualinherited

Returns
  name of this algorithm

Implemented in Botan::AES_256, Botan::AES_256_NI, Botan::AES_256_SSSE3, Botan::Camellia_256, Botan::GOST_28147_89, Botan::AES_192, Botan::AES_192_NI, Botan::TLS_12_PRF, Botan::AES_192_SSSE3, Botan::TripleDES, Botan::Camellia_192, Botan::SHA_256, Botan::Comb4P, Botan::SHA_512, Botan::MessageAuthenticationCode, Botan::Lion, Botan::PKCS5_PBKDF1, Botan::WiderWake_41_BE, Botan::Skein_512, Botan::Keccak_1600, Botan::CTR_BE, Botan::OFB, Botan::Salsa20, Botan::Cascade_Cipher, Botan::LubyRackoff, Botan::Turing, Botan::RC2, Botan::Blowfish, Botan::OpenPGP_S2K, Botan::AES_128, Botan::AES_128_NI, Botan::TLS_PRF, Botan::KDF1, Botan::AES_128_SSSE3, Botan::Camellia_128, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::DESX, Botan::IDEA, Botan::KASUMI, Botan::MARS, Botan::MISTY1, Botan::Noekeon, Botan::SAFER_SK, Botan::SEED, Botan::Serpent, Botan::Skipjack, Botan::Square, Botan::TEA, Botan::Twofish, Botan::XTEA, Botan::KDF2, Botan::ARC4, Botan::SSL3_PRF, Botan::X942_PRF, Botan::Parallel, Botan::HMAC, Botan::ANSI_X919_MAC, Botan::GOST_34_11, Botan::HAS_160, Botan::SHA_224, Botan::CBC_MAC, Botan::CMAC, Botan::SSL3_MAC, Botan::PKCS5_PBKDF2, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::BMW_512, Botan::MD2, Botan::MD4, Botan::MD5, Botan::RIPEMD_128, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, Botan::Tiger, and Botan::Whirlpool.

Referenced by Botan::Algorithm_Factory::add_block_cipher(), Botan::Algorithm_Factory::add_hash_function(), Botan::Algorithm_Factory::add_pbkdf(), Botan::Algorithm_Factory::add_stream_cipher(), Botan::CMAC::CMAC(), Botan::Comb4P::Comb4P(), Botan::EMSA2::EMSA2(), Botan::EMSA3::EMSA3(), Botan::HMAC::HMAC(), Botan::SSL3_MAC::name(), Botan::CBC_MAC::name(), Botan::CMAC::name(), Botan::HMAC::name(), Botan::PBE_PKCS5v15::name(), Botan::ECB_Encryption::name(), Botan::ANSI_X931_RNG::name(), Botan::CBC_Encryption::name(), Botan::Randpool::name(), Botan::PBE_PKCS5v20::name(), Botan::Cascade_Cipher::name(), Botan::LubyRackoff::name(), Botan::OFB::name(), Botan::CTR_BE::name(), Botan::Lion::name(), Botan::ECB_Decryption::name(), Botan::CBC_Decryption::name(), Botan::PBE_PKCS5v15::PBE_PKCS5v15(), Botan::PBE_PKCS5v20::PBE_PKCS5v20(), Botan::StreamCipher::set_iv(), and Botan::SSL3_MAC::SSL3_MAC().

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

- src/kdf/kdf.h
- src/kdf/kdf.cpp