Botan: Botan::SSL3_PRF Class Reference

Botan 1.10.12

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

`#include <prf_ssl3.h>`

Inheritance diagram for Botan::SSL3_PRF:

## Public Member Functions
void | clear ()
KDF * | clone () const
SecureVector< byte > | derive (size_t, const byte[], size_t, const byte[], size_t) 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

## Detailed Description

PRF used in SSLv3

Definition at line 18 of file prf_ssl3.h.

## Member Function Documentation

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

Zeroize internal state

Implements Botan::Algorithm.

Definition at line 81 of file kdf.h.

81 {}

KDF* Botan::SSL3_PRF::clone | ( |  | ) | const
| inlinevirtual

Implements Botan::KDF.

Definition at line 25 of file prf_ssl3.h.

25 { return new SSL3_PRF; }

SecureVector< byte > Botan::SSL3_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 50 of file prf_ssl3.cpp.

References Botan::OctetString::bits_of(), and Botan::MD5::output_length().

53 {
54 if(key_len > 416)
55 throw Invalid_Argument("SSL3_PRF: Requested key length is too large");
56
57 MD5 md5;
58 SHA_160 sha1;
59
60 OctetString output;
61
62 int counter = 0;
63 while(key_len)
64 {
65 const size_t produce = std::min<size_t>(key_len, md5.output_length());
66
67 output = output + next_hash(counter++, produce, md5, sha1,
68 secret, secret_len, seed, seed_len);
69
70 key_len -= produce;
71 }
72
73 return output.bits_of();
74 }
Botan::Invalid_Argument
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20

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(), Botan::SessionKeys::master_secret(), Botan::Finished::verify(), Botan::DLIES_Decryptor::~DLIES_Decryptor(), and Botan::DLIES_Encryptor::~DLIES_Encryptor().

18 {
19 return derive_key(key_len, &secret[0], secret.size(),
20 reinterpret_cast<const byte*>(salt.data()),
21 salt.length());
22 }
Botan::byte
unsigned char byte
Definition: types.h: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::MemoryRegion::size
size_t size() const
Definition: secmem.h:29

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

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

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

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 }

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

Returns
  name of this algorithm

Implements Botan::Algorithm.

Definition at line 24 of file prf_ssl3.h.

24 { return "SSL3-PRF"; }

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

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