Botan 3.14.1
Crypto and TLS for C&
Botan::TLS::Hello_Verify_Request Class Referencefinal

#include <tls_messages.h>

Inheritance diagram for Botan::TLS::Hello_Verify_Request:
Botan::TLS::Handshake_Message

Public Member Functions

const std::vector< uint8_t > & cookie () const
 Hello_Verify_Request (std::span< const uint8_t > buf)
 Hello_Verify_Request (std::span< const uint8_t > client_hello_bits, std::string_view client_identity, std::span< const uint8_t > cookie_secret)
std::vector< uint8_t > serialize () const override
Handshake_Type type () const override
std::string type_string () const
virtual Handshake_Type wire_type () const

Detailed Description

DTLS Hello Verify Request

Definition at line 55 of file tls_messages.h.

Constructor & Destructor Documentation

◆ Hello_Verify_Request() [1/2]

Botan::TLS::Hello_Verify_Request::Hello_Verify_Request ( std::span< const uint8_t > buf)
explicit

Definition at line 15 of file msg_hello_verify.cpp.

15 {
16 if(buf.size() < 3) {
17 throw Decoding_Error("Hello verify request too small");
18 }
19
20 const Protocol_Version version(buf[0], buf[1]);
21
22 if(!version.is_datagram_protocol()) {
23 throw Decoding_Error("Unknown version from server in hello verify request");
24 }
25
26 if(static_cast<size_t>(buf[2]) + 3 != buf.size()) {
27 throw Decoding_Error("Bad length in hello verify request");
28 }
29
30 m_cookie.assign(buf.begin() + 3, buf.end());
31}

References Botan::TLS::Protocol_Version::is_datagram_protocol().

◆ Hello_Verify_Request() [2/2]

Botan::TLS::Hello_Verify_Request::Hello_Verify_Request ( std::span< const uint8_t > client_hello_bits,
std::string_view client_identity,
std::span< const uint8_t > cookie_secret )

Definition at line 33 of file msg_hello_verify.cpp.

35 :
36 m_cookie(calculate_cookie(client_hello_bits, client_identity, cookie_secret)) {}
std::vector< uint8_t > calculate_cookie(std::span< const uint8_t > client_hello_bits, std::string_view client_identity, std::span< const uint8_t > cookie_secret)

References Botan::TLS::calculate_cookie().

Member Function Documentation

◆ cookie()

const std::vector< uint8_t > & Botan::TLS::Hello_Verify_Request::cookie ( ) const
inline

Definition at line 61 of file tls_messages.h.

61{ return m_cookie; }

Referenced by Botan::TLS::Client_Hello_12::update_hello_cookie().

◆ serialize()

std::vector< uint8_t > Botan::TLS::Hello_Verify_Request::serialize ( ) const
overridevirtual

Serialize this handshake message

Implements Botan::TLS::Handshake_Message.

Definition at line 38 of file msg_hello_verify.cpp.

38 {
39 /* DTLS 1.2 server implementations SHOULD use DTLS version 1.0
40 regardless of the version of TLS that is expected to be
41 negotiated (RFC 6347, section 4.2.1)
42 */
43
44 const Protocol_Version format_version(254, 255); // DTLS 1.0
45
46 std::vector<uint8_t> bits;
47 bits.push_back(format_version.major_version());
48 bits.push_back(format_version.minor_version());
49 append_tls_length_value(bits, m_cookie, 1);
50 return bits;
51}
void append_tls_length_value(std::vector< uint8_t, Alloc > &buf, const T *vals, size_t vals_size, size_t tag_size)
Definition tls_reader.h:182

References Botan::TLS::append_tls_length_value(), Botan::TLS::Protocol_Version::major_version(), and Botan::TLS::Protocol_Version::minor_version().

◆ type()

Handshake_Type Botan::TLS::Hello_Verify_Request::type ( ) const
inlineoverridevirtual

Return the TLS handshake type code

Returns
the message type

Implements Botan::TLS::Handshake_Message.

Definition at line 59 of file tls_messages.h.

References Botan::TLS::HelloVerifyRequest.

◆ type_string()

std::string Botan::TLS::Handshake_Message::type_string ( ) const
inherited

Return a free-form string describing this message type

Returns
string representation of this message type

Definition at line 22 of file tls_handshake_state.cpp.

22 {
24}
virtual Handshake_Type type() const =0
const char * handshake_type_to_string(Handshake_Type type)
Definition tls_magic.cpp:15

References Botan::TLS::handshake_type_to_string(), and type().

◆ wire_type()

virtual Handshake_Type Botan::TLS::Handshake_Message::wire_type ( ) const
inlinevirtualinherited

Return the wire encoding of the message type code

Note
This is usually equal to type with the exception of a TLS 1.3 Helloy Retry Request.
Returns
the wire representation of the message's type

Reimplemented in Botan::TLS::Hello_Retry_Request.

Definition at line 47 of file tls_handshake_msg.h.

47{ return type(); }

References type().

Referenced by Botan::TLS::Stream_Handshake_IO::send(), and Botan::TLS::Handshake_Layer::update_transcript_for_psk_binder_calc().


The documentation for this class was generated from the following files: