Botan 3.4.0
Crypto and TLS for C&
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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
 
Connection_Side m_connection_side
 
bool m_encrypt_then_mac
 
bool m_extended_master_secret
 
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
 
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 137 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 139 of file tls_session.h.

148 :
152 m_connection_side(connection_side),
153 m_srtp_profile(srtp_profile),
154 m_extended_master_secret(extended_master_secret),
155 m_encrypt_then_mac(encrypt_then_mac),
156 m_peer_certs(std::move(peer_certs)),
158 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

◆ 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::Server_Hello_12::Server_Hello_12().

◆ ciphersuite_code()

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

Get the ciphersuite code of the negotiated TLS session

Definition at line 177 of file tls_session.h.

177{ return 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 192 of file tls_session.h.

192{ return 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 209 of file tls_session.h.

209{ return m_peer_certs; }

◆ 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 214 of file tls_session.h.

214{ return m_peer_raw_public_key; }

◆ server_info()

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

Get information about the TLS server

Definition at line 219 of file tls_session.h.

219{ return m_server_info; }

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

◆ side()

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

Get which side of the connection we are/were acting as.

Definition at line 187 of file tls_session.h.

187{ return m_connection_side; }

Referenced by Botan::TLS::Session_Manager::establish(), and Botan::TLS::Session_Manager_Stateless::establish().

◆ 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 167 of file tls_session.h.

167{ return m_start_time; }

Referenced by Botan::TLS::Session::Session(), 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 198 of file tls_session.h.

198{ return 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 204 of file tls_session.h.

204{ return m_extended_master_secret; }

◆ version()

Protocol_Version Botan::TLS::Session_Base::version ( ) const
inline

Member Data Documentation

◆ m_ciphersuite

uint16_t Botan::TLS::Session_Base::m_ciphersuite
protected

◆ m_connection_side

Connection_Side Botan::TLS::Session_Base::m_connection_side
protected

Definition at line 226 of file tls_session.h.

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

◆ m_encrypt_then_mac

bool Botan::TLS::Session_Base::m_encrypt_then_mac
protected

Definition at line 230 of file tls_session.h.

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

◆ m_extended_master_secret

bool Botan::TLS::Session_Base::m_extended_master_secret
protected

Definition at line 229 of file tls_session.h.

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

◆ m_peer_certs

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

Definition at line 232 of file tls_session.h.

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

◆ m_peer_raw_public_key

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

Definition at line 233 of file tls_session.h.

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

◆ m_server_info

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

Definition at line 234 of file tls_session.h.

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

◆ m_srtp_profile

uint16_t Botan::TLS::Session_Base::m_srtp_profile
protected

Definition at line 227 of file tls_session.h.

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

◆ m_start_time

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

Definition at line 222 of file tls_session.h.

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

◆ m_version

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

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