Botan  1.11.15
Public Types | Public Member Functions | Static Public Member Functions
Botan::TLS_12_PRF Class Reference

#include <prf_tls.h>

Inheritance diagram for Botan::TLS_12_PRF:
Botan::KDF

List of all members.

Public Types

typedef SCAN_Name Spec

Public Member Functions

KDFclone () const
secure_vector< bytederive_key (size_t key_len, const byte secret[], size_t secret_len, const byte salt[], size_t salt_len) const
secure_vector< bytederive_key (size_t key_len, const secure_vector< byte > &secret, const std::string &salt="") const
template<typename Alloc , typename Alloc2 >
secure_vector< bytederive_key (size_t key_len, const std::vector< byte, Alloc > &secret, const std::vector< byte, Alloc2 > &salt) const
secure_vector< bytederive_key (size_t key_len, const secure_vector< byte > &secret, const byte salt[], size_t salt_len) const
secure_vector< bytederive_key (size_t key_len, const byte secret[], size_t secret_len, const std::string &salt="") const
size_t kdf (byte key[], size_t key_len, const byte secret[], size_t secret_len, const byte salt[], size_t salt_len) const override
std::string name () const
 TLS_12_PRF (MessageAuthenticationCode *mac)

Static Public Member Functions

static TLS_12_PRFmake (const Spec &spec)

Detailed Description

PRF used in TLS 1.2

Definition at line 39 of file prf_tls.h.


Member Typedef Documentation

typedef SCAN_Name Botan::KDF::Spec [inherited]

Definition at line 119 of file kdf.h.


Constructor & Destructor Documentation

Definition at line 50 of file prf_tls.h.

Referenced by make().

: m_mac(mac) {}

Member Function Documentation

KDF* Botan::TLS_12_PRF::clone ( ) const [inline, virtual]

Implements Botan::KDF.

Definition at line 44 of file prf_tls.h.

{ return new TLS_12_PRF(m_mac->clone()); }
secure_vector<byte> Botan::KDF::derive_key ( size_t  key_len,
const byte  secret[],
size_t  secret_len,
const byte  salt[],
size_t  salt_len 
) const [inline, 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 41 of file kdf.h.

         {
         secure_vector<byte> key(key_len);
         key.resize(kdf(&key[0], key.size(), secret, secret_len, salt, salt_len));
         return key;
         }
secure_vector<byte> Botan::KDF::derive_key ( size_t  key_len,
const secure_vector< byte > &  secret,
const std::string &  salt = "" 
) const [inline, inherited]

Derive a key

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

Definition at line 58 of file kdf.h.

         {
         return derive_key(key_len, &secret[0], secret.size(),
                           reinterpret_cast<const byte*>(salt.data()),
                           salt.length());
         }
template<typename Alloc , typename Alloc2 >
secure_vector<byte> Botan::KDF::derive_key ( size_t  key_len,
const std::vector< byte, Alloc > &  secret,
const std::vector< byte, Alloc2 > &  salt 
) const [inline, inherited]

Derive a key

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

Definition at line 74 of file kdf.h.

         {
         return derive_key(key_len,
                           &secret[0], secret.size(),
                           &salt[0], salt.size());
         }
secure_vector<byte> Botan::KDF::derive_key ( size_t  key_len,
const secure_vector< byte > &  secret,
const byte  salt[],
size_t  salt_len 
) const [inline, 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 90 of file kdf.h.

         {
         return derive_key(key_len,
                           &secret[0], secret.size(),
                           salt, salt_len);
         }
secure_vector<byte> Botan::KDF::derive_key ( size_t  key_len,
const byte  secret[],
size_t  secret_len,
const std::string &  salt = "" 
) const [inline, 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 107 of file kdf.h.

         {
         return derive_key(key_len, secret, secret_len,
                           reinterpret_cast<const byte*>(salt.data()),
                           salt.length());
         }
size_t Botan::TLS_12_PRF::kdf ( byte  key[],
size_t  key_len,
const byte  secret[],
size_t  secret_len,
const byte  salt[],
size_t  salt_len 
) const [override, virtual]

Implements Botan::KDF.

Definition at line 88 of file prf_tls.cpp.

   {
   P_hash(key, key_len, *m_mac, secret, secret_len, salt, salt_len);
   return key_len;
   }
TLS_12_PRF * Botan::TLS_12_PRF::make ( const Spec spec) [static]

Definition at line 14 of file prf_tls.cpp.

References Botan::SCAN_Name::arg(), mac, and TLS_12_PRF().

   {
   if(auto mac = make_a<MessageAuthenticationCode>(spec.arg(0)))
      return new TLS_12_PRF(mac);
   if(auto hash = make_a<HashFunction>(spec.arg(0)))
      return new TLS_12_PRF(new HMAC(hash));
   return nullptr;
   }
std::string Botan::TLS_12_PRF::name ( ) const [inline, virtual]

Implements Botan::KDF.

Definition at line 42 of file prf_tls.h.

{ return "TLS-12-PRF(" + m_mac->name() + ")"; }

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