Botan 3.0.0-alpha0
Crypto and TLS for C&
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/secmem.h>
12#include <botan/tls_magic.h>
13
14namespace Botan {
15
16namespace TLS {
17
18class Handshake_State;
19
20/**
21* TLS Session Keys
22*/
24 {
25 public:
26 /**
27 * @return client AEAD key
28 */
29 const secure_vector<uint8_t>& client_aead_key() const { return m_c_aead; }
30
31 /**
32 * @return server AEAD key
33 */
34 const secure_vector<uint8_t>& server_aead_key() const { return m_s_aead; }
35
36 /**
37 * @return client nonce
38 */
39 const std::vector<uint8_t>& client_nonce() const { return m_c_nonce; }
40
41 /**
42 * @return server nonce
43 */
44 const std::vector<uint8_t>& server_nonce() const { return m_s_nonce; }
45
46 /**
47 * @return TLS master secret
48 */
49 const secure_vector<uint8_t>& master_secret() const { return m_master_sec; }
50
52 {
54 }
55
56 const std::vector<uint8_t>& nonce(Connection_Side side) const
57 {
58 return (side == Connection_Side::CLIENT) ? client_nonce() : server_nonce();
59 }
60
61 Session_Keys() = default;
62
63 /**
64 * @param state state the handshake state
65 * @param pre_master_secret the pre-master secret
66 * @param resuming whether this TLS session is resumed
67 */
68 Session_Keys(const Handshake_State* state,
69 const secure_vector<uint8_t>& pre_master_secret,
70 bool resuming);
71
72 private:
73 secure_vector<uint8_t> m_master_sec;
74 secure_vector<uint8_t> m_c_aead, m_s_aead;
75 std::vector<uint8_t> m_c_nonce, m_s_nonce;
76 };
77
78}
79
80}
81
82#endif
const secure_vector< uint8_t > & server_aead_key() const
const std::vector< uint8_t > & server_nonce() const
const std::vector< uint8_t > & client_nonce() const
const std::vector< uint8_t > & nonce(Connection_Side side) const
const secure_vector< uint8_t > & aead_key(Connection_Side side) const
const secure_vector< uint8_t > & client_aead_key() const
const secure_vector< uint8_t > & master_secret() const
int(* final)(unsigned char *, CTX *)
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65