Botan
1.11.15
|
#include <tls_messages.h>
Public Member Functions | |
u16bit | ciphersuite () const |
byte | compression_method () const |
std::set < Handshake_Extension_Type > | extension_types () const |
size_t | fragment_size () const |
bool | next_protocol_notification () const |
std::vector< std::string > | next_protocols () const |
bool | peer_can_send_heartbeats () const |
const std::vector< byte > & | random () const |
std::vector< byte > | renegotiation_info () const |
bool | secure_renegotiation () const |
Server_Hello (Handshake_IO &io, Handshake_Hash &hash, const Policy &policy, RandomNumberGenerator &rng, const std::vector< byte > &secure_reneg_info, const Client_Hello &client_hello, const std::vector< byte > &new_session_id, Protocol_Version new_session_version, u16bit ciphersuite, byte compression, bool offer_session_ticket, const std::vector< std::string > &next_protocols) | |
Server_Hello (Handshake_IO &io, Handshake_Hash &hash, const Policy &policy, RandomNumberGenerator &rng, const std::vector< byte > &secure_reneg_info, const Client_Hello &client_hello, Session &resumed_session, bool offer_session_ticket, const std::vector< std::string > &next_protocols) | |
Server_Hello (const std::vector< byte > &buf) | |
const std::vector< byte > & | session_id () const |
u16bit | srtp_profile () const |
bool | supports_heartbeats () const |
bool | supports_session_ticket () const |
Handshake_Type | type () const override |
Protocol_Version | version () const |
Server Hello Message
Definition at line 202 of file tls_messages.h.
Botan::TLS::Server_Hello::Server_Hello | ( | Handshake_IO & | io, |
Handshake_Hash & | hash, | ||
const Policy & | policy, | ||
RandomNumberGenerator & | rng, | ||
const std::vector< byte > & | secure_reneg_info, | ||
const Client_Hello & | client_hello, | ||
const std::vector< byte > & | new_session_id, | ||
Protocol_Version | new_session_version, | ||
u16bit | ciphersuite, | ||
byte | compression, | ||
bool | offer_session_ticket, | ||
const std::vector< std::string > & | next_protocols | ||
) |
Definition at line 20 of file msg_server_hello.cpp.
References Botan::Extensions::add(), c, Botan::TLS::Client_Hello::fragment_size(), Botan::TLS::Protocol_Version::is_datagram_protocol(), Botan::TLS::Policy::negotiate_heartbeat_support(), Botan::TLS::Client_Hello::next_protocol_notification(), Botan::TLS::Client_Hello::secure_renegotiation(), Botan::TLS::Handshake_IO::send(), Botan::TLS::Policy::srtp_profiles(), Botan::TLS::Client_Hello::srtp_profiles(), Botan::TLS::Client_Hello::supports_heartbeats(), Botan::TLS::Client_Hello::supports_session_ticket(), and Botan::TLS::Handshake_Hash::update().
: m_version(new_session_version), m_session_id(new_session_id), m_random(make_hello_random(rng, policy)), m_ciphersuite(ciphersuite), m_comp_method(compression) { if(client_hello.secure_renegotiation()) m_extensions.add(new Renegotiation_Extension(reneg_info)); if(client_hello.supports_session_ticket() && offer_session_ticket) m_extensions.add(new Session_Ticket()); if(size_t max_fragment_size = client_hello.fragment_size()) m_extensions.add(new Maximum_Fragment_Length(max_fragment_size)); if(policy.negotiate_heartbeat_support() && client_hello.supports_heartbeats()) m_extensions.add(new Heartbeat_Support_Indicator(true)); if(client_hello.next_protocol_notification()) m_extensions.add(new Next_Protocol_Notification(next_protocols)); if(m_version.is_datagram_protocol()) { const std::vector<u16bit> server_srtp = policy.srtp_profiles(); const std::vector<u16bit> client_srtp = client_hello.srtp_profiles(); if(!server_srtp.empty() && !client_srtp.empty()) { u16bit shared = 0; // always using server preferences for now for(auto s : server_srtp) for(auto c : client_srtp) { if(shared == 0 && s == c) shared = s; } if(shared) m_extensions.add(new SRTP_Protection_Profiles(shared)); } } hash.update(io.send(*this)); }
Botan::TLS::Server_Hello::Server_Hello | ( | Handshake_IO & | io, |
Handshake_Hash & | hash, | ||
const Policy & | policy, | ||
RandomNumberGenerator & | rng, | ||
const std::vector< byte > & | secure_reneg_info, | ||
const Client_Hello & | client_hello, | ||
Session & | resumed_session, | ||
bool | offer_session_ticket, | ||
const std::vector< std::string > & | next_protocols | ||
) |
Definition at line 78 of file msg_server_hello.cpp.
References Botan::Extensions::add(), Botan::TLS::Session::fragment_size(), Botan::TLS::Policy::negotiate_heartbeat_support(), Botan::TLS::Client_Hello::next_protocol_notification(), Botan::TLS::Client_Hello::secure_renegotiation(), Botan::TLS::Handshake_IO::send(), Botan::TLS::Client_Hello::supports_heartbeats(), Botan::TLS::Client_Hello::supports_session_ticket(), and Botan::TLS::Handshake_Hash::update().
: m_version(resumed_session.version()), m_session_id(client_hello.session_id()), m_random(make_hello_random(rng, policy)), m_ciphersuite(resumed_session.ciphersuite_code()), m_comp_method(resumed_session.compression_method()) { if(client_hello.secure_renegotiation()) m_extensions.add(new Renegotiation_Extension(reneg_info)); if(client_hello.supports_session_ticket() && offer_session_ticket) m_extensions.add(new Session_Ticket()); if(size_t max_fragment_size = resumed_session.fragment_size()) m_extensions.add(new Maximum_Fragment_Length(max_fragment_size)); if(policy.negotiate_heartbeat_support() && client_hello.supports_heartbeats()) m_extensions.add(new Heartbeat_Support_Indicator(true)); if(client_hello.next_protocol_notification()) m_extensions.add(new Next_Protocol_Notification(next_protocols)); hash.update(io.send(*this)); }
Botan::TLS::Server_Hello::Server_Hello | ( | const std::vector< byte > & | buf | ) |
Definition at line 114 of file msg_server_hello.cpp.
References Botan::TLS::TLS_Data_Reader::get_byte(), Botan::TLS::TLS_Data_Reader::get_fixed(), Botan::TLS::TLS_Data_Reader::get_range(), and Botan::TLS::TLS_Data_Reader::get_u16bit().
{ if(buf.size() < 38) throw Decoding_Error("Server_Hello: Packet corrupted"); TLS_Data_Reader reader("ServerHello", buf); const byte major_version = reader.get_byte(); const byte minor_version = reader.get_byte(); m_version = Protocol_Version(major_version, minor_version); m_random = reader.get_fixed<byte>(32); m_session_id = reader.get_range<byte>(1, 0, 32); m_ciphersuite = reader.get_u16bit(); m_comp_method = reader.get_byte(); m_extensions.deserialize(reader); }
u16bit Botan::TLS::Server_Hello::ciphersuite | ( | ) | const [inline] |
Definition at line 213 of file tls_messages.h.
{ return m_ciphersuite; }
byte Botan::TLS::Server_Hello::compression_method | ( | ) | const [inline] |
Definition at line 215 of file tls_messages.h.
{ return m_comp_method; }
std::set<Handshake_Extension_Type> Botan::TLS::Server_Hello::extension_types | ( | ) | const [inline] |
Definition at line 278 of file tls_messages.h.
{ return m_extensions.extension_types(); }
size_t Botan::TLS::Server_Hello::fragment_size | ( | ) | const [inline] |
Definition at line 241 of file tls_messages.h.
{ if(Maximum_Fragment_Length* frag = m_extensions.get<Maximum_Fragment_Length>()) return frag->fragment_size(); return 0; }
bool Botan::TLS::Server_Hello::next_protocol_notification | ( | ) | const [inline] |
Definition at line 229 of file tls_messages.h.
{
return m_extensions.has<Next_Protocol_Notification>();
}
std::vector<std::string> Botan::TLS::Server_Hello::next_protocols | ( | ) | const [inline] |
Definition at line 234 of file tls_messages.h.
{ if(Next_Protocol_Notification* npn = m_extensions.get<Next_Protocol_Notification>()) return npn->protocols(); return std::vector<std::string>(); }
bool Botan::TLS::Server_Hello::peer_can_send_heartbeats | ( | ) | const [inline] |
Definition at line 258 of file tls_messages.h.
{ if(Heartbeat_Support_Indicator* hb = m_extensions.get<Heartbeat_Support_Indicator>()) return hb->peer_allowed_to_send(); return false; }
const std::vector<byte>& Botan::TLS::Server_Hello::random | ( | ) | const [inline] |
Definition at line 209 of file tls_messages.h.
{ return m_random; }
std::vector<byte> Botan::TLS::Server_Hello::renegotiation_info | ( | ) | const [inline] |
Definition at line 222 of file tls_messages.h.
{ if(Renegotiation_Extension* reneg = m_extensions.get<Renegotiation_Extension>()) return reneg->renegotiation_info(); return std::vector<byte>(); }
bool Botan::TLS::Server_Hello::secure_renegotiation | ( | ) | const [inline] |
Definition at line 217 of file tls_messages.h.
{
return m_extensions.has<Renegotiation_Extension>();
}
const std::vector<byte>& Botan::TLS::Server_Hello::session_id | ( | ) | const [inline] |
Definition at line 211 of file tls_messages.h.
{ return m_session_id; }
u16bit Botan::TLS::Server_Hello::srtp_profile | ( | ) | const [inline] |
Definition at line 265 of file tls_messages.h.
{ if(SRTP_Protection_Profiles* srtp = m_extensions.get<SRTP_Protection_Profiles>()) { auto prof = srtp->profiles(); if(prof.size() != 1 || prof[0] == 0) throw Decoding_Error("Server sent malformed DTLS-SRTP extension"); return prof[0]; } return 0; }
bool Botan::TLS::Server_Hello::supports_heartbeats | ( | ) | const [inline] |
Definition at line 253 of file tls_messages.h.
{
return m_extensions.has<Heartbeat_Support_Indicator>();
}
bool Botan::TLS::Server_Hello::supports_session_ticket | ( | ) | const [inline] |
Definition at line 248 of file tls_messages.h.
{
return m_extensions.has<Session_Ticket>();
}
Handshake_Type Botan::TLS::Server_Hello::type | ( | ) | const [inline, override, virtual] |
Implements Botan::TLS::Handshake_Message.
Definition at line 205 of file tls_messages.h.
References Botan::TLS::SERVER_HELLO.
{ return SERVER_HELLO; }
Protocol_Version Botan::TLS::Server_Hello::version | ( | ) | const [inline] |
Definition at line 207 of file tls_messages.h.
{ return m_version; }