Botan: Botan::TLS_12_PRF Class Reference

Botan 1.10.17

Public Member Functions | List of all members
Botan::TLS_12_PRF Class Reference

`#include <prf_tls.h>`

Inheritance diagram for Botan::TLS_12_PRF:

## Public Member Functions
void | clear ()
KDF * | clone () const
SecureVector< byte > | derive (size_t key_len, const byte secret[], size_t secret_len, const byte seed[], size_t seed_len) const
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
std::string | name () const
| TLS_12_PRF (MessageAuthenticationCode *hmac)
| ~TLS_12_PRF ()

## Detailed Description

PRF used in TLS 1.2

Definition at line 40 of file prf_tls.h.

## Constructor & Destructor Documentation

## ◆ TLS_12_PRF()

Botan::TLS_12_PRF::TLS_12_PRF | ( | MessageAuthenticationCode * | hmac | ) |

Definition at line 88 of file prf_tls.cpp.

88 : hmac(mac)
89 {
90 }

## ◆ ~TLS_12_PRF()

Botan::TLS_12_PRF::~TLS_12_PRF | ( |  | ) |

Definition at line 92 of file prf_tls.cpp.

93 {
94 delete hmac;
95 }

## 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::TLS_12_PRF::clone | ( |  | ) | const
| inlinevirtual

Implements Botan::KDF.

Definition at line 48 of file prf_tls.h.

48 { return new TLS_12_PRF(hmac->clone()); }
Botan::TLS_12_PRF::TLS_12_PRF
TLS_12_PRF(MessageAuthenticationCode *hmac)
Definition: prf_tls.cpp:88
Botan::MessageAuthenticationCode::clone
virtual MessageAuthenticationCode * clone() const =0

## ◆ derive()

SecureVector< byte > Botan::TLS_12_PRF::derive | ( | size_t | key_len,
|  | const byte | secret[],
|  | size_t | secret_len,
|  | const byte | seed[],
|  | size_t | seed_len
| ) |  | const
| virtual

Implements Botan::KDF.

Definition at line 97 of file prf_tls.cpp.

100 {
101 SecureVector<byte> output(key_len);
102
103 P_hash(output, hmac, secret, secret_len, seed, seed_len);
104
105 return output;
106 }

## ◆ derive_key() [1/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_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 Botan::KDF::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
| inherited

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 Botan::KDF::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
| inherited

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 Botan::KDF::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
| inherited

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 Botan::KDF::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
| inherited

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()

std::string Botan::TLS_12_PRF::name | ( |  | ) | const
| inlinevirtual

Returns
  name of this algorithm

Implements Botan::Algorithm.

Definition at line 47 of file prf_tls.h.

47 { return "TLSv12-PRF(" + hmac->name() + ")"; }
Botan::MessageAuthenticationCode::name
virtual std::string name() const =0

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

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