Botan 3.9.0
Crypto and TLS for C&
Botan::TLS::Session_Base Class Reference

#include <tls_session.h>

Inheritance diagram for Botan::TLS::Session_Base:
Botan::TLS::Session Botan::TLS::Session_Summary

Public Member Functions

Ciphersuite ciphersuite () const
uint16_t ciphersuite_code () const
uint16_t dtls_srtp_profile () const
const std::vector< X509_Certificate > & peer_certs () const
std::shared_ptr< const Public_Keypeer_raw_public_key () const
const Server_Informationserver_info () const
 Session_Base (std::chrono::system_clock::time_point start_time, Protocol_Version version, uint16_t ciphersuite, Connection_Side connection_side, uint16_t srtp_profile, bool extended_master_secret, bool encrypt_then_mac, std::vector< X509_Certificate > peer_certs, std::shared_ptr< const Public_Key > peer_raw_public_key, Server_Information server_info)
Connection_Side side () const
std::chrono::system_clock::time_point start_time () const
bool supports_encrypt_then_mac () const
bool supports_extended_master_secret () const
Protocol_Version version () const

Protected Member Functions

 Session_Base ()=default

Protected Attributes

uint16_t m_ciphersuite = 0
Connection_Side m_connection_side {}
bool m_encrypt_then_mac = false
bool m_extended_master_secret = false
std::vector< X509_Certificatem_peer_certs
std::shared_ptr< const Public_Keym_peer_raw_public_key
Server_Information m_server_info
uint16_t m_srtp_profile = 0
std::chrono::system_clock::time_point m_start_time
Protocol_Version m_version

Detailed Description

Represents basic information about a session that can be both persisted for resumption and presented to the application as a summary of a specific just-established TLS session.

Definition at line 140 of file tls_session.h.

Constructor & Destructor Documentation

◆ Session_Base() [1/2]

Botan::TLS::Session_Base::Session_Base ( std::chrono::system_clock::time_point start_time,
Protocol_Version version,
uint16_t ciphersuite,
Connection_Side connection_side,
uint16_t srtp_profile,
bool extended_master_secret,
bool encrypt_then_mac,
std::vector< X509_Certificate > peer_certs,
std::shared_ptr< const Public_Key > peer_raw_public_key,
Server_Information server_info )
inline

Definition at line 142 of file tls_session.h.

151 :
155 m_connection_side(connection_side),
156 m_srtp_profile(srtp_profile),
157 m_extended_master_secret(extended_master_secret),
158 m_encrypt_then_mac(encrypt_then_mac),
159 m_peer_certs(std::move(peer_certs)),
161 m_server_info(std::move(server_info)) {}
std::vector< X509_Certificate > m_peer_certs
std::shared_ptr< const Public_Key > peer_raw_public_key() const
Protocol_Version version() const
Protocol_Version m_version
std::chrono::system_clock::time_point m_start_time
Server_Information m_server_info
std::chrono::system_clock::time_point start_time() const
Ciphersuite ciphersuite() const
const std::vector< X509_Certificate > & peer_certs() const
const Server_Information & server_info() const
std::shared_ptr< const Public_Key > m_peer_raw_public_key
Connection_Side m_connection_side

References ciphersuite(), m_ciphersuite, m_connection_side, m_encrypt_then_mac, m_extended_master_secret, m_peer_certs, m_peer_raw_public_key, m_server_info, m_srtp_profile, m_start_time, m_version, peer_certs(), peer_raw_public_key(), server_info(), start_time(), and version().

Referenced by Botan::TLS::Session_Summary::Client_Impl_13, Botan::TLS::Session::Session(), Botan::TLS::Session::Session(), and Botan::TLS::Session::Session().

◆ Session_Base() [2/2]

Botan::TLS::Session_Base::Session_Base ( )
protecteddefault

Member Function Documentation

◆ ciphersuite()

Ciphersuite Botan::TLS::Session_Base::ciphersuite ( ) const

Get the ciphersuite info of the negotiated TLS session

Definition at line 86 of file tls_session.cpp.

86 {
88 if(!suite.has_value()) {
89 throw Decoding_Error("Failed to find cipher suite for ID " + std::to_string(m_ciphersuite));
90 }
91 return suite.value();
92}
static std::optional< Ciphersuite > by_id(uint16_t suite)

References Botan::TLS::Ciphersuite::by_id(), and m_ciphersuite.

Referenced by Botan::TLS::Session_Summary::cipher_algo(), Botan::TLS::Session_Summary::mac_algo(), Botan::TLS::Session_Summary::prf_algo(), Botan::TLS::Session::Session(), Botan::TLS::Session::Session(), Botan::TLS::Session::Session(), and Session_Base().

◆ ciphersuite_code()

uint16_t Botan::TLS::Session_Base::ciphersuite_code ( ) const
inline

Get the ciphersuite code of the negotiated TLS session

Definition at line 180 of file tls_session.h.

180{ return m_ciphersuite; }

References m_ciphersuite.

Referenced by Botan::TLS::Client_Hello_12::Client_Hello_12(), and Botan::TLS::Session::Session().

◆ dtls_srtp_profile()

uint16_t Botan::TLS::Session_Base::dtls_srtp_profile ( ) const
inline

Get the negotiated DTLS-SRTP algorithm (RFC 5764)

Definition at line 195 of file tls_session.h.

195{ return m_srtp_profile; }

References m_srtp_profile.

◆ peer_certs()

const std::vector< X509_Certificate > & Botan::TLS::Session_Base::peer_certs ( ) const
inline

Return the certificate chain of the peer (possibly empty)

Definition at line 212 of file tls_session.h.

212{ return m_peer_certs; }

References m_peer_certs.

Referenced by Botan::TLS::Session_Summary::Client_Impl_13, Botan::TLS::Session::Session(), Botan::TLS::Session::Session(), and Session_Base().

◆ peer_raw_public_key()

std::shared_ptr< const Public_Key > Botan::TLS::Session_Base::peer_raw_public_key ( ) const
inline

Return the raw public key of the peer (possibly empty)

Definition at line 217 of file tls_session.h.

217{ return m_peer_raw_public_key; }

References m_peer_raw_public_key.

Referenced by Botan::TLS::Session_Summary::Client_Impl_13, Botan::TLS::Session::Session(), Botan::TLS::Session::Session(), and Session_Base().

◆ server_info()

const Server_Information & Botan::TLS::Session_Base::server_info ( ) const
inline

Get information about the TLS server

Returns information that identifies the server side of the connection. This is useful for the client in that it identifies what was originally passed to the constructor. For the server, it includes the name the client specified in the server name indicator extension.

Definition at line 227 of file tls_session.h.

227{ return m_server_info; }

References m_server_info.

Referenced by Botan::TLS::Client_Hello_12::Client_Hello_12(), Botan::TLS::Session_Summary::Client_Impl_13, Botan::TLS::Session::Session(), Botan::TLS::Session::Session(), Session_Base(), and Botan::TLS::Session_Manager_SQL::store().

◆ side()

Connection_Side Botan::TLS::Session_Base::side ( ) const
inline

◆ start_time()

std::chrono::system_clock::time_point Botan::TLS::Session_Base::start_time ( ) const
inline

Get the wall clock time this session began

Definition at line 170 of file tls_session.h.

170{ return m_start_time; }

References m_start_time.

Referenced by Botan::TLS::Session::Session(), Session_Base(), and Botan::TLS::Session_Manager_SQL::store().

◆ supports_encrypt_then_mac()

bool Botan::TLS::Session_Base::supports_encrypt_then_mac ( ) const
inline

Returns true if a TLS 1.2 session negotiated "encrypt then MAC"; TLS 1.3 sessions will always return false as they always use an AEAD.

Definition at line 201 of file tls_session.h.

201{ return m_encrypt_then_mac; }

References m_encrypt_then_mac.

Referenced by Botan::TLS::Client_Hello_12::Client_Hello_12().

◆ supports_extended_master_secret()

bool Botan::TLS::Session_Base::supports_extended_master_secret ( ) const
inline

Returns true if a TLS 1.2 session negotiated "extended master secret"; TLS 1.3 sessions will always return true (see RFC 8446 Appendix D).

Definition at line 207 of file tls_session.h.

207{ return m_extended_master_secret; }

References m_extended_master_secret.

◆ version()

Member Data Documentation

◆ m_ciphersuite

uint16_t Botan::TLS::Session_Base::m_ciphersuite = 0
protected

◆ m_connection_side

Connection_Side Botan::TLS::Session_Base::m_connection_side {}
protected

Definition at line 234 of file tls_session.h.

234{}; // NOLINT(*non-private-member-variable*)

Referenced by Botan::TLS::Session::DER_encode(), Botan::TLS::Session::Session(), Session_Base(), and side().

◆ m_encrypt_then_mac

bool Botan::TLS::Session_Base::m_encrypt_then_mac = false
protected

◆ m_extended_master_secret

bool Botan::TLS::Session_Base::m_extended_master_secret = false
protected

◆ m_peer_certs

std::vector<X509_Certificate> Botan::TLS::Session_Base::m_peer_certs
protected

◆ m_peer_raw_public_key

std::shared_ptr<const Public_Key> Botan::TLS::Session_Base::m_peer_raw_public_key
protected

◆ m_server_info

Server_Information Botan::TLS::Session_Base::m_server_info
protected

◆ m_srtp_profile

uint16_t Botan::TLS::Session_Base::m_srtp_profile = 0
protected

◆ m_start_time

std::chrono::system_clock::time_point Botan::TLS::Session_Base::m_start_time
protected

◆ m_version

Protocol_Version Botan::TLS::Session_Base::m_version
protected

The documentation for this class was generated from the following files: