Botan  1.10.9
prf_tls.h
Go to the documentation of this file.
1 /*
2 * TLS v1.0 and v1.2 PRFs
3 * (C) 2004-2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_TLS_PRF_H__
9 #define BOTAN_TLS_PRF_H__
10 
11 #include <botan/kdf.h>
12 #include <botan/mac.h>
13 #include <botan/hash.h>
14 
15 namespace Botan {
16 
17 /**
18 * PRF used in TLS 1.0/1.1
19 */
20 class BOTAN_DLL TLS_PRF : public KDF
21  {
22  public:
23  SecureVector<byte> derive(size_t key_len,
24  const byte secret[], size_t secret_len,
25  const byte seed[], size_t seed_len) const;
26 
27  std::string name() const { return "TLS-PRF"; }
28  KDF* clone() const { return new TLS_PRF; }
29 
30  TLS_PRF();
31  ~TLS_PRF();
32  private:
33  MessageAuthenticationCode* hmac_md5;
34  MessageAuthenticationCode* hmac_sha1;
35  };
36 
37 /**
38 * PRF used in TLS 1.2
39 */
40 class BOTAN_DLL TLS_12_PRF : public KDF
41  {
42  public:
43  SecureVector<byte> derive(size_t key_len,
44  const byte secret[], size_t secret_len,
45  const byte seed[], size_t seed_len) const;
46 
47  std::string name() const { return "TLSv12-PRF(" + hmac->name() + ")"; }
48  KDF* clone() const { return new TLS_12_PRF(hmac->clone()); }
49 
51  ~TLS_12_PRF();
52  private:
54  };
55 
56 }
57 
58 #endif
KDF * clone() const
Definition: prf_tls.h:48
std::string name() const
Definition: prf_tls.h:27
unsigned char byte
Definition: types.h:22
KDF * clone() const
Definition: prf_tls.h:28
Definition: kdf.h:20
std::string name() const
Definition: prf_tls.h:47