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