Botan 1.10.17
Botan::Server_Hello Class Reference

#include <tls_messages.h>

Inheritance diagram for Botan::Server_Hello:
Botan::HandshakeMessage

Public Member Functions

u16bit ciphersuite () const
byte compression_algo () const
const SecureVector< byte > & random () const
void send (Record_Writer &, HandshakeHash &) const
 Server_Hello (const MemoryRegion< byte > &buf)
 Server_Hello (RandomNumberGenerator &rng, Record_Writer &, const TLS_Policy &, const std::vector< X509_Certificate > &, const Client_Hello &, Version_Code, HandshakeHash &)
const SecureVector< byte > & session_id () const
Handshake_Type type () const
Version_Code version ()

Detailed Description

Server Hello Message

Definition at line 226 of file tls_messages.h.

Constructor & Destructor Documentation

◆ Server_Hello() [1/2]

Botan::Server_Hello::Server_Hello ( RandomNumberGenerator & rng,
Record_Writer & writer,
const TLS_Policy & policy,
const std::vector< X509_Certificate > & certs,
const Client_Hello & c_hello,
Version_Code ver,
HandshakeHash & hash )

Definition at line 223 of file hello.cpp.

230 {
231 bool have_rsa = false, have_dsa = false;
232
233 for(size_t i = 0; i != certs.size(); ++i)
234 {
235 Public_Key* key = certs[i].subject_public_key();
236 if(key->algo_name() == "RSA")
237 have_rsa = true;
238
239 if(key->algo_name() == "DSA")
240 have_dsa = true;
241 }
242
243 suite = policy.choose_suite(c_hello.ciphersuites(), have_rsa, have_dsa);
244
245 if(suite == 0)
247 "Can't agree on a ciphersuite with client");
248
249 comp_algo = policy.choose_compression(c_hello.compression_algos());
250
251 s_version = ver;
252 s_random = rng.random_vec(32);
253
254 send(writer, hash);
255 }
void send(Record_Writer &, HandshakeHash &) const
Definition hello.cpp:16
TLS_Exception(Alert_Type type, const std::string &err_msg="Unknown error")
Definition tls_exceptn.h:24
@ PROTOCOL_VERSION
Definition tls_magic.h:81

References Botan::Public_Key::algo_name(), Botan::TLS_Policy::choose_compression(), Botan::TLS_Policy::choose_suite(), Botan::Client_Hello::ciphersuites(), Botan::Client_Hello::compression_algos(), Botan::PROTOCOL_VERSION, Botan::RandomNumberGenerator::random_vec(), Botan::HandshakeMessage::send(), and Botan::TLS_Exception::TLS_Exception().

◆ Server_Hello() [2/2]

Botan::Server_Hello::Server_Hello ( const MemoryRegion< byte > & buf)
inline

Definition at line 242 of file tls_messages.h.

242{ deserialize(buf); }

Member Function Documentation

◆ ciphersuite()

u16bit Botan::Server_Hello::ciphersuite ( ) const
inline

Definition at line 232 of file tls_messages.h.

232{ return suite; }

◆ compression_algo()

byte Botan::Server_Hello::compression_algo ( ) const
inline

Definition at line 233 of file tls_messages.h.

233{ return comp_algo; }

◆ random()

const SecureVector< byte > & Botan::Server_Hello::random ( ) const
inline

Definition at line 235 of file tls_messages.h.

235{ return s_random; }

◆ send()

void Botan::HandshakeMessage::send ( Record_Writer & writer,
HandshakeHash & hash ) const
inherited

Definition at line 16 of file hello.cpp.

17 {
18 SecureVector<byte> buf = serialize();
19 SecureVector<byte> send_buf(4);
20
21 const size_t buf_size = buf.size();
22
23 send_buf[0] = type();
24
25 for(size_t i = 1; i != 4; ++i)
26 send_buf[i] = get_byte<u32bit>(i, buf_size);
27
28 send_buf += buf;
29
30 hash.update(send_buf);
31
32 writer.send(HANDSHAKE, &send_buf[0], send_buf.size());
33 writer.flush();
34 }
virtual Handshake_Type type() const =0
byte get_byte(size_t byte_num, T input)
Definition get_byte.h:21
@ HANDSHAKE
Definition tls_magic.h:36

References Botan::Record_Writer::flush(), Botan::get_byte(), Botan::HANDSHAKE, Botan::Record_Writer::send(), Botan::MemoryRegion< T >::size(), type(), and Botan::HandshakeHash::update().

Referenced by Botan::Certificate::Certificate(), Botan::Certificate_Req::Certificate_Req(), Botan::Certificate_Verify::Certificate_Verify(), Botan::Client_Hello::Client_Hello(), Botan::Client_Key_Exchange::Client_Key_Exchange(), Botan::Finished::Finished(), Botan::Hello_Request::Hello_Request(), Botan::Server_Hello::Server_Hello(), Botan::Server_Hello_Done::Server_Hello_Done(), and Botan::Server_Key_Exchange::Server_Key_Exchange().

◆ session_id()

const SecureVector< byte > & Botan::Server_Hello::session_id ( ) const
inline

Definition at line 231 of file tls_messages.h.

231{ return sess_id; }

◆ type()

Handshake_Type Botan::Server_Hello::type ( ) const
inlinevirtual

Implements Botan::HandshakeMessage.

Definition at line 229 of file tls_messages.h.

229{ return SERVER_HELLO; }
@ SERVER_HELLO
Definition tls_magic.h:44

References Botan::SERVER_HELLO.

◆ version()

Version_Code Botan::Server_Hello::version ( )
inline

Definition at line 230 of file tls_messages.h.

230{ return s_version; }

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