Botan 3.13.0
Crypto and TLS for C&
Botan::TLS::Channel_Impl Class Referenceabstract

#include <tls_channel_impl.h>

Inheritance diagram for Botan::TLS::Channel_Impl:
Botan::TLS::Channel_Impl_12 Botan::TLS::Channel_Impl_13 Botan::TLS::Client_Impl_12 Botan::TLS::Server_Impl_12 Botan::TLS::Client_Impl_13 Botan::TLS::Server_Impl_13

Public Member Functions

virtual std::string application_protocol () const =0
 Channel_Impl (Channel_Impl &&other)=default
 Channel_Impl (const Channel_Impl &other)=delete
void close ()
virtual std::optional< std::string > external_psk_identity () const =0
virtual size_t from_peer (std::span< const uint8_t > data)=0
virtual bool is_active () const =0
virtual bool is_closed () const =0
virtual bool is_closed_for_reading () const =0
virtual bool is_closed_for_writing () const =0
virtual bool is_handshake_complete () const =0
virtual SymmetricKey key_material_export (std::string_view label, std::string_view context, size_t length) const =0
virtual bool new_session_ticket_supported () const
virtual std::optional< std::chrono::milliseconds > next_retransmission_timeout () const
Channel_Imploperator= (Channel_Impl &&other)=delete
Channel_Imploperator= (const Channel_Impl &other)=delete
virtual std::vector< X509_Certificatepeer_cert_chain () const =0
virtual std::shared_ptr< const Public_Keypeer_raw_public_key () const =0
virtual void renegotiate (bool force_full_renegotiation=false)=0
virtual bool secure_renegotiation_supported () const =0
virtual void send_alert (const Alert &alert)=0
void send_fatal_alert (Alert::Type type)
virtual size_t send_new_session_tickets (const size_t)
void send_warning_alert (Alert::Type type)
virtual bool timeout_check ()=0
virtual void to_peer (std::span< const uint8_t > data)=0
virtual void update_traffic_keys (bool request_peer_update=false)=0
virtual ~Channel_Impl ()=default

Protected Member Functions

 Channel_Impl ()=default
bool expects_downgrade () const
bool is_downgrading () const

Detailed Description

Definition at line 38 of file tls_channel_impl.h.

Constructor & Destructor Documentation

◆ ~Channel_Impl()

virtual Botan::TLS::Channel_Impl::~Channel_Impl ( )
virtualdefault

◆ Channel_Impl() [1/3]

Botan::TLS::Channel_Impl::Channel_Impl ( const Channel_Impl & other)
delete

◆ Channel_Impl() [2/3]

Botan::TLS::Channel_Impl::Channel_Impl ( Channel_Impl && other)
default

References Channel_Impl().

◆ Channel_Impl() [3/3]

Botan::TLS::Channel_Impl::Channel_Impl ( )
protecteddefault

Member Function Documentation

◆ application_protocol()

virtual std::string Botan::TLS::Channel_Impl::application_protocol ( ) const
pure virtual

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.

Implemented in Botan::TLS::Client_Impl_12, Botan::TLS::Client_Impl_13, and Botan::TLS::Server_Impl_13.

Referenced by Botan::TLS::Channel_Impl_12::activate_session().

◆ close()

void Botan::TLS::Channel_Impl::close ( )
inline

Send a close notification alert

Definition at line 80 of file tls_channel_impl.h.

80{ send_warning_alert(Alert::CloseNotify); }
void send_warning_alert(Alert::Type type)

References send_warning_alert().

◆ expects_downgrade()

bool Botan::TLS::Channel_Impl::expects_downgrade ( ) const
inlineprotected

Definition at line 290 of file tls_channel_impl.h.

290 {
291#if defined(BOTAN_HAS_TLS_DOWNGRADE_SUPPORT)
292 return m_downgrade_info != nullptr;
293#else
294 return false;
295#endif
296 }

Referenced by Botan::TLS::Client_Impl_13::Client_Impl_13(), and Botan::TLS::Channel_Impl_13::from_peer().

◆ external_psk_identity()

virtual std::optional< std::string > Botan::TLS::Channel_Impl::external_psk_identity ( ) const
pure virtual
Returns
identity of the PSK used for this connection or std::nullopt if no PSK was used.

Implemented in Botan::TLS::Channel_Impl_12, Botan::TLS::Client_Impl_13, and Botan::TLS::Server_Impl_13.

◆ from_peer()

virtual size_t Botan::TLS::Channel_Impl::from_peer ( std::span< const uint8_t > data)
pure virtual

Inject TLS traffic received from counterparty

Returns
a hint as the how many more bytes we need to q the current record (this may be 0 if on a record boundary)

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ is_active()

virtual bool Botan::TLS::Channel_Impl::is_active ( ) const
pure virtual
Returns
true iff the connection is active for sending application data

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ is_closed()

virtual bool Botan::TLS::Channel_Impl::is_closed ( ) const
pure virtual
Returns
true iff the connection has been definitely closed

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ is_closed_for_reading()

virtual bool Botan::TLS::Channel_Impl::is_closed_for_reading ( ) const
pure virtual
Returns
true iff the connection is active for sending application data

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ is_closed_for_writing()

virtual bool Botan::TLS::Channel_Impl::is_closed_for_writing ( ) const
pure virtual
Returns
true iff the connection has been definitely closed

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ is_downgrading()

bool Botan::TLS::Channel_Impl::is_downgrading ( ) const
inlineprotected

Indicates whether a downgrade to TLS 1.2 or lower is in progress

See also
Downgrade_Information

Definition at line 282 of file tls_channel_impl.h.

282 {
283#if defined(BOTAN_HAS_TLS_DOWNGRADE_SUPPORT)
284 return m_downgrade_info && m_downgrade_info->will_downgrade;
285#else
286 return false;
287#endif
288 }

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().

◆ is_handshake_complete()

virtual bool Botan::TLS::Channel_Impl::is_handshake_complete ( ) const
pure virtual

◆ key_material_export()

virtual SymmetricKey Botan::TLS::Channel_Impl::key_material_export ( std::string_view label,
std::string_view context,
size_t length ) const
pure virtual

Key material export (RFC 5705)

Parameters
labela disambiguating label string
contexta per-association context value
lengththe length of the desired key in bytes
Returns
key of length bytes

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ new_session_ticket_supported()

virtual bool Botan::TLS::Channel_Impl::new_session_ticket_supported ( ) const
inlinevirtual
Returns
true if this channel can issue TLS 1.3 style session tickets.

Reimplemented in Botan::TLS::Server_Impl_13.

Definition at line 146 of file tls_channel_impl.h.

146{ return false; }

◆ next_retransmission_timeout()

virtual std::optional< std::chrono::milliseconds > Botan::TLS::Channel_Impl::next_retransmission_timeout ( ) const
inlinevirtual

Reimplemented in Botan::TLS::Channel_Impl_12.

Definition at line 92 of file tls_channel_impl.h.

92{ return std::nullopt; }

◆ operator=() [1/2]

Channel_Impl & Botan::TLS::Channel_Impl::operator= ( Channel_Impl && other)
delete

References Channel_Impl().

◆ operator=() [2/2]

Channel_Impl & Botan::TLS::Channel_Impl::operator= ( const Channel_Impl & other)
delete

References Channel_Impl().

◆ peer_cert_chain()

virtual std::vector< X509_Certificate > Botan::TLS::Channel_Impl::peer_cert_chain ( ) const
pure virtual
Returns
certificate chain of the peer (may be empty)

Implemented in Botan::TLS::Channel_Impl_12, Botan::TLS::Client_Impl_13, and Botan::TLS::Server_Impl_13.

◆ peer_raw_public_key()

virtual std::shared_ptr< const Public_Key > Botan::TLS::Channel_Impl::peer_raw_public_key ( ) const
pure virtual
Returns
raw public key of the peer (may be nullptr)

Implemented in Botan::TLS::Channel_Impl_12, Botan::TLS::Client_Impl_13, and Botan::TLS::Server_Impl_13.

◆ renegotiate()

virtual void Botan::TLS::Channel_Impl::renegotiate ( bool force_full_renegotiation = false)
pure virtual

Attempt to renegotiate the session

Parameters
force_full_renegotiationif true, require a full renegotiation, otherwise allow session resumption

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ secure_renegotiation_supported()

virtual bool Botan::TLS::Channel_Impl::secure_renegotiation_supported ( ) const
pure virtual
Returns
true iff the counterparty supports the secure renegotiation extensions.

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ send_alert()

virtual void Botan::TLS::Channel_Impl::send_alert ( const Alert & alert)
pure virtual

Send a TLS alert message. If the alert is fatal, the internal state (keys, etc) will be reset.

Parameters
alertthe Alert to send

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

Referenced by send_fatal_alert(), and send_warning_alert().

◆ send_fatal_alert()

void Botan::TLS::Channel_Impl::send_fatal_alert ( Alert::Type type)
inline

Send a fatal alert

Definition at line 75 of file tls_channel_impl.h.

75{ send_alert(Alert(type, true)); }
virtual void send_alert(const Alert &alert)=0

References Botan::TLS::Alert, and send_alert().

Referenced by Botan::TLS::Channel_Impl_12::from_peer(), and Botan::TLS::Channel_Impl_13::from_peer().

◆ send_new_session_tickets()

virtual size_t Botan::TLS::Channel_Impl::send_new_session_tickets ( const size_t )
inlinevirtual

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).

Returns
the number of session tickets successfully sent to the client

Reimplemented in Botan::TLS::Server_Impl_13.

Definition at line 159 of file tls_channel_impl.h.

159{ return 0; }

◆ send_warning_alert()

void Botan::TLS::Channel_Impl::send_warning_alert ( Alert::Type type)
inline

Send a warning alert

Definition at line 70 of file tls_channel_impl.h.

70{ send_alert(Alert(type, false)); }

References Botan::TLS::Alert, and send_alert().

Referenced by close().

◆ timeout_check()

virtual bool Botan::TLS::Channel_Impl::timeout_check ( )
pure virtual

Perform a handshake timeout check. This does nothing unless this is a DTLS channel with a handshake in progress.

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ to_peer()

virtual void Botan::TLS::Channel_Impl::to_peer ( std::span< const uint8_t > data)
pure virtual

Inject plaintext intended for counterparty Throws an exception if is_active() is false

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.

◆ update_traffic_keys()

virtual void Botan::TLS::Channel_Impl::update_traffic_keys ( bool request_peer_update = false)
pure virtual

Attempt to update the session's traffic key material Note that this is possible with a TLS 1.3 channel, only.

Parameters
request_peer_updateif true, require a reciprocal key update

Implemented in Botan::TLS::Channel_Impl_12, and Botan::TLS::Channel_Impl_13.


The documentation for this class was generated from the following file: