|
Botan 3.13.0
Crypto and TLS for C&
|
#include <tls_server_impl_13.h>
Public Member Functions | |
| std::string | application_protocol () const override |
| void | close () |
| std::optional< std::string > | external_psk_identity () const override |
| 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_handshake_complete () const override |
| SymmetricKey | key_material_export (std::string_view label, std::string_view context, size_t length) const override |
| bool | new_session_ticket_supported () const override |
| virtual std::optional< std::chrono::milliseconds > | next_retransmission_timeout () 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) |
| size_t | send_new_session_tickets (size_t tickets) override |
| void | send_warning_alert (Alert::Type type) |
| Server_Impl_13 (const std::shared_ptr< Callbacks > &callbacks, const std::shared_ptr< Session_Manager > &session_manager, const std::shared_ptr< Credentials_Manager > &credentials_manager, const std::shared_ptr< const Policy > &policy, const std::shared_ptr< RandomNumberGenerator > &rng) | |
| 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 Types | |
| enum class | Compat_Mode_Situation : uint8_t { BeforeSendingAlert , AfterSendingFirstClientHello , BeforeSendingSecondClientHello , BeforeSendingEncryptedClientFlight , AfterSendingFirstServerHello , AfterSendingHelloRetryRequest } |
Protected Member Functions | |
| AggregatedHandshakeMessages | aggregate_handshake_messages () |
| AggregatedPostHandshakeMessages | aggregate_post_handshake_messages () |
| Callbacks & | callbacks () const |
| Credentials_Manager & | credentials_manager () |
| bool | expects_downgrade () const |
| bool | is_downgrading () const |
| void | opportunistically_update_traffic_keys () |
| const Policy & | policy () const |
| RandomNumberGenerator & | rng () |
| void | send_dummy_change_cipher_spec () |
| template<typename... MsgTs> | |
| void | send_handshake_message (const std::variant< MsgTs... > &message) |
| template<typename MsgT> | |
| void | send_handshake_message (std::reference_wrapper< MsgT > message) |
| void | send_post_handshake_message (Post_Handshake_Message_13 message) |
| Session_Manager & | session_manager () |
| void | set_record_size_limits (uint16_t outgoing_limit, uint16_t incoming_limit) |
| void | set_selected_certificate_type (Certificate_Type cert_type) |
Protected Attributes | |
| std::optional< Active_Connection_State_13 > | m_active_state |
| std::unique_ptr< Cipher_State > | m_cipher_state |
| const Connection_Side | m_side |
| Transcript_Hash_State | m_transcript_hash |
SSL/TLS Server 1.3 implementation
Definition at line 22 of file tls_server_impl_13.h.
|
strongprotectedinherited |
| Enumerator | |
|---|---|
| BeforeSendingAlert | |
| AfterSendingFirstClientHello | |
| BeforeSendingSecondClientHello | |
| BeforeSendingEncryptedClientFlight | |
| AfterSendingFirstServerHello | |
| AfterSendingHelloRetryRequest | |
Definition at line 222 of file tls_channel_impl_13.h.
|
explicit |
Definition at line 23 of file tls_server_impl_13.cpp.
References Botan::TLS::Channel_Impl_13::callbacks(), Botan::TLS::Channel_Impl_13::Channel_Impl_13(), Botan::TLS::Channel_Impl_13::credentials_manager(), Botan::TLS::Channel_Impl_13::policy(), Botan::TLS::Channel_Impl_13::rng(), and Botan::TLS::Channel_Impl_13::session_manager().
|
inlineprotectedinherited |
Definition at line 258 of file tls_channel_impl_13.h.
References m_transcript_hash.
Referenced by send_handshake_message().
|
inlineprotectedinherited |
Definition at line 262 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Server_Impl_13::send_new_session_tickets(), and send_post_handshake_message().
|
overridevirtual |
Return the protocol notification set for this connection, if any (ALPN). This value is not tied to the session and a later renegotiation of the same session can choose a new protocol.
Implements Botan::TLS::Channel_Impl.
Definition at line 39 of file tls_server_impl_13.cpp.
References application_protocol(), and Botan::TLS::Channel_Impl_13::m_active_state.
Referenced by application_protocol().
|
inlineprotectedinherited |
Definition at line 266 of file tls_channel_impl_13.h.
Referenced by Channel_Impl_13(), Botan::TLS::Client_Impl_13::Client_Impl_13(), from_peer(), Botan::TLS::Server_Impl_13::send_new_session_tickets(), and Botan::TLS::Server_Impl_13::Server_Impl_13().
|
inlineinherited |
Send a close notification alert
Definition at line 80 of file tls_channel_impl.h.
References send_warning_alert().
|
inlineprotectedinherited |
Definition at line 270 of file tls_channel_impl_13.h.
Referenced by Channel_Impl_13(), and Botan::TLS::Server_Impl_13::Server_Impl_13().
|
inlineprotectedinherited |
Definition at line 290 of file tls_channel_impl.h.
Referenced by Botan::TLS::Client_Impl_13::Client_Impl_13(), and Botan::TLS::Channel_Impl_13::from_peer().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 85 of file tls_server_impl_13.cpp.
References external_psk_identity(), and Botan::TLS::Channel_Impl_13::m_active_state.
Referenced by external_psk_identity().
|
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_NONNULL, BOTAN_STATE_CHECK, callbacks(), Botan::TLS::ChangeCipherSpec, Botan::TLS::Channel_Impl::expects_downgrade(), Botan::TLS::Handshake, Botan::holds_any_of(), Botan::TLS::Channel_Impl::is_downgrading(), Botan::TLS::Channel_Impl::is_handshake_complete(), m_cipher_state, m_transcript_hash, policy(), process_dummy_change_cipher_spec(), process_handshake_msg(), 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 332 of file tls_channel_impl_13.cpp.
References m_cipher_state.
Referenced by to_peer(), and update_traffic_keys().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 167 of file tls_channel_impl_13.h.
References is_closed_for_reading(), and is_closed_for_writing().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 169 of file tls_channel_impl_13.h.
Referenced by is_closed().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 171 of file tls_channel_impl_13.h.
Referenced by is_closed().
|
inlineprotectedinherited |
Indicates whether a downgrade to TLS 1.2 or lower is in progress
Definition at line 282 of file tls_channel_impl.h.
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 199 of file tls_server_impl_13.cpp.
References is_handshake_complete(), and Botan::TLS::Channel_Impl_13::m_active_state.
Referenced by is_handshake_complete(), new_session_ticket_supported(), and send_new_session_tickets().
|
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 337 of file tls_channel_impl_13.cpp.
References BOTAN_STATE_CHECK, Botan::TLS::Channel_Impl::is_downgrading(), and m_cipher_state.
|
overridevirtual |
Reimplemented from Botan::TLS::Channel_Impl.
Definition at line 95 of file tls_server_impl_13.cpp.
References is_handshake_complete(), Botan::TLS::Channel_Impl_13::m_active_state, and new_session_ticket_supported().
Referenced by new_session_ticket_supported().
|
inlinevirtualinherited |
Reimplemented in Botan::TLS::Channel_Impl_12.
Definition at line 92 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 240 of file tls_channel_impl_13.h.
Referenced by handle().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 47 of file tls_server_impl_13.cpp.
References Botan::TLS::Channel_Impl_13::m_active_state, and peer_cert_chain().
Referenced by peer_cert_chain(), and send_new_session_tickets().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 66 of file tls_server_impl_13.cpp.
References Botan::TLS::Channel_Impl_13::m_active_state, and peer_raw_public_key().
Referenced by peer_raw_public_key(), and send_new_session_tickets().
|
inlineprotectedinherited |
Definition at line 274 of file tls_channel_impl_13.h.
Referenced by Channel_Impl_13(), Botan::TLS::Client_Impl_13::Client_Impl_13(), from_peer(), handle(), Botan::TLS::Server_Impl_13::send_new_session_tickets(), and Botan::TLS::Server_Impl_13::Server_Impl_13().
|
inlineoverridevirtualinherited |
Attempt to renegotiate the session
Implements Botan::TLS::Channel_Impl.
Definition at line 185 of file tls_channel_impl_13.h.
|
inlineprotectedinherited |
Definition at line 272 of file tls_channel_impl_13.h.
Referenced by Channel_Impl_13(), Botan::TLS::Client_Impl_13::Client_Impl_13(), Botan::TLS::Server_Impl_13::send_new_session_tickets(), and Botan::TLS::Server_Impl_13::Server_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 306 of file tls_channel_impl_13.cpp.
References Botan::TLS::Alert, BeforeSendingAlert, Botan::TLS::Alert::is_valid(), m_cipher_state, maybe_handle_compatibility_mode(), and Botan::TLS::Alert::serialize().
|
protectedinherited |
Definition at line 271 of file tls_channel_impl_13.cpp.
References BOTAN_STATE_CHECK, Botan::TLS::ChangeCipherSpec, and Botan::TLS::Channel_Impl::is_handshake_complete().
|
inlineinherited |
Send a fatal alert
Definition at line 75 of file tls_channel_impl.h.
References Botan::TLS::Alert, and send_alert().
Referenced by Botan::TLS::Channel_Impl_12::from_peer(), and Botan::TLS::Channel_Impl_13::from_peer().
|
inlineprotectedinherited |
Definition at line 243 of file tls_channel_impl_13.h.
References Botan::TLS::Channel_Impl_13::AggregatedHandshakeMessages::add(), aggregate_handshake_messages(), Botan::generalize_to(), and Botan::TLS::Channel_Impl_13::AggregatedMessages::send().
Referenced by Botan::TLS::Client_Impl_13::Client_Impl_13(), and send_handshake_message().
|
inlineprotectedinherited |
Definition at line 248 of file tls_channel_impl_13.h.
References Botan::generalize_to(), and send_handshake_message().
|
overridevirtual |
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 from Botan::TLS::Channel_Impl.
Definition at line 109 of file tls_server_impl_13.cpp.
References Botan::TLS::Channel_Impl_13::aggregate_post_handshake_messages(), BOTAN_STATE_CHECK, Botan::TLS::Channel_Impl_13::callbacks(), is_handshake_complete(), Botan::load_be(), Botan::TLS::Channel_Impl_13::m_active_state, Botan::TLS::Channel_Impl_13::m_cipher_state, peer_cert_chain(), peer_raw_public_key(), Botan::TLS::Channel_Impl_13::policy(), Botan::TLS::Channel_Impl_13::rng(), send_new_session_tickets(), Botan::TLS::Server, and Botan::TLS::Channel_Impl_13::session_manager().
Referenced by send_new_session_tickets().
|
inlineprotectedinherited |
Definition at line 252 of file tls_channel_impl_13.h.
References Botan::TLS::Channel_Impl_13::AggregatedPostHandshakeMessages::add(), aggregate_post_handshake_messages(), and Botan::TLS::Channel_Impl_13::AggregatedMessages::send().
Referenced by update_traffic_keys().
|
inlineinherited |
Send a warning alert
Definition at line 70 of file tls_channel_impl.h.
References Botan::TLS::Alert, and send_alert().
Referenced by close().
|
inlineprotectedinherited |
Definition at line 268 of file tls_channel_impl_13.h.
Referenced by Channel_Impl_13(), Botan::TLS::Client_Impl_13::Client_Impl_13(), Botan::TLS::Server_Impl_13::send_new_session_tickets(), and Botan::TLS::Server_Impl_13::Server_Impl_13().
|
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 458 of file tls_channel_impl_13.cpp.
|
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 462 of file tls_channel_impl_13.cpp.
|
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 285 of file tls_channel_impl_13.cpp.
References Botan::TLS::ApplicationData, is_active(), and 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 345 of file tls_channel_impl_13.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_STATE_CHECK, is_active(), Botan::TLS::Channel_Impl::is_downgrading(), Botan::TLS::Channel_Impl::is_handshake_complete(), m_cipher_state, and send_post_handshake_message().
Referenced by to_peer().
|
protectedinherited |
Definition at line 291 of file tls_channel_impl_13.h.
Referenced by Botan::TLS::Client_Impl_13::application_protocol(), Botan::TLS::Server_Impl_13::application_protocol(), Botan::TLS::Client_Impl_13::external_psk_identity(), Botan::TLS::Server_Impl_13::external_psk_identity(), Botan::TLS::Client_Impl_13::is_handshake_complete(), Botan::TLS::Server_Impl_13::is_handshake_complete(), Botan::TLS::Server_Impl_13::new_session_ticket_supported(), Botan::TLS::Client_Impl_13::peer_cert_chain(), Botan::TLS::Server_Impl_13::peer_cert_chain(), Botan::TLS::Client_Impl_13::peer_raw_public_key(), Botan::TLS::Server_Impl_13::peer_raw_public_key(), and Botan::TLS::Server_Impl_13::send_new_session_tickets().
|
protectedinherited |
Definition at line 290 of file tls_channel_impl_13.h.
Referenced by from_peer(), handle(), is_active(), key_material_export(), send_alert(), Botan::TLS::Server_Impl_13::send_new_session_tickets(), and update_traffic_keys().
|
protectedinherited |
Definition at line 288 of file tls_channel_impl_13.h.
Referenced by Channel_Impl_13().
|
protectedinherited |
Definition at line 289 of file tls_channel_impl_13.h.
Referenced by aggregate_handshake_messages(), and from_peer().