Botan 2.19.3
Crypto and TLS for C&
|
#include <tls_session.h>
Public Member Functions | |
Ciphersuite | ciphersuite () const |
uint16_t | ciphersuite_code () const |
secure_vector< uint8_t > | DER_encode () const |
uint16_t | dtls_srtp_profile () const |
std::vector< uint8_t > | encrypt (const SymmetricKey &key, RandomNumberGenerator &rng) const |
const secure_vector< uint8_t > & | master_secret () const |
const std::vector< X509_Certificate > & | peer_certs () const |
std::string | PEM_encode () const |
const Server_Information & | server_info () const |
Session () | |
Session (const std::string &pem) | |
Session (const std::vector< uint8_t > &session_id, const secure_vector< uint8_t > &master_secret, Protocol_Version version, uint16_t ciphersuite, Connection_Side side, bool supports_extended_master_secret, bool supports_encrypt_then_mac, const std::vector< X509_Certificate > &peer_certs, const std::vector< uint8_t > &session_ticket, const Server_Information &server_info, const std::string &srp_identifier, uint16_t srtp_profile) | |
Session (const uint8_t ber[], size_t ber_len) | |
std::chrono::seconds | session_age () const |
const std::vector< uint8_t > & | session_id () const |
const std::vector< uint8_t > & | session_ticket () const |
Connection_Side | side () const |
const std::string & | srp_identifier () 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 |
Static Public Member Functions | |
static Session | decrypt (const std::vector< uint8_t > &ctext, const SymmetricKey &key) |
static Session | decrypt (const uint8_t ctext[], size_t ctext_size, const SymmetricKey &key) |
Class representing a TLS session state
Definition at line 27 of file tls_session.h.
|
inline |
Uninitialized session
Definition at line 34 of file tls_session.h.
Botan::TLS::Session::Session | ( | const std::vector< uint8_t > & | session_id, |
const secure_vector< uint8_t > & | master_secret, | ||
Protocol_Version | version, | ||
uint16_t | ciphersuite, | ||
Connection_Side | side, | ||
bool | supports_extended_master_secret, | ||
bool | supports_encrypt_then_mac, | ||
const std::vector< X509_Certificate > & | peer_certs, | ||
const std::vector< uint8_t > & | session_ticket, | ||
const Server_Information & | server_info, | ||
const std::string & | srp_identifier, | ||
uint16_t | srtp_profile | ||
) |
New session (sets session start time)
Definition at line 22 of file tls_session.cpp.
Botan::TLS::Session::Session | ( | const uint8_t | ber[], |
size_t | ber_len | ||
) |
Load a session from DER representation (created by DER_encode)
ber | DER representation buffer |
ber_len | size of buffer in bytes |
Definition at line 57 of file tls_session.cpp.
References Botan::BER_Decoder::decode(), Botan::BER_Decoder::decode_and_check(), Botan::BER_Decoder::decode_integer_type(), Botan::BER_Decoder::end_cons(), Botan::DataSource_Memory::end_of_data(), Botan::OCTET_STRING, Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), start_time(), Botan::ASN1_String::value(), and Botan::BER_Decoder::verify_end().
|
explicit |
Load a session from PEM representation (created by PEM_encode)
pem | PEM representation |
Definition at line 50 of file tls_session.cpp.
References Botan::PEM_Code::decode_check_label(), and Session().
|
inline |
Get the ciphersuite info of the saved session
Definition at line 128 of file tls_session.h.
|
inline |
Get the ciphersuite code of the saved session
Definition at line 123 of file tls_session.h.
Referenced by Botan::TLS::Client_Hello::Client_Hello().
|
inlinestatic |
Decrypt a session created by encrypt
ctext | the ciphertext returned by encrypt |
key | the same key used by the encrypting side |
Definition at line 102 of file tls_session.h.
|
static |
Decrypt a session created by encrypt
ctext | the ciphertext returned by encrypt |
ctext_size | the size of ctext in bytes |
key | the same key used by the encrypting side |
Definition at line 250 of file tls_session.cpp.
References Botan::AEAD_Mode::create_or_throw(), Botan::MessageAuthenticationCode::create_or_throw(), Botan::DECRYPTION, Botan::load_be< uint64_t >(), Botan::same_mem(), and Session().
Referenced by Botan::TLS::Session_Manager_SQL::load_from_server_info(), and Botan::TLS::Session_Manager_SQL::load_from_session_id().
secure_vector< uint8_t > Botan::TLS::Session::DER_encode | ( | ) | const |
Encode this session data for storage
Definition at line 138 of file tls_session.cpp.
References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::get_contents(), Botan::TLS::Server_Information::hostname(), Botan::TLS::Protocol_Version::major_version(), Botan::TLS::Protocol_Version::minor_version(), Botan::OCTET_STRING, Botan::TLS::Server_Information::port(), Botan::SEQUENCE, Botan::TLS::Server_Information::service(), Botan::DER_Encoder::start_cons(), and Botan::UTF8_STRING.
Referenced by encrypt(), and PEM_encode().
|
inline |
Get the negotiated DTLS-SRTP algorithm (RFC 5764)
Definition at line 154 of file tls_session.h.
std::vector< uint8_t > Botan::TLS::Session::encrypt | ( | const SymmetricKey & | key, |
RandomNumberGenerator & | rng | ||
) | const |
Encrypt a session (useful for serialization or session tickets)
Definition at line 206 of file tls_session.cpp.
References BOTAN_ASSERT_NOMSG, Botan::AEAD_Mode::create_or_throw(), Botan::MessageAuthenticationCode::create_or_throw(), DER_encode(), Botan::ENCRYPTION, Botan::RandomNumberGenerator::random_vec(), and Botan::store_be().
Referenced by Botan::TLS::Session_Manager_SQL::save(), and Botan::TLS::Session_Manager_In_Memory::save().
|
inline |
Get the saved master secret
Definition at line 144 of file tls_session.h.
|
inline |
Return the certificate chain of the peer (possibly empty)
Definition at line 163 of file tls_session.h.
std::string Botan::TLS::Session::PEM_encode | ( | ) | const |
Encode this session data for storage
Definition at line 169 of file tls_session.cpp.
References DER_encode(), and Botan::PEM_Code::encode().
|
inline |
Definition at line 183 of file tls_session.h.
Referenced by Botan::TLS::Client_Hello::Client_Hello(), Botan::TLS::Session_Manager_SQL::save(), and Botan::TLS::Session_Manager_In_Memory::save().
std::chrono::seconds Botan::TLS::Session::session_age | ( | ) | const |
Return how long this session has existed (in seconds)
Definition at line 174 of file tls_session.cpp.
|
inline |
Get the session identifier
Definition at line 149 of file tls_session.h.
Referenced by Botan::TLS::Session_Manager_SQL::save(), and Botan::TLS::Session_Manager_In_Memory::save().
|
inline |
Return the session ticket the server gave us
Definition at line 178 of file tls_session.h.
Referenced by Botan::TLS::Client_Hello::Client_Hello().
|
inline |
Get which side of the connection the resumed session we are/were acting as.
Definition at line 134 of file tls_session.h.
Referenced by Botan::TLS::Session_Manager_In_Memory::save().
|
inline |
Get the SRP identity (if sent by the client in the initial handshake)
Definition at line 139 of file tls_session.h.
Referenced by Botan::TLS::Client_Hello::Client_Hello().
|
inline |
Get the wall clock time this session began
Definition at line 168 of file tls_session.h.
Referenced by Botan::TLS::Session_Manager_SQL::save(), and Session().
|
inline |
Definition at line 158 of file tls_session.h.
Referenced by Botan::TLS::Client_Hello::Client_Hello().
|
inline |
Definition at line 156 of file tls_session.h.
|
inline |
Get the version of the saved session
Definition at line 118 of file tls_session.h.