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;
265 return creds.psk(
"tls-server",
"dtls-cookie-secret",
"").bits_of();
271 if(cookie_secret.empty()) {
275 "Since Botan 3.13 DTLS server requires setting a non-empty cookie secret. "
276 "Either override Credentials_Manager::dtls_cookie_secret() or disable the "
277 "cookie exchange using TLS::Policy::dtls_server_require_cookie_exchange(), "
278 "if you understand the security implications of doing so.");
281 return cookie_secret;
288 const std::shared_ptr<Credentials_Manager>& creds,
289 const std::shared_ptr<const Policy>&
policy,
290 const std::shared_ptr<RandomNumberGenerator>&
rng,
298 if(is_datagram &&
policy->dtls_server_require_cookie_exchange()) {
299 load_dtls_cookie_secret(*m_creds);
303#if defined(BOTAN_HAS_TLS_DOWNGRADE_SUPPORT)
307 downgrade_info.session_manager,
309 downgrade_info.policy,
312 downgrade_info.io_buffer_size),
313 m_creds(downgrade_info.creds) {}
317std::unique_ptr<Handshake_State> Server_Impl_12::new_handshake_state(std::unique_ptr<Handshake_IO> io) {
318 auto state = std::make_unique<Server_Handshake_State>(std::move(io),
callbacks());
326void Server_Impl_12::initiate_handshake(Handshake_State& state,
bool force_full_renegotiation) {
327 dynamic_cast<Server_Handshake_State&
>(state).set_allow_session_resumption(!force_full_renegotiation);
329 const Hello_Request hello_req(state.handshake_io());
337 const std::vector<Protocol_Version>& supported_versions) {
339 const bool initial_handshake = (active_version.valid() ==
false);
341 if(!supported_versions.empty()) {
344 return Protocol_Version::DTLS_V12;
346 throw TLS_Exception(Alert::ProtocolVersion,
"No shared DTLS version");
349 return Protocol_Version::TLS_V12;
351 throw TLS_Exception(Alert::ProtocolVersion,
"No shared TLS version");
355 if(!initial_handshake) {
363 if(active_version > client_offer) {
365 Alert::ProtocolVersion,
366 "Client negotiated " + active_version.to_string() +
" then renegotiated with " + client_offer.to_string());
368 return active_version;
373 if(policy.allow_dtls12() && client_offer >= Protocol_Version::DTLS_V12) {
374 return Protocol_Version::DTLS_V12;
377 if(policy.allow_tls12() && client_offer >= Protocol_Version::TLS_V12) {
378 return Protocol_Version::TLS_V12;
383 "Client version " + client_offer.to_string() +
" is unacceptable by policy");
390void Server_Impl_12::process_client_hello_msg(Server_Handshake_State& pending_state,
391 const std::vector<uint8_t>& contents,
392 bool epoch0_restart) {
395 const bool initial_handshake = epoch0_restart || !
active_state().has_value();
397 if(initial_handshake ==
false &&
policy().allow_client_initiated_renegotiation() ==
false) {
398 if(
policy().abort_connection_on_undesired_renegotiation()) {
399 throw TLS_Exception(Alert::NoRenegotiation,
"Server policy prohibits renegotiation");
411 if(pending_state.handshake_io().have_more_data()) {
412 throw TLS_Exception(Alert::UnexpectedMessage,
"Have data remaining in buffer after ClientHello");
415 pending_state.client_hello(std::make_unique<Client_Hello_12>(contents));
416 const Protocol_Version client_offer = pending_state.client_hello()->legacy_version();
417 const bool datagram = client_offer.is_datagram_protocol();
420 if(client_offer.major_version() == 0xFF) {
421 throw TLS_Exception(Alert::ProtocolVersion,
"Client offered DTLS version with major version 0xFF");
424 if(client_offer.major_version() < 3) {
425 throw TLS_Exception(Alert::ProtocolVersion,
"Client offered TLS version with major version under 3");
427 if(client_offer.major_version() == 3 && client_offer.minor_version() == 0) {
428 throw TLS_Exception(Alert::ProtocolVersion,
"Client offered SSLv3 which is not supported");
442 const Protocol_Version negotiated_version =
446 pending_state.client_hello()->supported_versions());
448 pending_state.set_version(negotiated_version);
450 const auto compression_methods = pending_state.client_hello()->compression_methods();
452 throw TLS_Exception(Alert::IllegalParameter,
"Client did not offer NULL compression");
455 if(initial_handshake && datagram &&
policy().dtls_server_require_cookie_exchange()) {
457 const auto cookie_secret = load_dtls_cookie_secret(*m_creds);
460 if(client_identity.empty()) {
468 "Since Botan 3.13 DTLS server requires tls_peer_network_identity() return a non-empty value");
470 const Hello_Verify_Request verify(
471 pending_state.client_hello()->cookie_input_data(), client_identity, cookie_secret);
475 pending_state.handshake_io().send_under_epoch(verify, 0);
477 pending_state.handshake_io().send(verify);
480 pending_state.client_hello(
nullptr);
494 if(
policy().require_extended_master_secret() && !pending_state.client_hello()->supports_extended_master_secret()) {
495 throw TLS_Exception(Alert::HandshakeFailure,
496 "Policy requires the Extended Master Secret extension but the client did not send it");
509 const bool ems_pending = pending_state.client_hello()->supports_extended_master_secret();
510 if(active->supports_extended_master_secret() ==
true && ems_pending ==
false) {
511 throw TLS_Exception(Alert::HandshakeFailure,
512 "Renegotiation ClientHello dropped the Extended Master Secret extension");
519 const auto session_handle = pending_state.client_hello()->session_handle();
521 std::optional<Session> session_info;
522 if(pending_state.allow_session_resumption() && session_handle.has_value()) {
523 session_info = check_for_resume(
527 m_next_protocol =
"";
528 if(pending_state.client_hello()->supports_alpn()) {
529 const auto offered = pending_state.client_hello()->next_protocols();
534 if(!m_next_protocol.empty() && !
value_exists(offered, m_next_protocol)) {
535 throw TLS_Exception(Alert::InternalError,
"Application chose an ALPN protocol that the client did not offer");
539 if(session_info.has_value()) {
540 this->session_resume(pending_state, {session_info.value(), session_handle.value()});
543 this->session_create(pending_state);
547void Server_Impl_12::process_certificate_msg(Server_Handshake_State& pending_state,
548 const std::vector<uint8_t>& contents) {
549 pending_state.client_certs(std::make_unique<Certificate_12>(contents,
policy()));
552 if(pending_state.client_certs()->empty() &&
policy().require_client_certificate_authentication()) {
553 throw TLS_Exception(Alert::HandshakeFailure,
"Policy requires client send a certificate, but it did not");
559void Server_Impl_12::process_client_key_exchange_msg(Server_Handshake_State& pending_state,
560 const std::vector<uint8_t>& contents) {
567 pending_state.client_kex(std::make_unique<Client_Key_Exchange>(
568 contents, pending_state, pending_state.server_rsa_kex_key(), *m_creds,
policy(),
rng()));
570 pending_state.compute_session_keys();
571 if(
policy().allow_ssl_key_log_file()) {
577 "CLIENT_RANDOM", pending_state.client_hello()->random(), pending_state.session_keys().master_secret());
581void Server_Impl_12::process_change_cipher_spec_msg(Server_Handshake_State& pending_state) {
586void Server_Impl_12::process_certificate_verify_msg(Server_Handshake_State& pending_state,
588 const std::vector<uint8_t>& contents) {
589 pending_state.client_verify(std::make_unique<Certificate_Verify_12>(contents));
591 const std::vector<X509_Certificate>& client_certs = pending_state.client_certs()->cert_chain();
593 if(client_certs.empty()) {
594 throw TLS_Exception(Alert::DecodeError,
"No client certificate sent");
597 const auto cert_constraints = client_certs[0].constraints();
598 if(!cert_constraints.empty()) {
600 throw TLS_Exception(Alert::BadCertificate,
"Client certificate does not support signing");
604 const bool sig_valid = pending_state.client_verify()->verify(client_certs[0], pending_state,
policy());
606 pending_state.hash().update(pending_state.handshake_io().format(contents, type));
614 throw TLS_Exception(Alert::DecryptError,
"Client cert verify failed");
618 const std::string sni_hostname = pending_state.client_hello()->sni_hostname();
619 auto trusted_CAs = m_creds->trusted_certificate_authorities(
"tls-server", sni_hostname);
627 }
catch(std::exception& e) {
628 throw TLS_Exception(Alert::BadCertificate, e.what());
634void Server_Impl_12::process_finished_msg(Server_Handshake_State& pending_state,
636 const std::vector<uint8_t>& contents) {
639 if(pending_state.handshake_io().have_more_data()) {
640 throw TLS_Exception(Alert::UnexpectedMessage,
"Have data remaining in buffer after Finished");
643 pending_state.client_finished(std::make_unique<Finished_12>(contents));
646 throw TLS_Exception(Alert::DecryptError,
"Finished message didn't verify");
649 if(pending_state.server_finished() ==
nullptr) {
652 pending_state.hash().update(pending_state.handshake_io().format(contents, type));
654 Session session_info(pending_state.session_keys().master_secret(),
655 pending_state.server_hello()->legacy_version(),
656 pending_state.server_hello()->ciphersuite(),
658 pending_state.server_hello()->supports_extended_master_secret(),
659 pending_state.server_hello()->supports_encrypt_then_mac(),
660 pending_state.peer_cert_chain(),
661 Server_Information(pending_state.client_hello()->sni_hostname()),
662 pending_state.server_hello()->srtp_profile(),
668 Session_Summary summary(session_info, pending_state.is_a_resumption(), pending_state.psk_identity());
669 summary.set_session_id(pending_state.server_hello()->session_id());
673 if(
callbacks().tls_should_persist_resumption_information(session_info)) {
675 pending_state.server_hello()->session_id(),
676 !pending_state.server_hello()->supports_session_ticket());
678 if(pending_state.server_hello()->supports_session_ticket() && handle.has_value() && handle->is_ticket()) {
679 pending_state.new_session_ticket(std::make_unique<New_Session_Ticket_12>(
680 pending_state.handshake_io(),
681 pending_state.hash(),
682 handle->ticket().value(),
683 static_cast<uint32_t
>(
policy().session_ticket_lifetime().count())));
689 if(pending_state.new_session_ticket() ==
nullptr && pending_state.server_hello()->supports_session_ticket()) {
690 pending_state.new_session_ticket(
691 std::make_unique<New_Session_Ticket_12>(pending_state.handshake_io(), pending_state.hash()));
694 pending_state.handshake_io().send(Change_Cipher_Spec());
698 pending_state.server_finished(
710 const std::vector<uint8_t>& contents,
711 bool epoch0_restart) {
712 Server_Handshake_State& state =
dynamic_cast<Server_Handshake_State&
>(state_base);
713 state.confirm_transition_to(type);
724 state.hash().update(state.handshake_io().format(contents, type));
729 return this->process_client_hello_msg(state, contents, epoch0_restart);
732 return this->process_certificate_msg(state, contents);
735 return this->process_client_key_exchange_msg(state, contents);
738 return this->process_certificate_verify_msg(state, type, contents);
741 return this->process_change_cipher_spec_msg(state);
744 return this->process_finished_msg(state, type, contents);
747 throw Unexpected_Message(
"Unknown handshake message received");
751void Server_Impl_12::session_resume(Server_Handshake_State& pending_state,
const Session_with_Handle& session) {
755 const bool offer_new_session_ticket = pending_state.client_hello()->supports_session_ticket() &&
756 pending_state.client_hello()->session_ticket().empty() &&
759 pending_state.server_hello(std::make_unique<Server_Hello_12>(pending_state.handshake_io(),
760 pending_state.hash(),
765 *pending_state.client_hello(),
767 offer_new_session_ticket,
772 pending_state.mark_as_resumption();
773 pending_state.compute_session_keys(session.session.master_secret());
774 if(
policy().allow_ssl_key_log_file()) {
780 "CLIENT_RANDOM", pending_state.client_hello()->random(), pending_state.session_keys().master_secret());
782 pending_state.set_resume_certs(session.session.peer_certs());
788 summary.set_session_id(pending_state.server_hello()->session_id());
789 if(
auto ticket = session.handle.ticket()) {
790 summary.set_session_ticket(std::move(ticket.value()));
795 auto new_handle = [&,
this]() -> std::optional<Session_Handle> {
796 if(!
callbacks().tls_should_persist_resumption_information(session.session)) {
806 if(pending_state.server_hello()->supports_session_ticket()) {
807 if(new_handle.has_value() && new_handle->is_ticket()) {
809 pending_state.new_session_ticket(std::make_unique<New_Session_Ticket_12>(
810 pending_state.handshake_io(), pending_state.hash(), new_handle->ticket().value(), lifetime));
812 pending_state.new_session_ticket(
813 std::make_unique<New_Session_Ticket_12>(pending_state.handshake_io(), pending_state.hash()));
817 pending_state.handshake_io().send(Change_Cipher_Spec());
821 pending_state.server_finished(
826void Server_Impl_12::session_create(Server_Handshake_State& pending_state) {
827 std::map<std::string, std::vector<X509_Certificate>> cert_chains;
829 const std::string sni_hostname = pending_state.client_hello()->sni_hostname();
837 const auto cert_signature_schemes = pending_state.client_hello()->certificate_signature_schemes();
838 cert_chains = get_server_certs(sni_hostname, cert_signature_schemes, *m_creds);
840 if(!sni_hostname.empty() && cert_chains.empty()) {
841 cert_chains = get_server_certs(
"", cert_signature_schemes, *m_creds);
850 if(!cert_chains.empty()) {
855 const uint16_t ciphersuite =
856 choose_ciphersuite(
policy(), pending_state.version(), cert_chains, *pending_state.client_hello());
859 pending_state.version(),
863 pending_state.server_hello(std::make_unique<Server_Hello_12>(pending_state.handshake_io(),
864 pending_state.hash(),
869 *pending_state.client_hello(),
875 const Ciphersuite& pending_suite = pending_state.ciphersuite();
877 std::shared_ptr<Private_Key> private_key;
879 if(pending_suite.is_certificate_required()) {
880 const std::string algo_used = pending_suite.signature_used() ? pending_suite.sig_algo() :
"RSA";
882 BOTAN_ASSERT(!cert_chains[algo_used].empty(),
"Attempting to send empty certificate chain");
884 pending_state.server_certs(
885 std::make_unique<Certificate_12>(pending_state.handshake_io(), pending_state.hash(), cert_chains[algo_used]));
887 if(pending_state.client_hello()->supports_cert_status_message() && pending_state.is_a_resumption() ==
false) {
888 auto* csr = pending_state.client_hello()->extensions().get<Certificate_Status_Request>();
892 if(!resp_bytes.empty()) {
893 pending_state.server_cert_status(
894 std::make_unique<Certificate_Status_12>(pending_state.handshake_io(), pending_state.hash(), resp_bytes));
898 private_key = m_creds->private_key_for(pending_state.server_certs()->cert_chain()[0],
"tls-server", sni_hostname);
901 throw Internal_Error(
"No private key located for associated server cert");
906 pending_state.set_server_rsa_kex_key(private_key);
908 pending_state.server_kex(std::make_unique<Server_Key_Exchange>(
909 pending_state.handshake_io(), pending_state,
policy(), *m_creds,
rng(), private_key.get()));
912 auto trusted_CAs = m_creds->trusted_certificate_authorities(
"tls-server", sni_hostname);
914 std::vector<X509_DN> client_auth_CAs;
916 for(
auto* store : trusted_CAs) {
917 auto subjects = store->all_subjects();
918 client_auth_CAs.insert(client_auth_CAs.end(), subjects.begin(), subjects.end());
928 if(request_cert && can_request_cert && pending_state.ciphersuite().is_certificate_required()) {
929 pending_state.cert_req(std::make_unique<Certificate_Request_12>(
930 pending_state.handshake_io(), pending_state.hash(),
policy(), client_auth_CAs));
942 pending_state.server_hello_done(
943 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 note_resumption_handle(std::optional< Session_Handle > handle)
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
bool is_datagram_protocol() 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)
std::vector< T, secure_allocator< T > > secure_vector