Botan 3.2.0
Crypto and TLS for C&
|
#include <tls_client.h>
Public Member Functions | |
std::string | application_protocol () const override |
Client (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(), Protocol_Version offer_version=Protocol_Version::latest_tls_version(), const std::vector< std::string > &next_protocols={}, size_t reserved_io_buffer_size=TLS::Client::IO_BUF_DEFAULT_SIZE) | |
void | close () override |
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 |
SymmetricKey | key_material_export (std::string_view label, std::string_view context, size_t length) const override |
std::vector< X509_Certificate > | peer_cert_chain () const override |
size_t | received_data (const uint8_t buf[], size_t buf_size) |
size_t | received_data (std::span< const uint8_t > data) |
void | renegotiate (bool force_full_renegotiation=false) override |
bool | secure_renegotiation_supported () const override |
void | send (const uint8_t buf[], size_t buf_size) |
void | send (std::span< const uint8_t > data) |
void | send (std::string_view val) |
void | send_alert (const Alert &alert) override |
void | send_fatal_alert (Alert::Type type) override |
void | send_warning_alert (Alert::Type type) override |
bool | timeout_check () override |
void | to_peer (std::span< const uint8_t > data) override |
void | update_traffic_keys (bool request_peer_update=false) override |
~Client () override | |
Static Public Attributes | |
static constexpr size_t | IO_BUF_DEFAULT_SIZE = 10 * 1024 |
SSL/TLS Client
Definition at line 28 of file tls_client.h.
Botan::TLS::Client::Client | ( | 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() , |
||
Protocol_Version | offer_version = Protocol_Version::latest_tls_version() , |
||
const std::vector< std::string > & | next_protocols = {} , |
||
size_t | reserved_io_buffer_size = TLS::Client::IO_BUF_DEFAULT_SIZE |
||
) |
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 |
offer_version | specifies which version we will offer to the TLS server. |
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 30 of file tls_client.cpp.
References BOTAN_ARG_CHECK, and Botan::TLS::Protocol_Version::is_datagram_protocol().
|
overridedefault |
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 164 of file tls_client.cpp.
|
overridevirtual |
Send a close notification alert
Implements Botan::TLS::Channel.
Definition at line 156 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 120 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 90 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 100 of file tls_client.cpp.
|
overridevirtual |
Note: For TLS 1.3 a connection is closed only after both peers have signaled a "close_notify". While TLS 1.2 automatically responded in suit once the peer had sent "close_notify", TLS 1.3 allows to continue transmitting data even if the peer closed their writing end.
Implements Botan::TLS::Channel.
Definition at line 104 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 108 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 112 of file tls_client.cpp.
|
overridevirtual |
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.
Definition at line 124 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 116 of file tls_client.cpp.
|
inlineinherited |
Definition at line 48 of file tls_channel.h.
|
inlineinherited |
Inject TLS traffic received from counterparty
Definition at line 46 of file tls_channel.h.
|
overridevirtual |
Attempt to renegotiate the session
force_full_renegotiation | if true, require a full renegotiation, otherwise allow session resumption |
Implements Botan::TLS::Channel.
Definition at line 128 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 136 of file tls_client.cpp.
|
inlineinherited |
Definition at line 56 of file tls_channel.h.
|
inlineinherited |
Inject plaintext intended for counterparty Throws an exception if is_active() is false
Definition at line 54 of file tls_channel.h.
|
inlineinherited |
Inject plaintext intended for counterparty Throws an exception if is_active() is false
Definition at line 62 of file tls_channel.h.
References Botan::cast_char_ptr_to_uint8(), and Botan::TLS::Channel::send().
Referenced by Botan::TLS::Channel::send().
|
overridevirtual |
Inject plaintext intended for counterparty Throws an exception if is_active() is false 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.
Definition at line 144 of file tls_client.cpp.
|
overridevirtual |
Send a fatal alert
Implements Botan::TLS::Channel.
Definition at line 152 of file tls_client.cpp.
|
overridevirtual |
Send a warning alert
Implements Botan::TLS::Channel.
Definition at line 148 of file tls_client.cpp.
|
overridevirtual |
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.
Definition at line 160 of file tls_client.cpp.
|
overridevirtual |
Implements Botan::TLS::Channel.
Definition at line 140 of file tls_client.cpp.
|
overridevirtual |
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.
Definition at line 132 of file tls_client.cpp.
|
staticconstexprinherited |
Definition at line 32 of file tls_channel.h.
Referenced by Botan::TLS::Channel_Impl_13::expect_downgrade().