Botan 3.1.1
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 public:
25 /**
26 * @return client AEAD key
27 */
28 const secure_vector<uint8_t>& client_aead_key() const { return m_c_aead; }
29
30 /**
31 * @return server AEAD key
32 */
33 const secure_vector<uint8_t>& server_aead_key() const { return m_s_aead; }
34
35 /**
36 * @return client nonce
37 */
38 const std::vector<uint8_t>& client_nonce() const { return m_c_nonce; }
39
40 /**
41 * @return server nonce
42 */
43 const std::vector<uint8_t>& server_nonce() const { return m_s_nonce; }
44
45 /**
46 * @return TLS master secret
47 */
48 const secure_vector<uint8_t>& master_secret() const { return m_master_sec; }
49
52 }
53
54 const std::vector<uint8_t>& nonce(Connection_Side side) const {
55 return (side == Connection_Side::Client) ? client_nonce() : server_nonce();
56 }
57
58 Session_Keys() = default;
59
60 /**
61 * @param state state the handshake state
62 * @param pre_master_secret the pre-master secret
63 * @param resuming whether this TLS session is resumed
64 */
65 Session_Keys(const Handshake_State* state, const secure_vector<uint8_t>& pre_master_secret, bool resuming);
66
67 private:
68 secure_vector<uint8_t> m_master_sec;
69 secure_vector<uint8_t> m_c_aead, m_s_aead;
70 std::vector<uint8_t> m_c_nonce, m_s_nonce;
71};
72
73} // namespace TLS
74
75} // namespace Botan
76
77#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:61