8 #ifndef BOTAN_TLS_SESSION_STATE_H__
9 #define BOTAN_TLS_SESSION_STATE_H__
11 #include <botan/x509cert.h>
12 #include <botan/tls_version.h>
13 #include <botan/tls_ciphersuite.h>
14 #include <botan/tls_magic.h>
15 #include <botan/tls_server_info.h>
16 #include <botan/secmem.h>
17 #include <botan/symkey.h>
35 m_start_time(
std::chrono::system_clock::time_point::
min()),
38 m_compression_method(0),
41 m_extended_master_secret(false),
42 m_encrypt_then_mac(false)
48 Session(
const std::vector<uint8_t>& session_id,
52 uint8_t compression_method,
54 bool supports_extended_master_secret,
55 bool supports_encrypt_then_mac,
56 const std::vector<X509_Certificate>& peer_certs,
57 const std::vector<uint8_t>& session_ticket,
59 const std::string& srp_identifier,
60 uint16_t srtp_profile);
67 Session(
const uint8_t ber[],
size_t ber_len);
73 explicit Session(
const std::string& pem);
156 const std::vector<uint8_t>&
session_id()
const {
return m_identifier; }
170 const std::vector<X509_Certificate>&
peer_certs()
const {
return m_peer_certs; }
175 std::chrono::system_clock::time_point
start_time()
const {
return m_start_time; }
180 std::chrono::seconds session_age()
const;
193 enum { TLS_SESSION_PARAM_STRUCT_VERSION = 20160812};
195 std::chrono::system_clock::time_point m_start_time;
197 std::vector<uint8_t> m_identifier;
198 std::vector<uint8_t> m_session_ticket;
201 Protocol_Version m_version;
202 uint16_t m_ciphersuite;
203 uint8_t m_compression_method;
205 uint16_t m_srtp_profile;
206 bool m_extended_master_secret;
207 bool m_encrypt_then_mac;
209 std::vector<X509_Certificate> m_peer_certs;
210 Server_Information m_server_info;
211 std::string m_srp_identifier;
static Session decrypt(const uint8_t ctext[], size_t ctext_size, const SymmetricKey &key)
std::chrono::system_clock::time_point start_time() const
uint16_t ciphersuite_code() const
bool supports_extended_master_secret() const
uint8_t compression_method() const
Ciphersuite ciphersuite() const
const secure_vector< uint8_t > & master_secret() const
uint16_t dtls_srtp_profile() const
Connection_Side side() const
const Server_Information & server_info() const
std::string PEM_encode(const Private_Key &key)
const std::vector< uint8_t > & session_ticket() const
Protocol_Version version() const
const std::vector< uint8_t > & session_id() const
std::string encrypt(const uint8_t input[], size_t input_len, const std::string &passphrase, RandomNumberGenerator &rng)
std::vector< T, secure_allocator< T >> secure_vector
const std::vector< X509_Certificate > & peer_certs() const
std::string decrypt(const uint8_t input[], size_t input_len, const std::string &passphrase)
static Ciphersuite by_id(uint16_t suite)
const std::string & srp_identifier() const
static Session decrypt(const std::vector< uint8_t > &ctext, const SymmetricKey &key)
bool supports_encrypt_then_mac() const