Botan 3.12.0
Crypto and TLS for C&
tls_connection_state_12.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_12_H_
8#define BOTAN_TLS_CONNECTION_STATE_12_H_
9
10#include <botan/secmem.h>
11#include <botan/tls_session_id.h>
12#include <botan/tls_version.h>
13#include <botan/x509cert.h>
14
15#include <memory>
16#include <optional>
17#include <string>
18#include <vector>
19
20namespace Botan::TLS {
21
22class Handshake_IO;
24class Handshake_State;
25
26/**
27* Captures the state of a completed TLS 1.2 handshake that is needed
28* for the lifetime of an active connection.
29 */
31 public:
33
36
39
41
42 // DTLS variant: takes the handshake IO for replay of final flight
44 std::string application_protocol,
45 std::unique_ptr<Handshake_IO> io);
46
47 Protocol_Version version() const { return m_version; }
48
49 uint16_t ciphersuite_code() const { return m_ciphersuite_code; }
50
51 const std::string& application_protocol() const { return m_application_protocol; }
52
53 const std::vector<X509_Certificate>& peer_certs() const { return m_peer_certs; }
54
55 const std::vector<uint8_t>& client_random() const { return m_client_random; }
56
57 const std::optional<std::string>& psk_identity() const { return m_psk_identity; }
58
59 const std::vector<uint8_t>& server_random() const { return m_server_random; }
60
61 const Session_ID& session_id() const { return m_session_id; }
62
63 const secure_vector<uint8_t>& master_secret() const { return m_master_secret; }
64
65 const std::string& prf_algo() const { return m_prf_algo; }
66
67 bool client_supports_secure_renegotiation() const { return m_client_supports_secure_renegotiation; }
68
69 bool server_supports_secure_renegotiation() const { return m_server_supports_secure_renegotiation; }
70
71 const std::vector<uint8_t>& client_finished_verify_data() const { return m_client_finished_verify_data; }
72
73 const std::vector<uint8_t>& server_finished_verify_data() const { return m_server_finished_verify_data; }
74
75 bool supports_extended_master_secret() const { return m_supports_extended_master_secret; }
76
77 /**
78 * For DTLS: the handshake IO from the completed handshake, needed
79 * to retransmit the last flight when records arrive under the
80 * previous epoch. Null for stream TLS.
81 */
82 Datagram_Handshake_IO* dtls_handshake_io() { return m_dtls_handshake_io.get(); }
83
84 private:
85 Protocol_Version m_version;
86 uint16_t m_ciphersuite_code = 0;
87 std::string m_application_protocol;
88 std::vector<X509_Certificate> m_peer_certs;
89 std::vector<uint8_t> m_client_random;
90 std::optional<std::string> m_psk_identity;
91 std::vector<uint8_t> m_server_random;
92 Session_ID m_session_id;
93 secure_vector<uint8_t> m_master_secret;
94 std::string m_prf_algo;
95 bool m_client_supports_secure_renegotiation = false;
96 bool m_server_supports_secure_renegotiation = false;
97 std::vector<uint8_t> m_client_finished_verify_data;
98 std::vector<uint8_t> m_server_finished_verify_data;
99 bool m_supports_extended_master_secret = false;
100 std::unique_ptr<Datagram_Handshake_IO> m_dtls_handshake_io;
101};
102
103} // namespace Botan::TLS
104
105#endif
const std::vector< uint8_t > & client_random() const
const std::vector< uint8_t > & server_random() const
Active_Connection_State_12(Active_Connection_State_12 &&) noexcept
const std::optional< std::string > & psk_identity() const
const std::string & application_protocol() const
const std::vector< uint8_t > & client_finished_verify_data() const
const secure_vector< uint8_t > & master_secret() const
const std::vector< uint8_t > & server_finished_verify_data() const
const std::vector< X509_Certificate > & peer_certs() const
Strong< std::vector< uint8_t >, struct Session_ID_ > Session_ID
holds a TLS 1.2 session ID for stateful resumption
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:68