Botan 3.8.1
Crypto and TLS for C&
|
#include <tls_server_impl_12.h>
Public Types | |
typedef std::function< void(Alert, const uint8_t[], size_t)> | alert_cb |
typedef std::function< void(const uint8_t[], size_t)> | data_cb |
typedef std::function< bool(const Session &)> | handshake_cb |
typedef std::function< void(const Handshake_Message &)> | handshake_msg_cb |
typedef std::function< std::string(std::vector< std::string >)> | next_protocol_fn |
typedef std::function< void(const uint8_t[], size_t)> | output_fn |
Public Member Functions | |
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) |
Server_Impl_12 (const Channel_Impl::Downgrade_Information &downgrade_info) | |
Server_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, bool is_datagram=false, size_t reserved_io_buffer_size=TLS::Channel::IO_BUF_DEFAULT_SIZE) | |
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 Server 1.2 implementation
Definition at line 24 of file tls_server_impl_12.h.
|
inherited |
Definition at line 44 of file tls_channel_impl_12.h.
|
inherited |
Definition at line 43 of file tls_channel_impl_12.h.
|
inherited |
Definition at line 45 of file tls_channel_impl_12.h.
|
inherited |
Definition at line 46 of file tls_channel_impl_12.h.
typedef std::function<std::string(std::vector<std::string>)> Botan::TLS::Server_Impl_12::next_protocol_fn |
Definition at line 26 of file tls_server_impl_12.h.
|
inherited |
Definition at line 42 of file tls_channel_impl_12.h.
|
explicit |
Server initialization
callbacks | contains a set of callback function references required by the TLS server. |
session_manager | manages session state |
creds | manages application/user credentials |
policy | specifies other connection policy information |
rng | a random number generator |
is_datagram | set to true if this server should expect DTLS connections. Otherwise TLS connections are expected. |
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 235 of file tls_server_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::policy(), Botan::TLS::Channel_Impl_12::rng(), and Botan::TLS::Channel_Impl_12::session_manager().
|
explicit |
Definition at line 246 of file tls_server_impl_12.cpp.
References Botan::TLS::Channel_Impl_12::callbacks(), Botan::TLS::Channel_Impl_12::Channel_Impl_12(), Botan::TLS::Channel_Impl_12::policy(), Botan::TLS::Channel_Impl_12::rng(), and Botan::TLS::Channel_Impl_12::session_manager().
|
protectedinherited |
Definition at line 252 of file tls_channel_impl_12.cpp.
References callbacks(), Botan::map_remove_if(), and Botan::TLS::Callbacks::tls_session_activated().
|
inlineprotectedinherited |
Definition at line 190 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 187 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT, Botan::TLS::Client, and Botan::TLS::Server.
|
protectedinherited |
Definition at line 214 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT.
|
inlineinherited |
Send a close notification alert
Definition at line 81 of file tls_channel_impl.h.
References send_warning_alert().
|
protectedinherited |
Definition at line 112 of file tls_channel_impl_12.cpp.
References 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 279 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 103 of file tls_channel_impl_12.cpp.
|
inlineinherited |
Definition at line 277 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 269 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 244 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 248 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 101 of file tls_channel_impl_12.h.
References is_closed().
|
inlineoverridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 103 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 272 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 240 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 623 of file tls_channel_impl_12.cpp.
References Botan::get_byte(), and Botan::to_byte_vector().
|
protectedpure virtualinherited |
Referenced by create_handshake_state().
|
inlinevirtualinherited |
Reimplemented in Botan::TLS::Server_Impl_13.
Definition at line 145 of file tls_channel_impl.h.
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 96 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 116 of file tls_channel_impl_12.h.
|
inlineprotectedinherited |
Definition at line 188 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 232 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 227 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 167 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 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 253 of file tls_channel_impl.h.
References BOTAN_STATE_CHECK, and m_downgrade_info.
Referenced by request_downgrade_for_resumption().
|
inlineprotectedinherited |
Definition at line 258 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 58 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NOMSG.
|
inlineprotectedinherited |
Definition at line 184 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 552 of file tls_channel_impl_12.cpp.
References 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 572 of file tls_channel_impl_12.cpp.
References 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 592 of file tls_channel_impl_12.cpp.
Referenced by secure_renegotiation_check().
|
protectedinherited |
Definition at line 599 of file tls_channel_impl_12.cpp.
Referenced by secure_renegotiation_check().
|
overridevirtualinherited |
Implements Botan::TLS::Channel_Impl.
Definition at line 609 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 524 of file tls_channel_impl_12.cpp.
References Botan::TLS::Alert, 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 76 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 158 of file tls_channel_impl.h.
|
inlineinherited |
Send a warning alert
Definition at line 71 of file tls_channel_impl.h.
References Botan::TLS::Alert, and send_alert().
Referenced by close().
|
inlineprotectedinherited |
Definition at line 186 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 240 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 158 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 516 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 183 of file tls_channel_impl_12.cpp.
|
protectedinherited |
Definition at line 225 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().