Botan: Botan::Client_Hello Class Reference

Botan 1.10.17

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

`#include <tls_messages.h>`

Inheritance diagram for Botan::Client_Hello:

## Public Member Functions
std::vector< u16bit > | ciphersuites () const
| Client_Hello (RandomNumberGenerator &rng, Record_Writer &, const TLS_Policy &, HandshakeHash &)
| Client_Hello (const MemoryRegion< byte > &buf, Handshake_Type type)
std::vector< byte > | compression_algos () const
std::string | hostname () const
bool | offered_suite (u16bit) const
const SecureVector< byte > & | random () const
void | send (Record_Writer &, HandshakeHash &) const
const SecureVector< byte > & | session_id () const
std::string | srp_identifier () const
Handshake_Type | type () const
Version_Code | version () const

## Detailed Description

Client Hello Message

Definition at line 41 of file tls_messages.h.

## Constructor & Destructor Documentation

## ◆ Client_Hello() [1/2]

Botan::Client_Hello::Client_Hello | ( | RandomNumberGenerator & | rng,
|  | Record_Writer & | writer,
|  | const TLS_Policy & | policy,
|  | HandshakeHash & | hash
| ) |  |

Definition at line 65 of file hello.cpp.

69 {
70 c_random = rng.random_vec(32);
71
72 suites = policy.ciphersuites();
73 comp_algos = policy.compression();
74 c_version = policy.pref_version();
75
76 send(writer, hash);
77 }
Botan::HandshakeMessage::send
void send(Record_Writer &, HandshakeHash &) const
Definition: hello.cpp:16

## ◆ Client_Hello() [2/2]

Botan::Client_Hello::Client_Hello | ( | const MemoryRegion< byte > & | buf,
|  | Handshake_Type | type
| ) |  |
| inline

Definition at line 61 of file tls_messages.h.

References Botan::CLIENT_HELLO, and type().

63 {
64 if(type == CLIENT_HELLO)
65 deserialize(buf);
66 else
67 deserialize_sslv2(buf);
68 }
Botan::Client_Hello::type
Handshake_Type type() const
Definition: tls_messages.h:44
Botan::CLIENT_HELLO
Definition: tls_magic.h:42

## Member Function Documentation

## ◆ ciphersuites()

std::vector<u16bit> Botan::Client_Hello::ciphersuites | ( |  | ) | const
| inline

Definition at line 47 of file tls_messages.h.

47 { return suites; }

## ◆ compression_algos()

std::vector<byte> Botan::Client_Hello::compression_algos | ( |  | ) | const
| inline

Definition at line 48 of file tls_messages.h.

48 { return comp_algos; }

## ◆ hostname()

std::string Botan::Client_Hello::hostname | ( |  | ) | const
| inline

Definition at line 52 of file tls_messages.h.

52 { return requested_hostname; }

## ◆ offered_suite()

bool Botan::Client_Hello::offered_suite | ( | u16bit | ciphersuite | ) | const

Definition at line 212 of file hello.cpp.

213 {
214 for(size_t i = 0; i != suites.size(); ++i)
215 if(suites[i] == ciphersuite)
216 return true;
217 return false;
218 }

## ◆ random()

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

Definition at line 50 of file tls_messages.h.

50 { return c_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::Client_Hello::session_id | ( |  | ) | const
| inline

Definition at line 46 of file tls_messages.h.

46 { return sess_id; }

## ◆ srp_identifier()

std::string Botan::Client_Hello::srp_identifier | ( |  | ) | const
| inline

Definition at line 54 of file tls_messages.h.

54 { return requested_srp_id; }

## ◆ type()

Handshake_Type Botan::Client_Hello::type | ( |  | ) | const
| inlinevirtual

Implements Botan::HandshakeMessage.

Definition at line 44 of file tls_messages.h.

References Botan::CLIENT_HELLO.

Referenced by Client_Hello().

44 { return CLIENT_HELLO; }
Botan::CLIENT_HELLO
Definition: tls_magic.h:42

## ◆ version()

Version_Code Botan::Client_Hello::version | ( |  | ) | const
| inline

Definition at line 45 of file tls_messages.h.

45 { return c_version; }

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

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