Botan: Botan::Server_Hello Class Reference

Botan 1.10.17

Public Member Functions | List of all members
Botan::Server_Hello Class Reference

`#include <tls_messages.h>`

Inheritance diagram for Botan::Server_Hello:

## Public Member Functions
u16bit | ciphersuite () const
byte | compression_algo () const
const SecureVector< byte > & | random () const
void | send (Record_Writer &, HandshakeHash &) const
| Server_Hello (RandomNumberGenerator &rng, Record_Writer &, const TLS_Policy &, const std::vector< X509_Certificate > &, const Client_Hello &, Version_Code, HandshakeHash &)
| Server_Hello (const MemoryRegion< byte > &buf)
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)
246 throw TLS_Exception(PROTOCOL_VERSION,
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 }
Botan::HandshakeMessage::send
void send(Record_Writer &, HandshakeHash &) const
Definition: hello.cpp:16
Botan::PROTOCOL_VERSION
Definition: tls_magic.h:81

## ◆ 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.

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

Referenced by Botan::Certificate::Certificate(), Botan::Certificate_Req::Certificate_Req(), Botan::Finished::Finished(), Botan::Hello_Request::Hello_Request(), and Botan::Server_Hello_Done::Server_Hello_Done().

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 }
Botan::HANDSHAKE
Definition: tls_magic.h:36
Botan::HandshakeMessage::type
virtual Handshake_Type type() const =0

## ◆ 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.

References Botan::SERVER_HELLO.

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

## ◆ 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:

- src/ssl/tls_messages.h
- src/ssl/hello.cpp