Botan 3.6.1
Crypto and TLS for C&
|
#include <tls_client_impl_13.h>
Public Member Functions | |
std::string | application_protocol () const override |
Client_Impl_13 (const std::shared_ptr< Callbacks > &callbacks, const std::shared_ptr< Session_Manager > &session_manager, const std::shared_ptr< Credentials_Manager > &creds, const std::shared_ptr< const Policy > &policy, const std::shared_ptr< RandomNumberGenerator > &rng, Server_Information server_info=Server_Information(), const std::vector< std::string > &next_protocols={}) | |
void | close () |
bool | expects_downgrade () const |
std::optional< std::string > | external_psk_identity () const override |
std::unique_ptr< Downgrade_Information > | extract_downgrade_info () |
size_t | from_peer (std::span< const uint8_t > data) override |
bool | is_active () const override |
bool | is_closed () const override |
bool | is_closed_for_reading () const override |
bool | is_closed_for_writing () const override |
bool | is_downgrading () const |
bool | is_handshake_complete () const override |
SymmetricKey | key_material_export (std::string_view label, std::string_view context, size_t length) const override |
virtual bool | new_session_ticket_supported () const |
std::vector< X509_Certificate > | peer_cert_chain () const override |
std::shared_ptr< const Public_Key > | peer_raw_public_key () const override |
void | renegotiate (bool) override |
bool | secure_renegotiation_supported () const override |
void | send_alert (const Alert &alert) override |
void | send_fatal_alert (Alert::Type type) |
virtual size_t | send_new_session_tickets (const size_t) |
void | send_warning_alert (Alert::Type type) |
bool | timeout_check () override |
void | to_peer (std::span< const uint8_t > data) override |
void | update_traffic_keys (bool request_peer_update=false) override |
Protected Attributes | |
std::unique_ptr< Cipher_State > | m_cipher_state |
std::unique_ptr< Downgrade_Information > | m_downgrade_info |
const Connection_Side | m_side |
Transcript_Hash_State | m_transcript_hash |
SSL/TLS Client 1.3 implementation
Definition at line 28 of file tls_client_impl_13.h.
|
explicit |
Set up a new TLS client session
callbacks | contains a set of callback function references required by the TLS client. |
session_manager | manages session state |
creds | manages application/user credentials |
policy | specifies other connection policy information |
rng | a random number generator |
server_info | is identifying information about the TLS server |
next_protocols | specifies protocols to advertise with ALPN |
Definition at line 25 of file tls_client_impl_13.cpp.
References Botan::TLS::Policy::allow_tls12(), Botan::TLS::Channel_Impl_13::callbacks(), Botan::TLS::Client, Botan::TLS::Channel_Impl::expects_downgrade(), Botan::TLS::HelloRetryRequest, Botan::TLS::Server_Information::hostname(), Botan::TLS::Channel_Impl_13::policy(), Botan::TLS::Channel_Impl::preserve_client_hello(), Botan::TLS::Channel_Impl::request_downgrade_for_resumption(), Botan::TLS::Channel_Impl_13::rng(), Botan::TLS::Channel_Impl_13::send_handshake_message(), Botan::TLS::Handshake_State_13< whoami, Outbound_Message_T, Inbound_Message_T, Inbound_Post_Handshake_Message_T >::sending(), Botan::TLS::ServerHello, Botan::TLS::Handshake_Transitions::set_expected_next(), and Botan::TLS::Policy::tls_13_middlebox_compatibility_mode().
|
inlineprotectedinherited |
Definition at line 256 of file tls_channel_impl_13.h.
References Botan::TLS::Channel_Impl_13::m_transcript_hash.
Referenced by Botan::TLS::Channel_Impl_13::send_handshake_message().
|
inlineprotectedinherited |
Definition at line 260 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Channel_Impl_13::send_post_handshake_message().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 659 of file tls_client_impl_13.cpp.
References Botan::TLS::Internal::Handshake_State_13_Base::encrypted_extensions(), Botan::TLS::Encrypted_Extensions::extensions(), and is_handshake_complete().
|
inlineprotectedinherited |
Definition at line 264 of file tls_channel_impl_13.h.
Referenced by Client_Impl_13(), and Botan::TLS::Channel_Impl_13::from_peer().
|
inlineinherited |
Send a close notification alert
Definition at line 80 of file tls_channel_impl.h.
References Botan::TLS::Channel_Impl::send_warning_alert().
|
inlineprotectedinherited |
Definition at line 268 of file tls_channel_impl_13.h.
|
protectedinherited |
Indicate that we have to expect a downgrade to TLS 1.2. In which case the current implementation (i.e. Client_Impl_13 or Server_Impl_13) will need to be replaced by their respective counter parts.
This will prepare an internal structure where any information required to downgrade can be preserved.
Definition at line 402 of file tls_channel_impl_13.cpp.
References Botan::TLS::Channel::IO_BUF_DEFAULT_SIZE, and Botan::TLS::Channel_Impl::m_downgrade_info.
|
inlineinherited |
Definition at line 278 of file tls_channel_impl.h.
References Botan::TLS::Channel_Impl::m_downgrade_info.
Referenced by Client_Impl_13(), and Botan::TLS::Channel_Impl_13::from_peer().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 645 of file tls_client_impl_13.cpp.
|
inlineinherited |
Definition at line 276 of file tls_channel_impl.h.
References Botan::TLS::Channel_Impl::m_downgrade_info.
|
overridevirtualinherited |
Inject TLS traffic received from counterparty
Implements Botan::TLS::Channel_Impl.
Definition at line 68 of file tls_channel_impl_13.cpp.
References Botan::TLS::Alert, Botan::TLS::ApplicationData, BOTAN_ASSERT, BOTAN_STATE_CHECK, Botan::TLS::Channel_Impl_13::callbacks(), Botan::TLS::ChangeCipherSpec, Botan::TLS::Handshake_Layer::copy_data(), Botan::TLS::Record_Layer::copy_data(), Botan::TLS::Record_Layer::disable_receiving_compat_mode(), Botan::TLS::Channel_Impl::expects_downgrade(), Botan::TLS::Handshake, Botan::TLS::Handshake_Layer::has_pending_data(), Botan::holds_any_of(), Botan::TLS::Channel_Impl::is_downgrading(), Botan::TLS::Channel_Impl::is_handshake_complete(), Botan::TLS::Channel_Impl_13::m_cipher_state, Botan::TLS::Channel_Impl::m_downgrade_info, Botan::TLS::Channel_Impl_13::m_transcript_hash, Botan::TLS::Handshake_Layer::next_message(), Botan::TLS::Handshake_Layer::next_post_handshake_message(), Botan::TLS::Record_Layer::next_record(), Botan::TLS::Channel_Impl_13::policy(), Botan::TLS::Channel_Impl::preserve_peer_transcript(), Botan::TLS::Channel_Impl_13::process_dummy_change_cipher_spec(), Botan::TLS::Channel_Impl_13::process_handshake_msg(), Botan::TLS::Channel_Impl_13::process_post_handshake_msg(), Botan::TLS::Channel_Impl::send_fatal_alert(), Botan::TLS::Callbacks::tls_record_received(), and Botan::TLS::TLS_Exception::type().
|
overridevirtualinherited |
Note that the connection is active until the application has called close()
, even if a CloseNotify has been received from the peer.
Implements Botan::TLS::Channel_Impl.
Definition at line 304 of file tls_channel_impl_13.cpp.
References Botan::TLS::Channel_Impl_13::m_cipher_state.
Referenced by Botan::TLS::Channel_Impl_13::to_peer().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 167 of file tls_channel_impl_13.h.
References Botan::TLS::Channel_Impl_13::is_closed_for_reading(), and Botan::TLS::Channel_Impl_13::is_closed_for_writing().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 169 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Channel_Impl_13::is_closed().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 171 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Channel_Impl_13::is_closed().
|
inlineinherited |
Indicates whether a downgrade to TLS 1.2 or lower is in progress
Definition at line 271 of file tls_channel_impl.h.
References Botan::TLS::Channel_Impl::m_downgrade_info.
Referenced by Botan::TLS::Channel_Impl_13::from_peer(), Botan::TLS::Channel_Impl_13::key_material_export(), and Botan::TLS::Channel_Impl_13::update_traffic_keys().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 117 of file tls_client_impl_13.cpp.
References Botan::TLS::Internal::Handshake_State_13_Base::handshake_finished().
Referenced by application_protocol().
|
overridevirtualinherited |
Key material export (RFC 5705)
label | a disambiguating label string |
context | a per-association context value |
length | the length of the desired key in bytes |
Implements Botan::TLS::Channel_Impl.
Definition at line 309 of file tls_channel_impl_13.cpp.
References BOTAN_STATE_CHECK, Botan::TLS::Channel_Impl::is_downgrading(), and Botan::TLS::Channel_Impl_13::m_cipher_state.
|
inlinevirtualinherited |
Reimplemented in Botan::TLS::Server_Impl_13.
Definition at line 144 of file tls_channel_impl.h.
|
inlineprotectedinherited |
Schedule a traffic key update to opportunistically happen before the channel sends application data the next time. Such a key update will never request a reciprocal key update from the peer.
Definition at line 238 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Channel_Impl_13::handle().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 620 of file tls_client_impl_13.cpp.
References Botan::TLS::Certificate_13::cert_chain(), Botan::TLS::Certificate_13::has_certificate_chain(), Botan::TLS::Internal::Handshake_State_13_Base::has_server_certificate_msg(), and Botan::TLS::Internal::Handshake_State_13_Base::server_certificate().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 633 of file tls_client_impl_13.cpp.
References Botan::TLS::Internal::Handshake_State_13_Base::has_server_certificate_msg(), Botan::TLS::Certificate_13::is_raw_public_key(), Botan::TLS::Certificate_13::public_key(), and Botan::TLS::Internal::Handshake_State_13_Base::server_certificate().
|
inlineprotectedinherited |
Definition at line 272 of file tls_channel_impl_13.h.
Referenced by Client_Impl_13(), Botan::TLS::Channel_Impl_13::from_peer(), and Botan::TLS::Server_Impl_13::Server_Impl_13().
|
inlineprotectedinherited |
Definition at line 231 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and Botan::TLS::Channel_Impl::m_downgrade_info.
Referenced by Client_Impl_13().
|
inlineprotectedinherited |
Definition at line 226 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and Botan::TLS::Channel_Impl::m_downgrade_info.
Referenced by Botan::TLS::Channel_Impl_13::from_peer().
|
inlineoverridevirtualinherited |
Attempt to renegotiate the session
Implements Botan::TLS::Channel_Impl.
Definition at line 185 of file tls_channel_impl_13.h.
|
inlineprotectedinherited |
Implementations use this to signal that the peer indicated a protocol version downgrade. After calling request_downgrade()
no further state changes must be perfomed by the implementation. Particularly, no further handshake messages must be emitted. Instead, they must yield control flow back to the underlying Channel implementation to perform the protocol version downgrade.
Definition at line 252 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and Botan::TLS::Channel_Impl::m_downgrade_info.
Referenced by Botan::TLS::Channel_Impl::request_downgrade_for_resumption().
|
inlineprotectedinherited |
Definition at line 257 of file tls_channel_impl.h.
References BOTAN_ASSERT_NOMSG, BOTAN_STATE_CHECK, Botan::TLS::Protocol_Version::is_pre_tls_13(), Botan::TLS::Channel_Impl::m_downgrade_info, Botan::TLS::Channel_Impl::request_downgrade(), Botan::TLS::Session_with_Handle::session, and Botan::TLS::Session_Base::version().
Referenced by Client_Impl_13().
|
inlineprotectedinherited |
Definition at line 270 of file tls_channel_impl_13.h.
Referenced by Client_Impl_13().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 201 of file tls_channel_impl_13.h.
|
overridevirtualinherited |
Send a TLS alert message. If the alert is fatal, the internal state (keys, etc) will be reset.
alert | the Alert to send |
Implements Botan::TLS::Channel_Impl.
Definition at line 279 of file tls_channel_impl_13.cpp.
References Botan::TLS::Alert, Botan::TLS::Alert::is_valid(), Botan::TLS::Channel_Impl_13::m_cipher_state, and Botan::TLS::Alert::serialize().
|
protectedinherited |
Definition at line 248 of file tls_channel_impl_13.cpp.
References Botan::TLS::ChangeCipherSpec.
|
inlineinherited |
Send a fatal alert
Definition at line 75 of file tls_channel_impl.h.
References Botan::TLS::Alert, and Botan::TLS::Channel_Impl::send_alert().
Referenced by Botan::TLS::Channel_Impl_12::from_peer(), and Botan::TLS::Channel_Impl_13::from_peer().
|
inlineprotectedinherited |
Definition at line 241 of file tls_channel_impl_13.h.
References Botan::TLS::Channel_Impl_13::AggregatedHandshakeMessages::add(), Botan::TLS::Channel_Impl_13::aggregate_handshake_messages(), Botan::generalize_to(), and Botan::TLS::Channel_Impl_13::AggregatedMessages::send().
Referenced by Client_Impl_13(), and Botan::TLS::Channel_Impl_13::send_handshake_message().
|
inlineprotectedinherited |
Definition at line 246 of file tls_channel_impl_13.h.
References Botan::generalize_to(), and Botan::TLS::Channel_Impl_13::send_handshake_message().
|
inlinevirtualinherited |
Send tickets
new session tickets to the peer. This is only supported on TLS 1.3 servers.
If the server's Session_Manager does not accept the generated Session objects, the server implementation won't be able to send new tickets. Additionally, anything but TLS 1.3 servers will return 0 (because they don't support sending such session tickets).
Reimplemented in Botan::TLS::Server_Impl_13.
Definition at line 157 of file tls_channel_impl.h.
|
inlineprotectedinherited |
Definition at line 250 of file tls_channel_impl_13.h.
References Botan::TLS::Channel_Impl_13::AggregatedPostHandshakeMessages::add(), Botan::TLS::Channel_Impl_13::aggregate_post_handshake_messages(), and Botan::TLS::Channel_Impl_13::AggregatedMessages::send().
Referenced by Botan::TLS::Channel_Impl_13::update_traffic_keys().
|
inlineinherited |
Send a warning alert
Definition at line 70 of file tls_channel_impl.h.
References Botan::TLS::Alert, and Botan::TLS::Channel_Impl::send_alert().
Referenced by Botan::TLS::Channel_Impl::close().
|
inlineprotectedinherited |
Definition at line 266 of file tls_channel_impl_13.h.
|
inlineprotectedinherited |
Definition at line 239 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and Botan::TLS::Channel_Impl::m_downgrade_info.
|
protectedinherited |
Set the record size limits as negotiated by the "record_size_limit" extension (RFC 8449).
outgoing_limit | the maximal number of plaintext bytes to be sent in a protected record |
incoming_limit | the maximal number of plaintext bytes to be accepted in a received protected record |
Definition at line 422 of file tls_channel_impl_13.cpp.
References Botan::TLS::Record_Layer::set_record_size_limits().
|
protectedinherited |
Set the expected certificate type needed to parse Certificate messages in the handshake layer. See RFC 7250 and 8446 4.4.2 for further details.
Definition at line 426 of file tls_channel_impl_13.cpp.
References Botan::TLS::Handshake_Layer::set_selected_certificate_type().
|
inlineoverridevirtualinherited |
Perform a handshake timeout check. This does nothing unless this is a DTLS channel with a pending handshake state, in which case we check for timeout and potentially retransmit handshake packets.
In the TLS 1.3 implementation, this always returns false.
Implements Botan::TLS::Channel_Impl.
Definition at line 215 of file tls_channel_impl_13.h.
|
overridevirtualinherited |
Inject plaintext intended for counterparty Throws an exception if is_active() is false
Implements Botan::TLS::Channel_Impl.
Definition at line 258 of file tls_channel_impl_13.cpp.
References Botan::TLS::ApplicationData, Botan::TLS::Channel_Impl_13::is_active(), and Botan::TLS::Channel_Impl_13::update_traffic_keys().
|
overridevirtualinherited |
Attempt to update the session's traffic key material Note that this is possible with a TLS 1.3 channel, only.
request_peer_update | if true, require a reciprocal key update |
Implements Botan::TLS::Channel_Impl.
Definition at line 317 of file tls_channel_impl_13.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_STATE_CHECK, Botan::TLS::Channel_Impl::is_downgrading(), Botan::TLS::Channel_Impl::is_handshake_complete(), Botan::TLS::Channel_Impl_13::m_cipher_state, and Botan::TLS::Channel_Impl_13::send_post_handshake_message().
Referenced by Botan::TLS::Channel_Impl_13::to_peer().
|
protectedinherited |
Definition at line 288 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Channel_Impl_13::from_peer(), Botan::TLS::Channel_Impl_13::handle(), Botan::TLS::Channel_Impl_13::is_active(), Botan::TLS::Channel_Impl_13::key_material_export(), Botan::TLS::Channel_Impl_13::send_alert(), and Botan::TLS::Channel_Impl_13::update_traffic_keys().
|
protectedinherited |
Definition at line 224 of file tls_channel_impl.h.
Referenced by Botan::TLS::Channel_Impl_13::expect_downgrade(), Botan::TLS::Channel_Impl::expects_downgrade(), Botan::TLS::Channel_Impl::extract_downgrade_info(), Botan::TLS::Channel_Impl_13::from_peer(), Botan::TLS::Channel_Impl::is_downgrading(), Botan::TLS::Channel_Impl::preserve_client_hello(), Botan::TLS::Channel_Impl::preserve_peer_transcript(), Botan::TLS::Channel_Impl::request_downgrade(), Botan::TLS::Channel_Impl::request_downgrade_for_resumption(), and Botan::TLS::Channel_Impl::set_io_buffer_size().
|
protectedinherited |
Definition at line 286 of file tls_channel_impl_13.h.
|
protectedinherited |
Definition at line 287 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Channel_Impl_13::AggregatedHandshakeMessages::add(), Botan::TLS::Channel_Impl_13::aggregate_handshake_messages(), and Botan::TLS::Channel_Impl_13::from_peer().