Botan 3.4.0
Crypto and TLS for C&
Public Member Functions | Protected Attributes | Friends | List of all members
Botan::TLS::Session_Summary Class Reference

#include <tls_session.h>

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

Public Member Functions

std::string cipher_algo () const
 
Ciphersuite ciphersuite () const
 
uint16_t ciphersuite_code () const
 
uint16_t dtls_srtp_profile () const
 
const std::optional< std::string > & external_psk_identity () const
 
std::string kex_algo () const
 
std::string mac_algo () const
 
const std::vector< X509_Certificate > & peer_certs () const
 
std::shared_ptr< const Public_Keypeer_raw_public_key () const
 
std::string prf_algo () const
 
bool psk_used () const
 
const Server_Informationserver_info () const
 
const Session_IDsession_id () const
 
const std::optional< Session_Ticket > & session_ticket () const
 
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
 
bool was_resumption () const
 

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
 

Friends

class Client_Impl_12
 
class Client_Impl_13
 
class Server_Impl_12
 
class Server_Impl_13
 

Detailed Description

Summarizes the negotiated features after a TLS handshake. Applications may query those in Callbacks::tls_session_established().

Definition at line 241 of file tls_session.h.

Member Function Documentation

◆ cipher_algo()

std::string Botan::TLS::Session_Summary::cipher_algo ( ) const
inline

Definition at line 286 of file tls_session.h.

286{ return ciphersuite().cipher_algo(); }
std::string cipher_algo() const
Ciphersuite ciphersuite() const

◆ ciphersuite()

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

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 Botan::TLS::Session_Base::m_ciphersuite.

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

◆ ciphersuite_code()

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

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
inlineinherited

Get the negotiated DTLS-SRTP algorithm (RFC 5764)

Definition at line 192 of file tls_session.h.

192{ return m_srtp_profile; }

◆ external_psk_identity()

const std::optional< std::string > & Botan::TLS::Session_Summary::external_psk_identity ( ) const
inline

The negotiated identity of an externally provided preshared key used to establish this session. For TLS 1.3 this may be any of the externally provided PSKs offered by the client. PSK identities used as session tickets for TLS 1.3 session resumption won't be shown here.

Definition at line 263 of file tls_session.h.

263{ return m_external_psk_identity; }

◆ kex_algo()

std::string Botan::TLS::Session_Summary::kex_algo ( ) const
inline

Definition at line 284 of file tls_session.h.

284{ return m_kex_algo; }

◆ mac_algo()

std::string Botan::TLS::Session_Summary::mac_algo ( ) const
inline

Definition at line 288 of file tls_session.h.

288{ return ciphersuite().mac_algo(); }
std::string mac_algo() const

◆ peer_certs()

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

Return the certificate chain of the peer (possibly empty)

Definition at line 209 of file tls_session.h.

209{ return m_peer_certs; }
std::vector< X509_Certificate > m_peer_certs

◆ peer_raw_public_key()

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

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; }
std::shared_ptr< const Public_Key > m_peer_raw_public_key

◆ prf_algo()

std::string Botan::TLS::Session_Summary::prf_algo ( ) const
inline

Definition at line 290 of file tls_session.h.

290{ return ciphersuite().prf_algo(); }
std::string prf_algo() const

◆ psk_used()

bool Botan::TLS::Session_Summary::psk_used ( ) const
inline

Indicates that the session was established using an externally provided PSK. Session resumptions in TLS 1.3 (while technically implemented using a PSK) are not considered here.

See also
was_resumption()
Note
Botan 3.0 and 3.1 did incorrectly report true for session resumption.
Returns
true if the session was established using an externally provided PSK.

Definition at line 275 of file tls_session.h.

275{ return m_external_psk_identity.has_value(); }

◆ server_info()

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

Get information about the TLS server

Definition at line 219 of file tls_session.h.

219{ return m_server_info; }
Server_Information m_server_info

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

◆ session_id()

const Session_ID & Botan::TLS::Session_Summary::session_id ( ) const
inline

The Session_ID negotiated during the handshake. Note that this does not carry any meaning in TLS 1.3 and might even be empty.

Definition at line 248 of file tls_session.h.

248{ return m_session_id; }

◆ session_ticket()

const std::optional< Session_Ticket > & Botan::TLS::Session_Summary::session_ticket ( ) const
inline

The session ticket a TLS 1.2 server issued for this session. Note that this may be set in TLS 1.2 clients only. It is not the ticket used to establish this session.

Definition at line 255 of file tls_session.h.

255{ return m_session_ticket; }

◆ side()

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

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; }
Connection_Side 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
inlineinherited

Get the wall clock time this session began

Definition at line 167 of file tls_session.h.

167{ return m_start_time; }
std::chrono::system_clock::time_point 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
inlineinherited

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.

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

◆ supports_extended_master_secret()

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

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.

◆ version()

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

◆ was_resumption()

bool Botan::TLS::Session_Summary::was_resumption ( ) const
inline

Indicates that the session was resumed from a previous handshake state.

Returns
true if this session is a resumption, otherwise false

Definition at line 282 of file tls_session.h.

282{ return m_was_resumption; }

Friends And Related Symbol Documentation

◆ Client_Impl_12

friend class Client_Impl_12
friend

Definition at line 295 of file tls_session.h.

◆ Client_Impl_13

friend class Client_Impl_13
friend

Definition at line 296 of file tls_session.h.

◆ Server_Impl_12

friend class Server_Impl_12
friend

Definition at line 293 of file tls_session.h.

◆ Server_Impl_13

friend class Server_Impl_13
friend

Definition at line 294 of file tls_session.h.

Member Data Documentation

◆ m_ciphersuite

uint16_t Botan::TLS::Session_Base::m_ciphersuite
protectedinherited

◆ m_connection_side

Connection_Side Botan::TLS::Session_Base::m_connection_side
protectedinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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