Botan 3.11.0
Crypto and TLS for C&
Botan::TLS::New_Session_Ticket_12 Class Referencefinal

#include <tls_messages_12.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, Session_Ticket ticket, uint32_t lifetime_in_seconds)
std::vector< uint8_t > serialize () const override
const Session_Ticketticket () 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 387 of file tls_messages_12.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,
Session_Ticket ticket,
uint32_t lifetime_in_seconds )

Definition at line 16 of file msg_session_ticket_12.cpp.

19 :
20 m_ticket_lifetime_hint(lifetime), m_ticket(std::move(ticket)) {
21 hash.update(io.send(*this));
22}
const Session_Ticket & ticket() const

References Botan::TLS::Handshake_IO::send(), ticket(), and Botan::TLS::Handshake_Hash::update().

◆ 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 24 of file msg_session_ticket_12.cpp.

24 {
25 hash.update(io.send(*this));
26}

References Botan::TLS::Handshake_IO::send(), and Botan::TLS::Handshake_Hash::update().

◆ 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 28 of file msg_session_ticket_12.cpp.

28 {
29 if(buf.size() < 6) {
30 throw Decoding_Error("Session ticket message too short to be valid");
31 }
32
33 TLS_Data_Reader reader("SessionTicket", buf);
34
35 m_ticket_lifetime_hint = reader.get_uint32_t();
36 m_ticket = Session_Ticket(reader.get_range<uint8_t>(2, 0, 65535));
37 reader.assert_done();
38}
Strong< std::vector< uint8_t >, struct Session_Ticket_ > Session_Ticket
holds a TLS 1.2 session ticket for stateless resumption

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 40 of file msg_session_ticket_12.cpp.

40 {
41 auto buf = store_be<std::vector<uint8_t>>(m_ticket_lifetime_hint);
42 append_tls_length_value(buf, m_ticket.get(), 2);
43 return buf;
44}
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:177
constexpr auto store_be(ParamTs &&... params)
Definition loadstor.h:745

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

◆ ticket()

const Session_Ticket & Botan::TLS::New_Session_Ticket_12::ticket ( ) const
inline

Definition at line 393 of file tls_messages_12.h.

393{ return m_ticket; }

Referenced by New_Session_Ticket_12().

◆ ticket_lifetime_hint()

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

Definition at line 391 of file tls_messages_12.h.

391{ 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 389 of file tls_messages_12.h.

References Botan::TLS::NewSessionTicket.

◆ type_string()

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

Definition at line 21 of file tls_handshake_state.cpp.

21 {
23}
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
Returns
the wire representation of the message's type

Reimplemented in Botan::TLS::Hello_Retry_Request.

Definition at line 39 of file tls_handshake_msg.h.

39 {
40 // Usually equal to the Handshake_Type enum value,
41 // with the exception of TLS 1.3 Hello Retry Request.
42 return type();
43 }

References type().

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


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