|
Botan 3.11.0
Crypto and TLS for C&
|
#include <tls_client_impl_12.h>
Public Member Functions | |
| std::string | application_protocol () const override |
| Client_Impl_12 (const Channel_Impl::Downgrade_Information &downgrade_info) | |
| Client_Impl_12 (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(), bool datagram=false, const std::vector< std::string > &next_protocols={}, size_t reserved_io_buffer_size=TLS::Channel::IO_BUF_DEFAULT_SIZE) | |
| 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 force_full_renegotiation=false) 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< Downgrade_Information > | m_downgrade_info |
SSL/TLS Client 1.2 implementation
Definition at line 23 of file tls_client_impl_12.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 |
| datagram | specifies whether to use TLS 1.2 or DTLS 1.2 |
| next_protocols | specifies protocols to advertise with ALPN |
| reserved_io_buffer_size | This many bytes of memory will be preallocated for the read and write buffers. Smaller values just mean reallocations and copies are more likely. |
Definition at line 85 of file tls_client_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, Botan::TLS::Channel_Impl_12::callbacks(), Botan::TLS::Channel_Impl_12::Channel_Impl_12(), Botan::TLS::Channel_Impl_12::create_handshake_state(), Botan::TLS::Channel_Impl_12::policy(), Botan::TLS::Channel_Impl_12::rng(), and Botan::TLS::Channel_Impl_12::session_manager().
|
explicit |
Definition at line 103 of file tls_client_impl_12.cpp.
References BOTAN_ASSERT_NOMSG, Botan::TLS::Channel_Impl_12::callbacks(), Botan::TLS::Channel_Impl_12::Channel_Impl_12(), Botan::TLS::Handshake_State::client_hello(), Botan::TLS::Channel_Impl::Downgrade_Information::client_hello_message, Botan::TLS::Channel_Impl_12::create_handshake_state(), Botan::TLS::Handshake_State::hash(), Botan::TLS::Channel_Impl::Downgrade_Information::next_protocols, Botan::TLS::Channel_Impl_12::policy(), Botan::TLS::Channel_Impl_12::rng(), Botan::TLS::Channel_Impl_12::secure_renegotiation_check(), Botan::TLS::ServerHello, Botan::TLS::Channel_Impl_12::session_manager(), Botan::TLS::Handshake_State::set_expected_next(), Botan::TLS::Channel_Impl::Downgrade_Information::tls12_session, and Botan::TLS::Handshake_Hash::update().
|
protectedinherited |
Definition at line 259 of file tls_channel_impl_12.cpp.
References callbacks(), Botan::map_remove_if(), and Botan::TLS::Callbacks::tls_session_activated().
|
inlineoverridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 64 of file tls_client_impl_12.h.
|
inlineprotectedinherited |
Definition at line 183 of file tls_channel_impl_12.h.
Referenced by activate_session(), Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Server_Impl_12::Server_Impl_12(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
protectedinherited |
Definition at line 195 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT, Botan::TLS::Client, and Botan::TLS::Server.
|
protectedinherited |
Definition at line 222 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT.
|
inlineinherited |
Send a close notification alert
Definition at line 76 of file tls_channel_impl.h.
References send_warning_alert().
|
protectedinherited |
Definition at line 114 of file tls_channel_impl_12.cpp.
References Botan::TLS::Policy::dtls_default_mtu(), Botan::TLS::Policy::dtls_initial_timeout(), Botan::TLS::Policy::dtls_maximum_timeout(), Botan::TLS::Protocol_Version::is_datagram_protocol(), new_handshake_state(), policy(), and Botan::TLS::Protocol_Version::to_string().
Referenced by Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), and renegotiate().
|
inlineinherited |
Definition at line 276 of file tls_channel_impl.h.
References m_downgrade_info.
Referenced by Botan::TLS::Client_Impl_13::Client_Impl_13(), and Botan::TLS::Channel_Impl_13::from_peer().
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 105 of file tls_channel_impl_12.cpp.
|
inlineinherited |
Definition at line 274 of file tls_channel_impl.h.
References m_downgrade_info.
|
overridevirtualinherited |
Inject TLS traffic received from counterparty
Implements Botan::TLS::Channel_Impl.
Definition at line 276 of file tls_channel_impl_12.cpp.
References Botan::TLS::Alert, Botan::TLS::Policy::allow_dtls_epoch0_restart(), Botan::TLS::ApplicationData, BOTAN_ASSERT, BOTAN_ASSERT_IMPLICATION, Botan::TLS::ChangeCipherSpec, Botan::TLS::ClientHello, Botan::TLS::Record_Header::epoch(), Botan::TLS::Handshake, Botan::TLS::Invalid, Botan::TLS::Protocol_Version::major_version(), Botan::TLS::MAX_PLAINTEXT_SIZE, Botan::TLS::Record_Header::needed(), policy(), Botan::TLS::read_record(), Botan::TLS::Channel_Impl::send_fatal_alert(), Botan::TLS::Record_Header::sequence(), Botan::TLS::Record_Header::type(), Botan::TLS::TLS_Exception::type(), and Botan::TLS::Record_Header::version().
|
protectedinherited |
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 251 of file tls_channel_impl_12.cpp.
References is_closed(), and is_handshake_complete().
Referenced by to_peer().
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 255 of file tls_channel_impl_12.cpp.
Referenced by is_active(), is_closed_for_reading(), is_closed_for_writing(), and send_alert().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 94 of file tls_channel_impl_12.h.
References is_closed().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 96 of file tls_channel_impl_12.h.
References is_closed().
|
inlineinherited |
Indicates whether a downgrade to TLS 1.2 or lower is in progress
Definition at line 269 of file tls_channel_impl.h.
References 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().
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 247 of file tls_channel_impl_12.cpp.
Referenced by is_active().
|
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 639 of file tls_channel_impl_12.cpp.
References Botan::as_span_of_bytes(), BOTAN_ASSERT_NONNULL, and Botan::get_byte().
|
protectedpure virtualinherited |
Referenced by create_handshake_state().
|
inlinevirtualinherited |
Reimplemented in Botan::TLS::Server_Impl_13.
Definition at line 140 of file tls_channel_impl.h.
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 98 of file tls_channel_impl_12.cpp.
References get_peer_cert_chain().
|
inlineoverridevirtualinherited |
Note: Raw public key for authentication (RFC7250) is currently not implemented for TLS 1.2.
Implements Botan::TLS::Channel_Impl.
Definition at line 109 of file tls_channel_impl_12.h.
|
inlineprotectedinherited |
Definition at line 181 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), create_handshake_state(), from_peer(), renegotiate(), Botan::TLS::Server_Impl_12::Server_Impl_12(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
inlineprotectedinherited |
Definition at line 229 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and m_downgrade_info.
Referenced by Botan::TLS::Client_Impl_13::Client_Impl_13().
|
inlineprotectedinherited |
Definition at line 224 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and m_downgrade_info.
Referenced by Botan::TLS::Channel_Impl_13::from_peer().
|
overridevirtualinherited |
Attempt to renegotiate the session
| force_full_renegotiation | if true, require a full renegotiation, otherwise allow session resumption |
Implements Botan::TLS::Channel_Impl.
Definition at line 175 of file tls_channel_impl_12.cpp.
References Botan::TLS::Policy::allow_resumption_for_renegotiation(), create_handshake_state(), initiate_handshake(), and policy().
|
inlineprotectedinherited |
Implementations use this to signal that the peer indicated a protocol version downgrade. After calling request_downgrade() no further state changes must be performed 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 250 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and m_downgrade_info.
Referenced by request_downgrade_for_resumption().
|
inlineprotectedinherited |
Definition at line 255 of file tls_channel_impl.h.
References BOTAN_ASSERT_NOMSG, BOTAN_STATE_CHECK, Botan::TLS::Protocol_Version::is_pre_tls_13(), m_downgrade_info, request_downgrade(), Botan::TLS::Session_with_Handle::session, and Botan::TLS::Session_Base::version().
Referenced by Botan::TLS::Client_Impl_13::Client_Impl_13().
|
protectedinherited |
Definition at line 60 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NOMSG.
|
inlineprotectedinherited |
Definition at line 177 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Server_Impl_12::Server_Impl_12(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
protectedinherited |
Definition at line 561 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, Botan::TLS::Client_Hello_12::renegotiation_info(), Botan::TLS::Client_Hello_12::secure_renegotiation(), and secure_renegotiation_data_for_client_hello().
Referenced by Botan::TLS::Client_Impl_12::Client_Impl_12().
|
protectedinherited |
Definition at line 583 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, Botan::TLS::Server_Hello_12::renegotiation_info(), Botan::TLS::Server_Hello_12::secure_renegotiation(), and secure_renegotiation_data_for_server_hello().
|
protectedinherited |
Definition at line 605 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL.
Referenced by secure_renegotiation_check().
|
protectedinherited |
Definition at line 613 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL.
Referenced by secure_renegotiation_check().
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 625 of file tls_channel_impl_12.cpp.
|
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 532 of file tls_channel_impl_12.cpp.
References Botan::TLS::Alert, BOTAN_ASSERT_NONNULL, is_closed(), Botan::TLS::Alert::is_fatal(), Botan::TLS::Alert::is_valid(), Botan::TLS::Session_Manager::remove(), Botan::TLS::Alert::serialize(), session_manager(), and Botan::TLS::Alert::type().
|
inlineinherited |
Send a fatal alert
Definition at line 71 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().
|
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 153 of file tls_channel_impl.h.
|
inlineinherited |
Send a warning alert
Definition at line 66 of file tls_channel_impl.h.
References Botan::TLS::Alert, and send_alert().
Referenced by close().
|
inlineprotectedinherited |
Definition at line 179 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), send_alert(), Botan::TLS::Server_Impl_12::Server_Impl_12(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
inlineprotectedinherited |
Definition at line 237 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and m_downgrade_info.
|
overridevirtualinherited |
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.
Implements Botan::TLS::Channel_Impl.
Definition at line 166 of file tls_channel_impl_12.cpp.
|
overridevirtualinherited |
Inject plaintext intended for counterparty Throws an exception if is_active() is false
Implements Botan::TLS::Channel_Impl.
Definition at line 524 of file tls_channel_impl_12.cpp.
References Botan::TLS::ApplicationData, and is_active().
|
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 191 of file tls_channel_impl_12.cpp.
|
protectedinherited |
Definition at line 222 of file tls_channel_impl.h.
Referenced by Botan::TLS::Channel_Impl_13::expect_downgrade(), expects_downgrade(), extract_downgrade_info(), Botan::TLS::Channel_Impl_13::from_peer(), is_downgrading(), preserve_client_hello(), preserve_peer_transcript(), request_downgrade(), request_downgrade_for_resumption(), and set_io_buffer_size().