Botan 3.4.0
Crypto and TLS for C&
tls_server_impl_13.cpp
Go to the documentation of this file.
1/*
2* TLS Server - implementation for TLS 1.3
3* (C) 2022 Jack Lloyd
4* 2022 René Meusel - Rohde & Schwarz Cybersecurity
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#include <botan/internal/tls_server_impl_13.h>
10
11#include <botan/credentials_manager.h>
12#include <botan/rng.h>
13#include <botan/internal/loadstor.h>
14#include <botan/internal/stl_util.h>
15#include <botan/internal/tls_cipher_state.h>
16
17namespace Botan::TLS {
18
19Server_Impl_13::Server_Impl_13(const std::shared_ptr<Callbacks>& callbacks,
20 const std::shared_ptr<Session_Manager>& session_manager,
21 const std::shared_ptr<Credentials_Manager>& credentials_manager,
22 const std::shared_ptr<const Policy>& policy,
23 const std::shared_ptr<RandomNumberGenerator>& rng) :
24 Channel_Impl_13(callbacks, session_manager, credentials_manager, rng, policy, true /* is_server */) {
25#if defined(BOTAN_HAS_TLS_12)
26 if(policy->allow_tls12()) {
27 expect_downgrade({}, {});
28 }
29#endif
30
32}
33
36 const auto& eee = m_handshake_state.encrypted_extensions().extensions();
37 if(const auto alpn = eee.get<Application_Layer_Protocol_Notification>()) {
38 return alpn->single_protocol();
39 }
40 }
41
42 return "";
43}
44
45std::vector<X509_Certificate> Server_Impl_13::peer_cert_chain() const {
46 if(m_handshake_state.has_client_certificate_msg() &&
47 m_handshake_state.client_certificate().has_certificate_chain()) {
48 return m_handshake_state.client_certificate().cert_chain();
49 }
50
51 if(m_resumed_session.has_value()) {
52 return m_resumed_session->peer_certs();
53 }
54
55 return {};
56}
57
58std::shared_ptr<const Public_Key> Server_Impl_13::peer_raw_public_key() const {
59 if(m_handshake_state.has_client_certificate_msg() && m_handshake_state.client_certificate().is_raw_public_key()) {
60 return m_handshake_state.client_certificate().public_key();
61 }
62
63 if(m_resumed_session.has_value()) {
64 return m_resumed_session->peer_raw_public_key();
65 }
66
67 return nullptr;
68}
69
70std::optional<std::string> Server_Impl_13::external_psk_identity() const {
71 return m_psk_identity;
72}
73
75 // RFC 8446 4.2.9
76 // This extension also restricts the modes for use with PSK resumption.
77 // Servers SHOULD NOT send NewSessionTicket with tickets that are not
78 // compatible with the advertised modes; however, if a server does so,
79 // the impact will just be that the client's attempts at resumption fail.
80 //
81 // Note: Applications can overrule this by calling send_new_session_tickets()
82 // regardless of this method indicating no support for tickets.
83 //
84 // TODO: Implement other PSK KE modes than PSK_DHE_KE
85 return is_handshake_complete() && m_handshake_state.client_hello().extensions().has<PSK_Key_Exchange_Modes>() &&
86 value_exists(m_handshake_state.client_hello().extensions().get<PSK_Key_Exchange_Modes>()->modes(),
88}
89
90size_t Server_Impl_13::send_new_session_tickets(const size_t tickets) {
92
93 if(tickets == 0) {
94 return 0;
95 }
96
98 size_t tickets_created = 0;
99
100 for(size_t i = 0; i < tickets; ++i) {
101 auto nonce = m_cipher_state->next_ticket_nonce();
102 const Session session(m_cipher_state->psk(nonce),
103 std::nullopt, // early data not yet implemented
104 policy().session_ticket_lifetime(),
107 m_handshake_state.client_hello(),
108 m_handshake_state.server_hello(),
109 callbacks(),
110 rng());
111
112 if(callbacks().tls_should_persist_resumption_information(session)) {
113 if(auto handle = session_manager().establish(session)) {
114 flight.add(New_Session_Ticket_13(std::move(nonce), session, handle.value(), callbacks()));
115 ++tickets_created;
116 }
117 }
118 }
119
120 if(flight.contains_messages()) {
121 flight.send();
122 }
123
124 return tickets_created;
125}
126
127void Server_Impl_13::process_handshake_msg(Handshake_Message_13 message) {
128 std::visit(
129 [&](auto msg) {
130 // first verify that the message was expected by the state machine...
131 m_transitions.confirm_transition_to(msg.get().type());
132
133 // ... then allow the library user to abort on their discretion
135
136 // ... finally handle the message
137 handle(msg.get());
138 },
139 m_handshake_state.received(std::move(message)));
140}
141
142void Server_Impl_13::process_post_handshake_msg(Post_Handshake_Message_13 message) {
144
145 std::visit([&](auto msg) { handle(msg); }, m_handshake_state.received(std::move(message)));
146}
147
148void Server_Impl_13::process_dummy_change_cipher_spec() {
149 // RFC 8446 5.
150 // If an implementation detects a change_cipher_spec record received before
151 // the first ClientHello message or after the peer's Finished message, it MUST be
152 // treated as an unexpected record type [("unexpected_message" alert)].
153 if(!m_handshake_state.has_client_hello() || m_handshake_state.has_client_finished()) {
154 throw TLS_Exception(Alert::UnexpectedMessage, "Received an unexpected dummy Change Cipher Spec");
155 }
156
157 // RFC 8446 5.
158 // An implementation may receive an unencrypted record of type change_cipher_spec [...]
159 // at any time after the first ClientHello message has been sent or received
160 // and before the peer's Finished message has been received [...]
161 // and MUST simply drop it without further processing.
162 //
163 // ... no further processing.
164}
165
167 return m_handshake_state.handshake_finished();
168}
169
170void Server_Impl_13::downgrade() {
172
174
175 // After this, no further messages are expected here because this instance
176 // will be replaced by a Server_Impl_12.
177 m_transitions.set_expected_next({});
178}
179
180void Server_Impl_13::maybe_handle_compatibility_mode() {
181 BOTAN_ASSERT_NOMSG(m_handshake_state.has_client_hello());
182 BOTAN_ASSERT_NOMSG(m_handshake_state.has_hello_retry_request() || m_handshake_state.has_server_hello());
183
184 // RFC 8446 Appendix D.4 (Middlebox Compatibility Mode)
185 // The server sends a dummy change_cipher_spec record immediately after
186 // its first handshake message. This may either be after a ServerHello or
187 // a HelloRetryRequest.
188 //
189 // This "compatibility mode" is partially negotiated: the client can opt
190 // to provide a session ID or not, and the server has to echo it. Either
191 // side can send change_cipher_spec at any time during the handshake, as
192 // they must be ignored by the peer, but if the client sends a non-empty
193 // session ID, the server MUST send the change_cipher_spec as described
194 // [above].
195 //
196 // Technically, the usage of compatibility mode is fully up to the client
197 // sending a non-empty session ID. Nevertheless, when the policy requests
198 // it we send a CCS regardless. Note that this is perfectly legal and also
199 // satisfies some BoGo tests that expect this behaviour.
200 //
201 // Send a CCS immediately after the _first_ handshake message. I.e. either
202 // after Hello Retry Request (exclusively) or after a Server Hello that was
203 // not preseded by a Hello Retry Request.
204 const bool just_after_first_handshake_message =
205 m_handshake_state.has_hello_retry_request() ^ m_handshake_state.has_server_hello();
206 const bool client_requested_compatibility_mode = !m_handshake_state.client_hello().session_id().empty();
207
208 if(just_after_first_handshake_message &&
209 (policy().tls_13_middlebox_compatibility_mode() || client_requested_compatibility_mode)) {
211 }
212}
213
214void Server_Impl_13::handle_reply_to_client_hello(Server_Hello_13 server_hello) {
215 const auto& client_hello = m_handshake_state.client_hello();
216 const auto& exts = client_hello.extensions();
217
218 const bool uses_psk = server_hello.extensions().has<PSK>();
219
220 const auto cipher_opt = Ciphersuite::by_id(server_hello.ciphersuite());
221 BOTAN_ASSERT_NOMSG(cipher_opt.has_value());
222 const auto& cipher = cipher_opt.value();
223 m_transcript_hash.set_algorithm(cipher.prf_algo());
224
225 std::unique_ptr<Cipher_State> psk_cipher_state;
226 if(uses_psk) {
227 auto psk_extension = server_hello.extensions().get<PSK>();
228
229 psk_cipher_state =
230 std::visit(overloaded{[&, this](Session session) {
231 m_resumed_session = std::move(session);
234 m_resumed_session->extract_master_secret(),
235 cipher.prf_algo());
236 },
237 [&, this](ExternalPSK psk) {
238 m_psk_identity = psk.identity();
241 psk.extract_master_secret(),
242 cipher.prf_algo());
243 }},
244 psk_extension->take_session_to_resume_or_psk());
245
246 // RFC 8446 4.2.11
247 // Prior to accepting PSK key establishment, the server MUST validate
248 // the corresponding binder value (see Section 4.2.11.2 below). If this
249 // value is not present or does not validate, the server MUST abort the
250 // handshake.
251 // Servers SHOULD NOT attempt to validate multiple binders; rather,
252 // they SHOULD select a single PSK and validate solely the binder that
253 // corresponds to that PSK.
254 //
255 // Note: PSK selection was performed earlier, resulting in the existence
256 // of this extension in the first place.
257 if(!exts.get<PSK>()->validate_binder(*psk_extension,
258 psk_cipher_state->psk_binder_mac(m_transcript_hash.truncated()))) {
259 throw TLS_Exception(Alert::DecryptError, "PSK binder does not check out");
260 }
261
262 // RFC 8446 4.2.10
263 // For PSKs provisioned via NewSessionTicket, a server MUST validate
264 // that the ticket age for the selected PSK identity [...] is within a
265 // small tolerance of the time since the ticket was issued. If it is
266 // not, the server SHOULD proceed with the handshake but reject 0-RTT,
267 // and SHOULD NOT take any other action that assumes that this
268 // ClientHello is fresh.
269 //
270 // TODO: When implementing Early Data (0-RTT) we should take the above
271 // paragraph into account. Note that there are BoGo tests that
272 // validate this behaviour. Namely: TLS13-TicketAgeSkew-*
273 }
274
275 // This sends the server_hello to the peer.
276 // NOTE: the server_hello variable is moved into the handshake state. Later
277 // references to the Server Hello will need to consult the handshake
278 // state object!
279 send_handshake_message(m_handshake_state.sending(std::move(server_hello)));
280 maybe_handle_compatibility_mode();
281
282 // Setup encryption for all the remaining handshake messages
283 m_cipher_state = [&] {
284 // Currently, PSK without DHE is not implemented...
285 const auto my_keyshare = m_handshake_state.server_hello().extensions().get<Key_Share>();
286 BOTAN_ASSERT_NONNULL(my_keyshare);
287
288 if(uses_psk) {
289 BOTAN_ASSERT_NONNULL(psk_cipher_state);
290 psk_cipher_state->advance_with_client_hello(m_transcript_hash.previous());
291 psk_cipher_state->advance_with_server_hello(
292 cipher, my_keyshare->take_shared_secret(), m_transcript_hash.current());
293
294 return std::move(psk_cipher_state);
295 } else {
297 m_side, my_keyshare->take_shared_secret(), cipher, m_transcript_hash.current());
298 }
299 }();
300
301 auto flight = aggregate_handshake_messages();
302 flight.add(m_handshake_state.sending(Encrypted_Extensions(client_hello, policy(), callbacks())));
303
304 if(!uses_psk) {
305 // RFC 8446 4.3.2
306 // A server which is authenticating with a certificate MAY optionally
307 // request a certificate from the client. This message, if sent, MUST
308 // follow EncryptedExtensions.
309 if(auto certificate_request =
311 flight.add(m_handshake_state.sending(std::move(certificate_request.value())));
312 }
313
314 const auto& enc_exts = m_handshake_state.encrypted_extensions().extensions();
315
316 // RFC 7250 4.2
317 // This client_certificate_type extension in the server hello then
318 // indicates the type of certificates the client is requested to provide
319 // in a subsequent certificate payload.
320 //
321 // Note: TLS 1.3 carries this extension in the Encrypted Extensions
322 // message instead of the Server Hello.
323 if(auto client_cert_type = enc_exts.get<Client_Certificate_Type>()) {
324 set_selected_certificate_type(client_cert_type->selected_certificate_type());
325 }
326
327 // RFC 8446 4.4.2
328 // If the corresponding certificate type extension [...] was not
329 // negotiated in EncryptedExtensions, or the X.509 certificate type
330 // was negotiated, then each CertificateEntry contains a DER-encoded
331 // X.509 certificate.
332 const auto cert_type = [&] {
333 if(auto server_cert_type = enc_exts.get<Server_Certificate_Type>()) {
334 return server_cert_type->selected_certificate_type();
335 } else {
337 }
338 }();
339
340 flight.add(m_handshake_state.sending(Certificate_13(client_hello, credentials_manager(), callbacks(), cert_type)))
341 .add(m_handshake_state.sending(Certificate_Verify_13(m_handshake_state.server_certificate(),
342 client_hello.signature_schemes(),
343 client_hello.sni_hostname(),
347 policy(),
348 callbacks(),
349 rng())));
350 }
351
352 flight.add(m_handshake_state.sending(Finished_13(m_cipher_state.get(), m_transcript_hash.current())));
353
354 if(client_hello.extensions().has<Record_Size_Limit>() &&
355 m_handshake_state.encrypted_extensions().extensions().has<Record_Size_Limit>()) {
356 // RFC 8449 4.
357 // When the "record_size_limit" extension is negotiated, an endpoint
358 // MUST NOT generate a protected record with plaintext that is larger
359 // than the RecordSizeLimit value it receives from its peer.
360 // Unprotected messages are not subject to this limit.
361 //
362 // Hence, the limit is set just before we start sending encrypted records.
363 //
364 // RFC 8449 4.
365 // The record size limit only applies to records sent toward the
366 // endpoint that advertises the limit. An endpoint can send records
367 // that are larger than the limit it advertises as its own limit.
368 //
369 // Hence, the "outgoing" limit is what the client requested and the
370 // "incoming" limit is what we will request in the Encrypted Extensions.
371 const auto outgoing_limit = client_hello.extensions().get<Record_Size_Limit>();
372 const auto incoming_limit = m_handshake_state.encrypted_extensions().extensions().get<Record_Size_Limit>();
373 set_record_size_limits(outgoing_limit->limit(), incoming_limit->limit());
374 }
375
376 flight.send();
377
378 m_cipher_state->advance_with_server_finished(m_transcript_hash.current());
379
380 if(m_handshake_state.has_certificate_request()) {
381 // RFC 8446 4.4.2
382 // The client MUST send a Certificate message if and only if the server
383 // has requested client authentication via a CertificateRequest message
384 // [...]. If the server requests client authentication but no
385 // suitable certificate is available, the client MUST send a Certificate
386 // message containing no certificates [...].
388 } else {
390 }
391}
392
393void Server_Impl_13::handle_reply_to_client_hello(Hello_Retry_Request hello_retry_request) {
394 auto cipher = Ciphersuite::by_id(hello_retry_request.ciphersuite());
395 BOTAN_ASSERT_NOMSG(cipher.has_value()); // should work, since we chose that suite
396
397 send_handshake_message(m_handshake_state.sending(std::move(hello_retry_request)));
398 maybe_handle_compatibility_mode();
399
401
403}
404
405void Server_Impl_13::handle(const Client_Hello_12& ch) {
406 // The detailed handling of the TLS 1.2 compliant Client Hello is left to
407 // the TLS 1.2 server implementation.
408 BOTAN_UNUSED(ch);
409
410 // After we sent a Hello Retry Request we must not accept a downgrade.
411 if(m_handshake_state.has_hello_retry_request()) {
412 throw TLS_Exception(Alert::UnexpectedMessage, "Received a TLS 1.2 Client Hello after Hello Retry Request");
413 }
414
415 // RFC 8446 Appendix D.2
416 // If the "supported_versions" extension is absent and the server only
417 // supports versions greater than ClientHello.legacy_version, the server
418 // MUST abort the handshake with a "protocol_version" alert.
419 //
420 // If we're not expecting a downgrade, we only support TLS 1.3.
421 if(!expects_downgrade()) {
422 throw TLS_Exception(Alert::ProtocolVersion, "Received a legacy Client Hello");
423 }
424
425 downgrade();
426}
427
428void Server_Impl_13::handle(const Client_Hello_13& client_hello) {
429 const auto& exts = client_hello.extensions();
430
431 const bool is_initial_client_hello = !m_handshake_state.has_hello_retry_request();
432
433 if(is_initial_client_hello) {
434 const auto preferred_version = client_hello.highest_supported_version(policy());
435 if(!preferred_version) {
436 throw TLS_Exception(Alert::ProtocolVersion, "No shared TLS version");
437 }
438
439 // RFC 8446 4.2.2
440 // Clients MUST NOT use cookies in their initial ClientHello in subsequent
441 // connections.
442 if(exts.has<Cookie>()) {
443 throw TLS_Exception(Alert::IllegalParameter, "Received a Cookie in the initial client hello");
444 }
445 }
446
447 // TODO: Implement support for PSK. For now, we ignore any such extensions
448 // and always revert to a standard key exchange.
449 if(!exts.has<Supported_Groups>()) {
450 throw Not_Implemented("PSK-only handshake NYI");
451 }
452
453 // RFC 8446 9.2
454 // If containing a "supported_groups" extension, [Client Hello] MUST
455 // also contain a "key_share" extension, and vice versa.
456 //
457 // This was validated before in the Client_Hello_13 constructor.
458 BOTAN_ASSERT_NOMSG(exts.has<Key_Share>());
459
460 if(!is_initial_client_hello) {
461 const auto& hrr_exts = m_handshake_state.hello_retry_request().extensions();
462 const auto offered_groups = exts.get<Key_Share>()->offered_groups();
463 const auto selected_group = hrr_exts.get<Key_Share>()->selected_group();
464 if(offered_groups.size() != 1 || offered_groups.at(0) != selected_group) {
465 throw TLS_Exception(Alert::IllegalParameter, "Client did not comply with the requested key exchange group");
466 }
467 }
468
469 callbacks().tls_examine_extensions(exts, Connection_Side::Client, client_hello.type());
470 std::visit([this](auto msg) { handle_reply_to_client_hello(std::move(msg)); },
471 Server_Hello_13::create(client_hello,
472 is_initial_client_hello,
475 rng(),
476 policy(),
477 callbacks()));
478}
479
480void Server_Impl_13::handle(const Certificate_13& certificate_msg) {
481 // RFC 8446 4.3.2
482 // certificate_request_context: [...] This field SHALL be zero length
483 // unless used for the post-handshake authentication exchanges [...].
484 if(!is_handshake_complete() && !certificate_msg.request_context().empty()) {
485 throw TLS_Exception(Alert::DecodeError, "Received a client certificate message with non-empty request context");
486 }
487
488 // RFC 8446 4.4.2
489 // Extensions in the Certificate message from the client MUST correspond
490 // to extensions in the CertificateRequest message from the server.
491 certificate_msg.validate_extensions(m_handshake_state.certificate_request().extensions().extension_types(),
492 callbacks());
493
494 // RFC 8446 4.4.2.4
495 // If the client does not send any certificates (i.e., it sends an empty
496 // Certificate message), the server MAY at its discretion either continue
497 // the handshake without client authentication or abort the handshake with
498 // a "certificate_required" alert.
499 if(certificate_msg.empty()) {
500 if(policy().require_client_certificate_authentication()) {
501 throw TLS_Exception(Alert::CertificateRequired, "Policy requires client send a certificate, but it did not");
502 }
503
504 // RFC 8446 4.4.2
505 // A Finished message MUST be sent regardless of whether the
506 // Certificate message is empty.
508 } else {
509 // RFC 8446 4.4.2.4
510 // [...], if some aspect of the certificate chain was unacceptable
511 // (e.g., it was not signed by a known, trusted CA), the server MAY at
512 // its discretion either continue the handshake (considering the client
513 // unauthenticated) or abort the handshake.
514 //
515 // TODO: We could make this dependent on Policy::require_client_auth().
516 // Though, apps may also override Callbacks::tls_verify_cert_chain()
517 // and 'ignore' validation issues to a certain extent.
518 certificate_msg.verify(callbacks(),
519 policy(),
521 m_handshake_state.client_hello().sni_hostname(),
522 m_handshake_state.client_hello().extensions().has<Certificate_Status_Request>());
523
524 // RFC 8446 4.4.3
525 // Clients MUST send this message whenever authenticating via a
526 // certificate (i.e., when the Certificate message
527 // is non-empty). When sent, this message MUST appear immediately after
528 // the Certificate message [...].
530 }
531}
532
533void Server_Impl_13::handle(const Certificate_Verify_13& certificate_verify_msg) {
534 // RFC 8446 4.4.3
535 // If sent by a client, the signature algorithm used in the signature
536 // MUST be one of those present in the supported_signature_algorithms
537 // field of the "signature_algorithms" extension in the
538 // CertificateRequest message.
539 const auto offered = m_handshake_state.certificate_request().signature_schemes();
540 if(!value_exists(offered, certificate_verify_msg.signature_scheme())) {
541 throw TLS_Exception(Alert::IllegalParameter,
542 "We did not offer the usage of " + certificate_verify_msg.signature_scheme().to_string() +
543 " as a signature scheme");
544 }
545
547 !m_handshake_state.client_certificate().empty());
548 bool sig_valid = certificate_verify_msg.verify(
550
551 // RFC 8446 4.4.3
552 // If the verification fails, the receiver MUST terminate the handshake
553 // with a "decrypt_error" alert.
554 if(!sig_valid) {
555 throw TLS_Exception(Alert::DecryptError, "Client certificate verification failed");
556 }
557
559}
560
561void Server_Impl_13::handle(const Finished_13& finished_msg) {
562 // RFC 8446 4.4.4
563 // Recipients of Finished messages MUST verify that the contents are
564 // correct and if incorrect MUST terminate the connection with a
565 // "decrypt_error" alert.
566 if(!finished_msg.verify(m_cipher_state.get(), m_transcript_hash.previous())) {
567 throw TLS_Exception(Alert::DecryptError, "Finished message didn't verify");
568 }
569
570 // Give the application a chance for a final veto before fully
571 // establishing the connection.
573 Session_Summary(m_handshake_state.server_hello(),
577 m_psk_identity,
578 m_resumed_session.has_value(),
579 Server_Information(m_handshake_state.client_hello().sni_hostname()),
580 callbacks().tls_current_timestamp()));
581
582 m_cipher_state->advance_with_client_finished(m_transcript_hash.current());
583
584 // no more handshake messages expected
585 m_transitions.set_expected_next({});
586
588
590 send_new_session_tickets(policy().new_session_tickets_upon_handshake_success());
591 }
592}
593
594} // namespace Botan::TLS
#define BOTAN_UNUSED
Definition assert.h:118
#define BOTAN_ASSERT_NOMSG(expr)
Definition assert.h:59
#define BOTAN_STATE_CHECK(expr)
Definition assert.h:41
#define BOTAN_ASSERT_NONNULL(ptr)
Definition assert.h:86
virtual void tls_session_established(const Session_Summary &session)
virtual void tls_session_activated()
virtual void tls_examine_extensions(const Extensions &extn, Connection_Side which_side, Handshake_Type which_message)
virtual void tls_inspect_handshake_msg(const Handshake_Message &message)
std::shared_ptr< const Public_Key > public_key() const
std::vector< X509_Certificate > cert_chain() const
const std::vector< Signature_Scheme > & signature_schemes() const
const Extensions & extensions() const
static std::optional< Certificate_Request_13 > maybe_create(const Client_Hello_13 &sni_hostname, Credentials_Manager &cred_mgr, Callbacks &callbacks, const Policy &policy)
const Policy & policy() const
AggregatedPostHandshakeMessages aggregate_post_handshake_messages()
void expect_downgrade(const Server_Information &server_info, const std::vector< std::string > &next_protocols)
AggregatedHandshakeMessages aggregate_handshake_messages()
Credentials_Manager & credentials_manager()
RandomNumberGenerator & rng()
std::vector< uint8_t > send_handshake_message(const std::variant< MsgTs... > &message)
Transcript_Hash_State m_transcript_hash
Session_Manager & session_manager()
std::unique_ptr< Cipher_State > m_cipher_state
void set_selected_certificate_type(Certificate_Type cert_type)
void set_record_size_limits(uint16_t outgoing_limit, uint16_t incoming_limit)
static std::unique_ptr< Cipher_State > init_with_psk(Connection_Side side, PSK_Type type, secure_vector< uint8_t > &&psk, std::string_view prf_algo)
static std::unique_ptr< Cipher_State > init_with_server_hello(Connection_Side side, secure_vector< uint8_t > &&shared_secret, const Ciphersuite &cipher, const Transcript_Hash &transcript_hash)
static std::optional< Ciphersuite > by_id(uint16_t suite)
std::string sni_hostname() const
const Extensions & extensions() const
const Session_ID & session_id() const
const Extensions & extensions() const
std::set< Extension_Code > extension_types() const
std::reference_wrapper< MsgT > sending(MsgT msg)
decltype(auto) received(Handshake_Message_13 message)
void confirm_transition_to(Handshake_Type msg_type)
void set_expected_next(Handshake_Type msg_type)
const Hello_Retry_Request & hello_retry_request() const
const Certificate_Request_13 & certificate_request() const
const Encrypted_Extensions & encrypted_extensions() const
virtual bool allow_tls12() const
static std::variant< Hello_Retry_Request, Server_Hello_13 > create(const Client_Hello_13 &ch, bool hello_retry_request_allowed, Session_Manager &session_mgr, Credentials_Manager &credentials_mgr, RandomNumberGenerator &rng, const Policy &policy, Callbacks &cb)
const Extensions & extensions() const
std::vector< X509_Certificate > peer_cert_chain() const override
size_t send_new_session_tickets(size_t tickets) override
std::optional< std::string > external_psk_identity() const override
std::shared_ptr< const Public_Key > peer_raw_public_key() const override
bool is_handshake_complete() const override
std::string application_protocol() const override
bool new_session_ticket_supported() const override
Server_Impl_13(const std::shared_ptr< Callbacks > &callbacks, const std::shared_ptr< Session_Manager > &session_manager, const std::shared_ptr< Credentials_Manager > &credentials_manager, const std::shared_ptr< const Policy > &policy, const std::shared_ptr< RandomNumberGenerator > &rng)
const Transcript_Hash & current() const
static Transcript_Hash_State recreate_after_hello_retry_request(std::string_view algo_spec, const Transcript_Hash_State &prev_transcript_hash_state)
void set_algorithm(std::string_view algo_spec)
const Transcript_Hash & previous() const
const Transcript_Hash & truncated() const
std::variant< New_Session_Ticket_13, Key_Update > Post_Handshake_Message_13
std::variant< Client_Hello_13, Client_Hello_12, Server_Hello_13, Server_Hello_12, Hello_Retry_Request, Encrypted_Extensions, Certificate_13, Certificate_Request_13, Certificate_Verify_13, Finished_13 > Handshake_Message_13
bool value_exists(const std::vector< T > &vec, const OT &val)
Definition stl_util.h:118
overloaded(Ts...) -> overloaded< Ts... >