9#include <botan/internal/tls_server_impl_12.h>
11#include <botan/certstor.h>
12#include <botan/ocsp.h>
13#include <botan/tls_callbacks.h>
14#include <botan/tls_magic.h>
15#include <botan/tls_messages_12.h>
16#include <botan/tls_policy.h>
17#include <botan/tls_version.h>
18#include <botan/internal/ct_utils.h>
19#include <botan/internal/stl_util.h>
20#include <botan/internal/tls_handshake_state.h>
21#include <botan/internal/tls_messages_internal.h>
22#include <unordered_set>
28 Server_Handshake_State(std::unique_ptr<Handshake_IO> io, Callbacks& cb) :
Handshake_State(std::move(io), cb) {}
30 Private_Key* server_rsa_kex_key() {
return m_server_rsa_kex_key.get(); }
32 void set_server_rsa_kex_key(std::shared_ptr<Private_Key> key) { m_server_rsa_kex_key = std::move(key); }
34 bool allow_session_resumption()
const {
return m_allow_session_resumption; }
36 void set_allow_session_resumption(
bool allow_session_resumption) {
37 m_allow_session_resumption = allow_session_resumption;
40 const std::vector<X509_Certificate>& resume_peer_certs()
const {
return m_resume_peer_certs; }
42 void set_resume_certs(
const std::vector<X509_Certificate>& certs) { m_resume_peer_certs = certs; }
44 void mark_as_resumption() { m_is_a_resumption =
true; }
46 bool is_a_resumption()
const {
return m_is_a_resumption; }
49 if(!m_resume_peer_certs.empty()) {
50 return m_resume_peer_certs;
60 std::shared_ptr<Private_Key> m_server_rsa_kex_key;
66 bool m_allow_session_resumption =
true;
68 bool m_is_a_resumption =
false;
70 std::vector<X509_Certificate> m_resume_peer_certs;
75std::optional<Session> check_for_resume(
const Session_Handle& handle_to_resume,
80 auto session = session_manager.retrieve(handle_to_resume, cb, policy);
81 if(!session.has_value()) {
86 if(client_hello->legacy_version() != session->version()) {
91 if(!
value_exists(client_hello->ciphersuites(), session->ciphersuite_code())) {
96 if(!client_hello->sni_hostname().empty() && client_hello->sni_hostname() != session->server_info().hostname()) {
101 if(client_hello->supports_extended_master_secret() != session->supports_extended_master_secret()) {
102 if(!session->supports_extended_master_secret()) {
109 throw TLS_Exception(Alert::HandshakeFailure,
"Client resumed extended ms session without sending extension");
114 if(!client_hello->supports_encrypt_then_mac() && session->supports_encrypt_then_mac()) {
119 throw TLS_Exception(Alert::HandshakeFailure,
"Client resumed Encrypt-then-MAC session without sending extension");
128uint16_t choose_ciphersuite(
const Policy& policy,
130 const std::map<std::string, std::vector<X509_Certificate>>& cert_chains,
132 const bool our_choice = policy.server_uses_own_ciphersuite_preferences();
133 const std::vector<uint16_t>& client_suites = client_hello.ciphersuites();
134 const std::vector<uint16_t> server_suites = policy.ciphersuite_list(version);
136 if(server_suites.empty()) {
137 throw TLS_Exception(Alert::HandshakeFailure,
"Policy forbids us from negotiating any ciphersuite");
140 const bool have_shared_ecc_curve =
141 (policy.choose_key_exchange_group(client_hello.supported_ecc_curves(), {}) != Group_Params::NONE);
143 const bool client_supports_ffdhe_groups = !client_hello.supported_dh_groups().empty();
145 const bool have_shared_dh_group =
146 (policy.choose_key_exchange_group(client_hello.supported_dh_groups(), {}) != Group_Params::NONE);
148 const std::unordered_set<uint16_t> client_suite_set(client_suites.begin(), client_suites.end());
150 const std::vector<Signature_Scheme> allowed_sig_schemes = policy.allowed_signature_schemes();
151 const std::vector<Signature_Scheme> client_sig_methods = client_hello.signature_schemes();
155 const std::unordered_set<std::string> client_sig_algs = [&] {
156 std::unordered_set<uint16_t> allowed_codes;
157 allowed_codes.reserve(allowed_sig_schemes.size());
158 for(
auto s : allowed_sig_schemes) {
159 allowed_codes.insert(
static_cast<uint16_t
>(s.wire_code()));
161 std::unordered_set<std::string> result;
163 if(!scheme.is_available()) {
166 if(!allowed_codes.contains(
static_cast<uint16_t
>(scheme.wire_code()))) {
169 if(!policy.allowed_signature_hash(scheme.hash_function_name())) {
172 result.insert(scheme.algorithm_name());
180 const std::vector<uint16_t>& pref_list = our_choice ? server_suites : client_suites;
182 auto in_other_list = [&](uint16_t suite_id) {
184 return our_choice ? client_suite_set.contains(suite_id) :
value_exists(server_suites, suite_id);
187 for(
auto suite_id : pref_list) {
188 if(!in_other_list(suite_id)) {
194 if(!suite.has_value() || !suite->valid()) {
198 if(have_shared_ecc_curve ==
false && suite->ecc_ciphersuite()) {
202 if(suite->kex_method() ==
Kex_Algo::DH && client_supports_ffdhe_groups && !have_shared_dh_group) {
207 if(suite->is_certificate_required()) {
208 const std::string cert_algo = suite->signature_used() ? suite->sig_algo() :
"RSA";
211 if(!cert_chains.contains(cert_algo)) {
216 if(suite->signature_used()) {
223 if(!client_sig_algs.contains(suite->sig_algo())) {
237 if(client_supports_ffdhe_groups && !have_shared_dh_group) {
238 throw TLS_Exception(Alert::InsufficientSecurity,
"Can't agree on a sufficiently strong ciphersuite with client");
241 throw TLS_Exception(Alert::HandshakeFailure,
"Can't agree on a ciphersuite with client");
244std::map<std::string, std::vector<X509_Certificate>> get_server_certs(
245 std::string_view hostname,
const std::vector<Signature_Scheme>& cert_sig_schemes, Credentials_Manager& creds) {
246 const std::vector<std::string> cert_types = {
"RSA",
"ECDSA"};
248 std::map<std::string, std::vector<X509_Certificate>> cert_chains;
250 for(
const auto& cert_type : cert_types) {
251 const std::vector<X509_Certificate> certs = creds.cert_chain_single_type(
255 cert_chains[cert_type] = certs;
266 const std::shared_ptr<Credentials_Manager>& creds,
267 const std::shared_ptr<const Policy>&
policy,
268 const std::shared_ptr<RandomNumberGenerator>&
rng,
282 downgrade_info.io_buffer_size),
283 m_creds(downgrade_info.creds) {}
285std::unique_ptr<Handshake_State> Server_Impl_12::new_handshake_state(std::unique_ptr<Handshake_IO> io) {
286 auto state = std::make_unique<Server_Handshake_State>(std::move(io),
callbacks());
294void Server_Impl_12::initiate_handshake(Handshake_State& state,
bool force_full_renegotiation) {
295 dynamic_cast<Server_Handshake_State&
>(state).set_allow_session_resumption(!force_full_renegotiation);
297 const Hello_Request hello_req(state.handshake_io());
302Protocol_Version select_version(
const TLS::Policy& policy,
303 Protocol_Version client_offer,
304 Protocol_Version active_version,
305 const std::vector<Protocol_Version>& supported_versions) {
306 const bool is_datagram = client_offer.is_datagram_protocol();
307 const bool initial_handshake = (active_version.valid() ==
false);
309 if(!supported_versions.empty()) {
311 if(policy.allow_dtls12() &&
value_exists(supported_versions, Protocol_Version(Protocol_Version::DTLS_V12))) {
312 return Protocol_Version::DTLS_V12;
314 throw TLS_Exception(Alert::ProtocolVersion,
"No shared DTLS version");
317 return Protocol_Version::TLS_V12;
319 throw TLS_Exception(Alert::ProtocolVersion,
"No shared TLS version");
323 if(!initial_handshake) {
331 if(active_version > client_offer) {
333 Alert::ProtocolVersion,
334 "Client negotiated " + active_version.to_string() +
" then renegotiated with " + client_offer.to_string());
336 return active_version;
341 if(policy.allow_dtls12() && client_offer >= Protocol_Version::DTLS_V12) {
342 return Protocol_Version::DTLS_V12;
345 if(policy.allow_tls12() && client_offer >= Protocol_Version::TLS_V12) {
346 return Protocol_Version::TLS_V12;
351 "Client version " + client_offer.to_string() +
" is unacceptable by policy");
358void Server_Impl_12::process_client_hello_msg(Server_Handshake_State& pending_state,
359 const std::vector<uint8_t>& contents,
360 bool epoch0_restart) {
363 const bool initial_handshake = epoch0_restart || !
active_state().has_value();
365 if(initial_handshake ==
false &&
policy().allow_client_initiated_renegotiation() ==
false) {
366 if(
policy().abort_connection_on_undesired_renegotiation()) {
367 throw TLS_Exception(Alert::NoRenegotiation,
"Server policy prohibits renegotiation");
379 if(pending_state.handshake_io().have_more_data()) {
380 throw TLS_Exception(Alert::UnexpectedMessage,
"Have data remaining in buffer after ClientHello");
383 pending_state.client_hello(std::make_unique<Client_Hello_12>(contents));
384 const Protocol_Version client_offer = pending_state.client_hello()->legacy_version();
385 const bool datagram = client_offer.is_datagram_protocol();
388 if(client_offer.major_version() == 0xFF) {
389 throw TLS_Exception(Alert::ProtocolVersion,
"Client offered DTLS version with major version 0xFF");
392 if(client_offer.major_version() < 3) {
393 throw TLS_Exception(Alert::ProtocolVersion,
"Client offered TLS version with major version under 3");
395 if(client_offer.major_version() == 3 && client_offer.minor_version() == 0) {
396 throw TLS_Exception(Alert::ProtocolVersion,
"Client offered SSLv3 which is not supported");
410 const Protocol_Version negotiated_version =
414 pending_state.client_hello()->supported_versions());
416 pending_state.set_version(negotiated_version);
418 const auto compression_methods = pending_state.client_hello()->compression_methods();
420 throw TLS_Exception(Alert::IllegalParameter,
"Client did not offer NULL compression");
423 if(initial_handshake && datagram) {
427 cookie_secret = m_creds->psk(
"tls-server",
"dtls-cookie-secret",
"");
430 if(!cookie_secret.empty()) {
432 const Hello_Verify_Request verify(
433 pending_state.client_hello()->cookie_input_data(), client_identity, cookie_secret);
437 pending_state.handshake_io().send_under_epoch(verify, 0);
439 pending_state.handshake_io().send(verify);
442 pending_state.client_hello(
nullptr);
446 }
else if(epoch0_restart) {
447 throw TLS_Exception(Alert::HandshakeFailure,
"Reuse of DTLS association requires DTLS cookie secret be set");
459 if(
policy().require_extended_master_secret() && !pending_state.client_hello()->supports_extended_master_secret()) {
460 throw TLS_Exception(Alert::HandshakeFailure,
461 "Policy requires the Extended Master Secret extension but the client did not send it");
474 const bool ems_pending = pending_state.client_hello()->supports_extended_master_secret();
475 if(active->supports_extended_master_secret() ==
true && ems_pending ==
false) {
476 throw TLS_Exception(Alert::HandshakeFailure,
477 "Renegotiation ClientHello dropped the Extended Master Secret extension");
484 const auto session_handle = pending_state.client_hello()->session_handle();
486 std::optional<Session> session_info;
487 if(pending_state.allow_session_resumption() && session_handle.has_value()) {
488 session_info = check_for_resume(
492 m_next_protocol =
"";
493 if(pending_state.client_hello()->supports_alpn()) {
494 const auto offered = pending_state.client_hello()->next_protocols();
499 if(!m_next_protocol.empty() && !
value_exists(offered, m_next_protocol)) {
500 throw TLS_Exception(Alert::InternalError,
"Application chose an ALPN protocol that the client did not offer");
504 if(session_info.has_value()) {
505 this->session_resume(pending_state, {session_info.value(), session_handle.value()});
508 this->session_create(pending_state);
512void Server_Impl_12::process_certificate_msg(Server_Handshake_State& pending_state,
513 const std::vector<uint8_t>& contents) {
514 pending_state.client_certs(std::make_unique<Certificate_12>(contents,
policy()));
517 if(pending_state.client_certs()->empty() &&
policy().require_client_certificate_authentication()) {
518 throw TLS_Exception(Alert::HandshakeFailure,
"Policy requires client send a certificate, but it did not");
524void Server_Impl_12::process_client_key_exchange_msg(Server_Handshake_State& pending_state,
525 const std::vector<uint8_t>& contents) {
532 pending_state.client_kex(std::make_unique<Client_Key_Exchange>(
533 contents, pending_state, pending_state.server_rsa_kex_key(), *m_creds,
policy(),
rng()));
535 pending_state.compute_session_keys();
536 if(
policy().allow_ssl_key_log_file()) {
542 "CLIENT_RANDOM", pending_state.client_hello()->random(), pending_state.session_keys().master_secret());
546void Server_Impl_12::process_change_cipher_spec_msg(Server_Handshake_State& pending_state) {
551void Server_Impl_12::process_certificate_verify_msg(Server_Handshake_State& pending_state,
553 const std::vector<uint8_t>& contents) {
554 pending_state.client_verify(std::make_unique<Certificate_Verify_12>(contents));
556 const std::vector<X509_Certificate>& client_certs = pending_state.client_certs()->cert_chain();
558 if(client_certs.empty()) {
559 throw TLS_Exception(Alert::DecodeError,
"No client certificate sent");
562 const auto cert_constraints = client_certs[0].constraints();
563 if(!cert_constraints.empty()) {
565 throw TLS_Exception(Alert::BadCertificate,
"Client certificate does not support signing");
569 const bool sig_valid = pending_state.client_verify()->verify(client_certs[0], pending_state,
policy());
571 pending_state.hash().update(pending_state.handshake_io().format(contents, type));
579 throw TLS_Exception(Alert::DecryptError,
"Client cert verify failed");
583 const std::string sni_hostname = pending_state.client_hello()->sni_hostname();
584 auto trusted_CAs = m_creds->trusted_certificate_authorities(
"tls-server", sni_hostname);
592 }
catch(std::exception& e) {
593 throw TLS_Exception(Alert::BadCertificate, e.what());
599void Server_Impl_12::process_finished_msg(Server_Handshake_State& pending_state,
601 const std::vector<uint8_t>& contents) {
604 if(pending_state.handshake_io().have_more_data()) {
605 throw TLS_Exception(Alert::UnexpectedMessage,
"Have data remaining in buffer after Finished");
608 pending_state.client_finished(std::make_unique<Finished_12>(contents));
611 throw TLS_Exception(Alert::DecryptError,
"Finished message didn't verify");
614 if(pending_state.server_finished() ==
nullptr) {
617 pending_state.hash().update(pending_state.handshake_io().format(contents, type));
619 Session session_info(pending_state.session_keys().master_secret(),
620 pending_state.server_hello()->legacy_version(),
621 pending_state.server_hello()->ciphersuite(),
623 pending_state.server_hello()->supports_extended_master_secret(),
624 pending_state.server_hello()->supports_encrypt_then_mac(),
625 pending_state.peer_cert_chain(),
626 Server_Information(pending_state.client_hello()->sni_hostname()),
627 pending_state.server_hello()->srtp_profile(),
634 summary.set_session_id(pending_state.server_hello()->session_id());
638 if(
callbacks().tls_should_persist_resumption_information(session_info)) {
640 pending_state.server_hello()->session_id(),
641 !pending_state.server_hello()->supports_session_ticket());
643 if(pending_state.server_hello()->supports_session_ticket() && handle.has_value() && handle->is_ticket()) {
644 pending_state.new_session_ticket(std::make_unique<New_Session_Ticket_12>(
645 pending_state.handshake_io(),
646 pending_state.hash(),
647 handle->ticket().value(),
648 static_cast<uint32_t
>(
policy().session_ticket_lifetime().count())));
652 if(pending_state.new_session_ticket() ==
nullptr && pending_state.server_hello()->supports_session_ticket()) {
653 pending_state.new_session_ticket(
654 std::make_unique<New_Session_Ticket_12>(pending_state.handshake_io(), pending_state.hash()));
657 pending_state.handshake_io().send(Change_Cipher_Spec());
661 pending_state.server_finished(
673 const std::vector<uint8_t>& contents,
674 bool epoch0_restart) {
675 Server_Handshake_State& state =
dynamic_cast<Server_Handshake_State&
>(state_base);
676 state.confirm_transition_to(type);
687 state.hash().update(state.handshake_io().format(contents, type));
692 return this->process_client_hello_msg(state, contents, epoch0_restart);
695 return this->process_certificate_msg(state, contents);
698 return this->process_client_key_exchange_msg(state, contents);
701 return this->process_certificate_verify_msg(state, type, contents);
704 return this->process_change_cipher_spec_msg(state);
707 return this->process_finished_msg(state, type, contents);
710 throw Unexpected_Message(
"Unknown handshake message received");
714void Server_Impl_12::session_resume(Server_Handshake_State& pending_state,
const Session_with_Handle& session) {
718 const bool offer_new_session_ticket = pending_state.client_hello()->supports_session_ticket() &&
719 pending_state.client_hello()->session_ticket().empty() &&
722 pending_state.server_hello(std::make_unique<Server_Hello_12>(pending_state.handshake_io(),
723 pending_state.hash(),
728 *pending_state.client_hello(),
730 offer_new_session_ticket,
735 pending_state.mark_as_resumption();
736 pending_state.compute_session_keys(session.session.master_secret());
737 if(
policy().allow_ssl_key_log_file()) {
743 "CLIENT_RANDOM", pending_state.client_hello()->random(), pending_state.session_keys().master_secret());
745 pending_state.set_resume_certs(session.session.peer_certs());
751 summary.set_session_id(pending_state.server_hello()->session_id());
752 if(
auto ticket = session.handle.ticket()) {
753 summary.set_session_ticket(std::move(ticket.value()));
758 auto new_handle = [&,
this]() -> std::optional<Session_Handle> {
759 if(!
callbacks().tls_should_persist_resumption_information(session.session)) {
767 if(pending_state.server_hello()->supports_session_ticket()) {
768 if(new_handle.has_value() && new_handle->is_ticket()) {
770 pending_state.new_session_ticket(std::make_unique<New_Session_Ticket_12>(
771 pending_state.handshake_io(), pending_state.hash(), new_handle->ticket().value(), lifetime));
773 pending_state.new_session_ticket(
774 std::make_unique<New_Session_Ticket_12>(pending_state.handshake_io(), pending_state.hash()));
778 pending_state.handshake_io().send(Change_Cipher_Spec());
782 pending_state.server_finished(
787void Server_Impl_12::session_create(Server_Handshake_State& pending_state) {
788 std::map<std::string, std::vector<X509_Certificate>> cert_chains;
790 const std::string sni_hostname = pending_state.client_hello()->sni_hostname();
798 const auto cert_signature_schemes = pending_state.client_hello()->certificate_signature_schemes();
799 cert_chains = get_server_certs(sni_hostname, cert_signature_schemes, *m_creds);
801 if(!sni_hostname.empty() && cert_chains.empty()) {
802 cert_chains = get_server_certs(
"", cert_signature_schemes, *m_creds);
811 if(!cert_chains.empty()) {
816 const uint16_t ciphersuite =
817 choose_ciphersuite(
policy(), pending_state.version(), cert_chains, *pending_state.client_hello());
820 pending_state.version(),
824 pending_state.server_hello(std::make_unique<Server_Hello_12>(pending_state.handshake_io(),
825 pending_state.hash(),
830 *pending_state.client_hello(),
836 const Ciphersuite& pending_suite = pending_state.ciphersuite();
838 std::shared_ptr<Private_Key> private_key;
840 if(pending_suite.is_certificate_required()) {
841 const std::string algo_used = pending_suite.signature_used() ? pending_suite.sig_algo() :
"RSA";
843 BOTAN_ASSERT(!cert_chains[algo_used].empty(),
"Attempting to send empty certificate chain");
845 pending_state.server_certs(
846 std::make_unique<Certificate_12>(pending_state.handshake_io(), pending_state.hash(), cert_chains[algo_used]));
848 if(pending_state.client_hello()->supports_cert_status_message() && pending_state.is_a_resumption() ==
false) {
849 auto* csr = pending_state.client_hello()->extensions().get<Certificate_Status_Request>();
853 if(!resp_bytes.empty()) {
854 pending_state.server_cert_status(
855 std::make_unique<Certificate_Status_12>(pending_state.handshake_io(), pending_state.hash(), resp_bytes));
859 private_key = m_creds->private_key_for(pending_state.server_certs()->cert_chain()[0],
"tls-server", sni_hostname);
862 throw Internal_Error(
"No private key located for associated server cert");
867 pending_state.set_server_rsa_kex_key(private_key);
869 pending_state.server_kex(std::make_unique<Server_Key_Exchange>(
870 pending_state.handshake_io(), pending_state,
policy(), *m_creds,
rng(), private_key.get()));
873 auto trusted_CAs = m_creds->trusted_certificate_authorities(
"tls-server", sni_hostname);
875 std::vector<X509_DN> client_auth_CAs;
877 for(
auto* store : trusted_CAs) {
878 auto subjects = store->all_subjects();
879 client_auth_CAs.insert(client_auth_CAs.end(), subjects.begin(), subjects.end());
889 if(request_cert && can_request_cert && pending_state.ciphersuite().is_certificate_required()) {
890 pending_state.cert_req(std::make_unique<Certificate_Request_12>(
891 pending_state.handshake_io(), pending_state.hash(),
policy(), client_auth_CAs));
903 pending_state.server_hello_done(
904 std::make_unique<Server_Hello_Done>(pending_state.handshake_io(), pending_state.hash()));
#define BOTAN_ASSERT_NOMSG(expr)
#define BOTAN_ASSERT_NONNULL(ptr)
#define BOTAN_ASSERT_IMPLICATION(expr1, expr2, msg)
#define BOTAN_ASSERT(expr, assertion_made)
virtual std::vector< uint8_t > tls_provide_cert_status(const std::vector< X509_Certificate > &chain, const Certificate_Status_Request &csr)
virtual std::string tls_peer_network_identity()
virtual std::string tls_server_choose_app_protocol(const std::vector< std::string > &client_protos)
virtual void tls_examine_extensions(const Extensions &extn, Connection_Side which_side, Handshake_Type which_message)
virtual void tls_session_established(const Session_Summary &session)
virtual void tls_verify_cert_chain(const std::vector< X509_Certificate > &cert_chain, const std::vector< std::optional< OCSP::Response > > &ocsp_responses, const std::vector< Certificate_Store * > &trusted_roots, Usage_Type usage, std::string_view hostname, const TLS::Policy &policy)
virtual void tls_ssl_key_log_data(std::string_view label, std::span< const uint8_t > client_random, std::span< const uint8_t > secret) const
const std::vector< X509_Certificate > & cert_chain() const
RandomNumberGenerator & rng()
void change_cipher_spec_reader(Connection_Side side)
std::vector< uint8_t > secure_renegotiation_data_for_server_hello() const
Callbacks & callbacks() const
void secure_renegotiation_check(const Client_Hello_12 *client_hello)
Session_Manager & session_manager()
const Policy & policy() const
void change_cipher_spec_writer(Connection_Side side)
Channel_Impl_12(const std::shared_ptr< Callbacks > &callbacks, const std::shared_ptr< Session_Manager > &session_manager, const std::shared_ptr< RandomNumberGenerator > &rng, const std::shared_ptr< const Policy > &policy, bool is_server, bool is_datagram, size_t io_buf_sz=TLS::Channel::IO_BUF_DEFAULT_SIZE)
const std::optional< Active_Connection_State_12 > & active_state() const
std::optional< std::string > external_psk_identity() const override
void reset_active_association_state()
bool secure_renegotiation_supported() const override
void send_warning_alert(Alert::Type type)
static std::optional< Ciphersuite > by_id(uint16_t suite)
Handshake_State(std::unique_ptr< Handshake_IO > io, Callbacks &callbacks)
const Certificate_12 * client_certs() const
virtual std::vector< X509_Certificate > peer_cert_chain() const =0
virtual bool request_client_certificate_authentication() const
virtual std::vector< Signature_Scheme > acceptable_signature_schemes() const
virtual std::chrono::seconds session_ticket_lifetime() const
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)
Helper class to embody a session handle in all protocol versions.
virtual size_t remove(const Session_Handle &handle)=0
virtual std::optional< Session_Handle > establish(const Session &session, const std::optional< Session_ID > &id=std::nullopt, bool tls12_no_ticket=false)
Save a new Session and assign a Session_Handle (TLS Server).
virtual bool emits_session_tickets()
constexpr CT::Mask< T > is_equal(const T x[], const T y[], size_t len)
std::vector< AlgorithmIdentifier > to_algorithm_identifiers(const std::vector< Signature_Scheme > &schemes)
std::vector< uint8_t > make_hello_random(RandomNumberGenerator &rng, Callbacks &cb, const Policy &policy)
Strong< std::vector< uint8_t >, struct Session_ID_ > Session_ID
holds a TLS 1.2 session ID for stateful resumption
bool value_exists(const std::vector< T > &vec, const V &val)