Botan  2.4.0
Crypto and TLS for C++11
tls_session_key.h
Go to the documentation of this file.
1 /*
2 * TLS Session Key
3 * (C) 2004-2006,2011 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_TLS_SESSION_KEYS_H_
9 #define BOTAN_TLS_SESSION_KEYS_H_
10 
11 #include <botan/symkey.h>
12 
13 namespace Botan {
14 
15 namespace TLS {
16 
17 class Handshake_State;
18 
19 /**
20 * TLS Session Keys
21 */
22 class Session_Keys final
23  {
24  public:
25  /**
26  * @return client encipherment key
27  */
28  const SymmetricKey& client_cipher_key() const { return m_c_cipher; }
29 
30  /**
31  * @return client encipherment key
32  */
33  const SymmetricKey& server_cipher_key() const { return m_s_cipher; }
34 
35  /**
36  * @return client MAC key
37  */
38  const SymmetricKey& client_mac_key() const { return m_c_mac; }
39 
40  /**
41  * @return server MAC key
42  */
43  const SymmetricKey& server_mac_key() const { return m_s_mac; }
44 
45  /**
46  * @return client IV
47  */
48  const InitializationVector& client_iv() const { return m_c_iv; }
49 
50  /**
51  * @return server IV
52  */
53  const InitializationVector& server_iv() const { return m_s_iv; }
54 
55  /**
56  * @return TLS master secret
57  */
58  const secure_vector<uint8_t>& master_secret() const { return m_master_sec; }
59 
60  Session_Keys() = default;
61 
62  /**
63  * @param state state the handshake state
64  * @param pre_master_secret the pre-master secret
65  * @param resuming whether this TLS session is resumed
66  */
67  Session_Keys(const Handshake_State* state,
68  const secure_vector<uint8_t>& pre_master_secret,
69  bool resuming);
70 
71  private:
72  secure_vector<uint8_t> m_master_sec;
73  SymmetricKey m_c_cipher, m_s_cipher, m_c_mac, m_s_mac;
74  InitializationVector m_c_iv, m_s_iv;
75  };
76 
77 }
78 
79 }
80 
81 #endif
const SymmetricKey & server_cipher_key() const
const SymmetricKey & server_mac_key() const
const secure_vector< uint8_t > & master_secret() const
Definition: alg_id.cpp:13
const SymmetricKey & client_mac_key() const
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88
const SymmetricKey & client_cipher_key() const
const InitializationVector & client_iv() const
const InitializationVector & server_iv() const