Botan 3.12.0
Crypto and TLS for C&
tls_connection_state_13.h
Go to the documentation of this file.
1/*
2* (C) 2026 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_TLS_CONNECTION_STATE_13_H_
8#define BOTAN_TLS_CONNECTION_STATE_13_H_
9
10#include <botan/tls_version.h>
11#include <botan/x509cert.h>
12
13#include <memory>
14#include <optional>
15#include <string>
16#include <vector>
17
18namespace Botan {
19
20class Public_Key;
21
22} // namespace Botan
23
24namespace Botan::TLS {
25
26namespace Internal {
28}
29
30/**
31* Captures the state of a completed TLS 1.3 handshake that is needed
32* for the lifetime of an active connection.
33*/
35 public:
37 std::vector<X509_Certificate> peer_certs,
38 std::shared_ptr<const Public_Key> peer_raw_public_key,
39 std::optional<std::string> psk_identity,
40 std::string sni_hostname,
42
46
49
50 Protocol_Version version() const { return m_version; }
51
52 uint16_t ciphersuite_code() const { return m_ciphersuite_code; }
53
54 const std::string& application_protocol() const { return m_application_protocol; }
55
56 const std::vector<X509_Certificate>& peer_certs() const { return m_peer_certs; }
57
58 const std::vector<uint8_t>& client_random() const { return m_client_random; }
59
60 const std::optional<std::string>& psk_identity() const { return m_psk_identity; }
61
62 const std::shared_ptr<const Public_Key>& peer_raw_public_key() const { return m_peer_raw_public_key; }
63
64 const std::string& sni_hostname() const { return m_sni_hostname; }
65
66 bool peer_supports_psk_dhe_ke() const { return m_peer_supports_psk_dhe_ke; }
67
68 private:
69 Protocol_Version m_version;
70 uint16_t m_ciphersuite_code = 0;
71 std::string m_application_protocol;
72 std::vector<X509_Certificate> m_peer_certs;
73 std::vector<uint8_t> m_client_random;
74 std::optional<std::string> m_psk_identity;
75 std::shared_ptr<const Public_Key> m_peer_raw_public_key;
76 std::string m_sni_hostname;
77 bool m_peer_supports_psk_dhe_ke = false;
78};
79
80} // namespace Botan::TLS
81
82#endif
const std::string & application_protocol() const
const std::optional< std::string > & psk_identity() const
Active_Connection_State_13(const Internal::Handshake_State_13_Base &state, std::vector< X509_Certificate > peer_certs, std::shared_ptr< const Public_Key > peer_raw_public_key, std::optional< std::string > psk_identity, std::string sni_hostname, bool peer_supports_psk_dhe_ke)
Active_Connection_State_13(Active_Connection_State_13 &&) noexcept
const std::vector< uint8_t > & client_random() const
const std::vector< X509_Certificate > & peer_certs() const
const std::shared_ptr< const Public_Key > & peer_raw_public_key() const