Botan 3.0.0-alpha0
Crypto and TLS for C&
Public Member Functions | List of all members
Botan::TLS::New_Session_Ticket_12 Class Referencefinal

#include <tls_messages.h>

Inheritance diagram for Botan::TLS::New_Session_Ticket_12:
Botan::TLS::Handshake_Message

Public Member Functions

 New_Session_Ticket_12 (const std::vector< uint8_t > &buf)
 
 New_Session_Ticket_12 (Handshake_IO &io, Handshake_Hash &hash)
 
 New_Session_Ticket_12 (Handshake_IO &io, Handshake_Hash &hash, const std::vector< uint8_t > &ticket, uint32_t lifetime)
 
std::vector< uint8_t > serialize () const override
 
const std::vector< uint8_t > & ticket () const
 
uint32_t ticket_lifetime_hint () const
 
Handshake_Type type () const override
 
std::string type_string () const
 
virtual Handshake_Type wire_type () const
 

Detailed Description

New Session Ticket Message

Definition at line 848 of file tls_messages.h.

Constructor & Destructor Documentation

◆ New_Session_Ticket_12() [1/3]

Botan::TLS::New_Session_Ticket_12::New_Session_Ticket_12 ( Handshake_IO io,
Handshake_Hash hash,
const std::vector< uint8_t > &  ticket,
uint32_t  lifetime 
)

Definition at line 18 of file msg_session_ticket.cpp.

21 :
22 m_ticket_lifetime_hint(lifetime),
23 m_ticket(ticket)
24 {
25 hash.update(io.send(*this));
26 }
const std::vector< uint8_t > & ticket() const
Definition: tls_messages.h:854
MechanismType hash

References hash, and Botan::TLS::Handshake_IO::send().

◆ New_Session_Ticket_12() [2/3]

Botan::TLS::New_Session_Ticket_12::New_Session_Ticket_12 ( Handshake_IO io,
Handshake_Hash hash 
)

Definition at line 28 of file msg_session_ticket.cpp.

30 {
31 hash.update(io.send(*this));
32 }

References hash, and Botan::TLS::Handshake_IO::send().

◆ New_Session_Ticket_12() [3/3]

Botan::TLS::New_Session_Ticket_12::New_Session_Ticket_12 ( const std::vector< uint8_t > &  buf)
explicit

Definition at line 34 of file msg_session_ticket.cpp.

35 {
36 if(buf.size() < 6)
37 throw Decoding_Error("Session ticket message too short to be valid");
38
39 TLS_Data_Reader reader("SessionTicket", buf);
40
41 m_ticket_lifetime_hint = reader.get_uint32_t();
42 m_ticket = reader.get_range<uint8_t>(2, 0, 65535);
43 reader.assert_done();
44 }

References Botan::TLS::TLS_Data_Reader::assert_done(), Botan::TLS::TLS_Data_Reader::get_range(), and Botan::TLS::TLS_Data_Reader::get_uint32_t().

Member Function Documentation

◆ serialize()

std::vector< uint8_t > Botan::TLS::New_Session_Ticket_12::serialize ( ) const
overridevirtual
Returns
DER representation of this message

Implements Botan::TLS::Handshake_Message.

Definition at line 46 of file msg_session_ticket.cpp.

47 {
48 std::vector<uint8_t> buf(4);
49 store_be(m_ticket_lifetime_hint, buf.data());
50 append_tls_length_value(buf, m_ticket, 2);
51 return buf;
52 }
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:212
constexpr void store_be(uint16_t in, uint8_t out[2])
Definition: loadstor.h:449

References Botan::TLS::append_tls_length_value(), and Botan::store_be().

◆ ticket()

const std::vector< uint8_t > & Botan::TLS::New_Session_Ticket_12::ticket ( ) const
inline

Definition at line 854 of file tls_messages.h.

854{ return m_ticket; }

Referenced by Botan::TLS::Handshake_State::session_ticket().

◆ ticket_lifetime_hint()

uint32_t Botan::TLS::New_Session_Ticket_12::ticket_lifetime_hint ( ) const
inline

Definition at line 853 of file tls_messages.h.

853{ return m_ticket_lifetime_hint; }

◆ type()

Handshake_Type Botan::TLS::New_Session_Ticket_12::type ( ) const
inlineoverridevirtual
Returns
the message type

Implements Botan::TLS::Handshake_Message.

Definition at line 851 of file tls_messages.h.

851{ return NEW_SESSION_TICKET; }
@ NEW_SESSION_TICKET
Definition: tls_magic.h:68

References Botan::TLS::NEW_SESSION_TICKET.

◆ type_string()

std::string Botan::TLS::Handshake_Message::type_string ( ) const
inherited
Returns
string representation of this message type

Definition at line 18 of file tls_handshake_state.cpp.

19 {
21 }
virtual Handshake_Type type() const =0
const char * handshake_type_to_string(Handshake_Type type)

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

◆ wire_type()

virtual Handshake_Type Botan::TLS::Handshake_Message::wire_type ( ) const
inlinevirtualinherited
Returns
the wire representation of the message's type

Definition at line 42 of file tls_handshake_msg.h.

43 {
44 // Usually equal to the Handshake_Type enum value,
45 // with the exception of TLS 1.3 Hello Retry Request.
46 return type();
47 }

References type.

Referenced by Botan::TLS::Stream_Handshake_IO::send().


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