Botan 3.4.0
Crypto and TLS for C&
tls_server_impl_13.h
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#ifndef BOTAN_TLS_SERVER_IMPL_13_H_
10#define BOTAN_TLS_SERVER_IMPL_13_H_
11
12#include <botan/internal/tls_channel_impl_13.h>
13#include <botan/internal/tls_handshake_state_13.h>
14#include <botan/internal/tls_handshake_transitions.h>
15
16namespace Botan::TLS {
17
18/**
19* SSL/TLS Server 1.3 implementation
20*/
22 public:
23 explicit Server_Impl_13(const std::shared_ptr<Callbacks>& callbacks,
24 const std::shared_ptr<Session_Manager>& session_manager,
25 const std::shared_ptr<Credentials_Manager>& credentials_manager,
26 const std::shared_ptr<const Policy>& policy,
27 const std::shared_ptr<RandomNumberGenerator>& rng);
28
29 std::string application_protocol() const override;
30 std::vector<X509_Certificate> peer_cert_chain() const override;
31 std::shared_ptr<const Public_Key> peer_raw_public_key() const override;
32 std::optional<std::string> external_psk_identity() const override;
33
34 bool new_session_ticket_supported() const override;
35 size_t send_new_session_tickets(size_t tickets) override;
36
37 bool is_handshake_complete() const override;
38
39 private:
40 void process_handshake_msg(Handshake_Message_13 msg) override;
41 void process_post_handshake_msg(Post_Handshake_Message_13 msg) override;
42 void process_dummy_change_cipher_spec() override;
43
45 void handle(const Client_Hello_12& client_hello_msg);
46 void handle(const Client_Hello_13& client_hello_msg);
47 void handle(const Certificate_13& certificate_msg);
48 void handle(const Certificate_Verify_13& certificate_verify_msg);
49 void handle(const Finished_13& finished_msg);
50
51 void handle_reply_to_client_hello(Server_Hello_13 server_hello);
52 void handle_reply_to_client_hello(Hello_Retry_Request hello_retry_request);
53
54 void maybe_handle_compatibility_mode();
55
56 void downgrade();
57
58 private:
59 Server_Handshake_State_13 m_handshake_state;
60 Handshake_Transitions m_transitions;
61
62 std::optional<Session> m_resumed_session;
63 std::optional<std::string> m_psk_identity;
64};
65
66} // namespace Botan::TLS
67
68#endif
const Policy & policy() const
void handle(const Key_Update &key_update)
Credentials_Manager & credentials_manager()
RandomNumberGenerator & rng()
Session_Manager & session_manager()
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)
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