Botan  2.11.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::TLS::Handshake_State Class Reference

#include <tls_handshake_state.h>

Inherited by Botan::TLS::Server_Handshake_State.

Public Member Functions

Callbackscallbacks () const
 
void cert_req (Certificate_Req *cert_req)
 
const Certificate_Reqcert_req () const
 
std::pair< std::string, Signature_Formatchoose_sig_format (const Private_Key &key, Signature_Scheme &scheme, bool for_client_auth, const Policy &policy) const
 
const Ciphersuiteciphersuite () const
 
void client_certs (Certificate *client_certs)
 
const Certificateclient_certs () const
 
void client_finished (Finished *client_finished)
 
const Finishedclient_finished () const
 
void client_hello (Client_Hello *client_hello)
 
const Client_Helloclient_hello () const
 
void client_kex (Client_Key_Exchange *client_kex)
 
const Client_Key_Exchangeclient_kex () const
 
void client_verify (Certificate_Verify *client_verify)
 
const Certificate_Verifyclient_verify () const
 
void compute_session_keys ()
 
void compute_session_keys (const secure_vector< uint8_t > &resume_master_secret)
 
void confirm_transition_to (Handshake_Type msg_type)
 
std::pair< Handshake_Type, std::vector< uint8_t > > get_next_handshake_msg ()
 
Handshake_IOhandshake_io ()
 
 Handshake_State (Handshake_IO *io, Callbacks &callbacks)
 
 Handshake_State (const Handshake_State &)=delete
 
Handshake_Hashhash ()
 
const Handshake_Hashhash () const
 
void hello_verify_request (const Hello_Verify_Request &hello_verify)
 
void new_session_ticket (New_Session_Ticket *new_session_ticket)
 
const New_Session_Ticketnew_session_ticket () const
 
void note_message (const Handshake_Message &msg)
 
Handshake_Stateoperator= (const Handshake_State &)=delete
 
std::pair< std::string, Signature_Formatparse_sig_format (const Public_Key &key, Signature_Scheme scheme, bool for_client_auth, const Policy &policy) const
 
KDFprotocol_specific_prf () const
 
bool received_handshake_msg (Handshake_Type msg_type) const
 
void server_cert_status (Certificate_Status *server_cert_status)
 
const Certificate_Statusserver_cert_status () const
 
void server_certs (Certificate *server_certs)
 
const Certificateserver_certs () const
 
void server_finished (Finished *server_finished)
 
const Finishedserver_finished () const
 
void server_hello (Server_Hello *server_hello)
 
const Server_Helloserver_hello () const
 
void server_hello_done (Server_Hello_Done *server_hello_done)
 
const Server_Hello_Doneserver_hello_done () const
 
void server_kex (Server_Key_Exchange *server_kex)
 
const Server_Key_Exchangeserver_kex () const
 
const Session_Keyssession_keys () const
 
std::vector< uint8_t > session_ticket () const
 
void set_expected_next (Handshake_Type msg_type)
 
void set_version (const Protocol_Version &version)
 
std::string srp_identifier () const
 
Protocol_Version version () const
 
virtual ~Handshake_State ()=default
 

Detailed Description

SSL/TLS Handshake State

Definition at line 49 of file tls_handshake_state.h.

Constructor & Destructor Documentation

◆ Handshake_State() [1/2]

Botan::TLS::Handshake_State::Handshake_State ( Handshake_IO io,
Callbacks callbacks 
)

Definition at line 182 of file tls_handshake_state.cpp.

182  :
183  m_callbacks(cb),
184  m_handshake_io(io),
185  m_version(m_handshake_io->initial_record_version())
186  {
187  }

◆ ~Handshake_State()

virtual Botan::TLS::Handshake_State::~Handshake_State ( )
virtualdefault

◆ Handshake_State() [2/2]

Botan::TLS::Handshake_State::Handshake_State ( const Handshake_State )
delete

Member Function Documentation

◆ callbacks()

Callbacks& Botan::TLS::Handshake_State::callbacks ( ) const
inline

◆ cert_req() [1/2]

void Botan::TLS::Handshake_State::cert_req ( Certificate_Req cert_req)

Definition at line 243 of file tls_handshake_state.cpp.

References cert_req(), and note_message().

244  {
245  m_cert_req.reset(cert_req);
246  note_message(*m_cert_req);
247  }
const Certificate_Req * cert_req() const
void note_message(const Handshake_Message &msg)

◆ cert_req() [2/2]

const Certificate_Req* Botan::TLS::Handshake_State::cert_req ( ) const
inline

Definition at line 132 of file tls_handshake_state.h.

Referenced by cert_req(), choose_sig_format(), and parse_sig_format().

133  { return m_cert_req.get(); }

◆ choose_sig_format()

std::pair< std::string, Signature_Format > Botan::TLS::Handshake_State::choose_sig_format ( const Private_Key key,
Signature_Scheme scheme,
bool  for_client_auth,
const Policy policy 
) const

Definition at line 386 of file tls_handshake_state.cpp.

References Botan::Public_Key::algo_name(), Botan::TLS::Policy::allowed_signature_hash(), Botan::TLS::Policy::allowed_signature_schemes(), cert_req(), client_hello(), Botan::DER_SEQUENCE, Botan::TLS::DSA_SHA1, Botan::TLS::ECDSA_SHA1, Botan::TLS::Alert::HANDSHAKE_FAILURE, hash(), Botan::TLS::hash_function_of_scheme(), Botan::IEEE_1363, Botan::TLS::padding_string_for_scheme(), Botan::TLS::RSA_PKCS1_SHA1, Botan::TLS::signature_algorithm_of_scheme(), Botan::TLS::signature_scheme_is_known(), Botan::TLS::Client_Hello::signature_schemes(), Botan::TLS::Certificate_Req::signature_schemes(), and version().

Referenced by Botan::TLS::Certificate_Verify::Certificate_Verify(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().

390  {
391  const std::string sig_algo = key.algo_name();
392 
393  if(this->version().supports_negotiable_signature_algorithms())
394  {
395  const std::vector<Signature_Scheme> allowed = policy.allowed_signature_schemes();
396 
397  std::vector<Signature_Scheme> requested =
398  (for_client_auth) ? cert_req()->signature_schemes() : client_hello()->signature_schemes();
399 
400  if(requested.empty())
401  {
402  // Implicit SHA-1
403  requested.push_back(Signature_Scheme::RSA_PKCS1_SHA1);
404  requested.push_back(Signature_Scheme::ECDSA_SHA1);
405  requested.push_back(Signature_Scheme::DSA_SHA1);
406  }
407 
408  for(Signature_Scheme scheme : allowed)
409  {
410  if(signature_scheme_is_known(scheme) == false)
411  {
412  continue;
413  }
414 
415  if(signature_algorithm_of_scheme(scheme) == sig_algo)
416  {
417  if(std::find(requested.begin(), requested.end(), scheme) != requested.end())
418  {
419  chosen_scheme = scheme;
420  break;
421  }
422  }
423  }
424 
425  const std::string hash = hash_function_of_scheme(chosen_scheme);
426 
427  if(!policy.allowed_signature_hash(hash))
428  {
429  throw TLS_Exception(Alert::HANDSHAKE_FAILURE,
430  "Policy refuses to accept signing with any hash supported by peer");
431  }
432 
433  if(sig_algo == "RSA")
434  {
435  return std::make_pair(padding_string_for_scheme(chosen_scheme), IEEE_1363);
436  }
437  else if(sig_algo == "DSA" || sig_algo == "ECDSA")
438  {
439  return std::make_pair(padding_string_for_scheme(chosen_scheme), DER_SEQUENCE);
440  }
441  }
442  else
443  {
444  if(sig_algo == "RSA")
445  {
446  const std::string padding = "PKCS1v15(Parallel(MD5,SHA-160))";
447  return std::make_pair(padding, IEEE_1363);
448  }
449  else if(sig_algo == "DSA" || sig_algo == "ECDSA")
450  {
451  const std::string padding = "EMSA1(SHA-1)";
452  return std::make_pair(padding, DER_SEQUENCE);
453  }
454  }
455 
456  throw Invalid_Argument(sig_algo + " is invalid/unknown for TLS signatures");
457  }
std::string hash_function_of_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:191
Signature_Scheme
Definition: tls_algos.h:84
std::string padding_string_for_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:379
bool signature_scheme_is_known(Signature_Scheme scheme)
Definition: tls_algos.cpp:262
const Certificate_Req * cert_req() const
std::vector< Signature_Scheme > signature_schemes() const
std::string signature_algorithm_of_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:291
Protocol_Version version() const
const Client_Hello * client_hello() const
const std::vector< Signature_Scheme > & signature_schemes() const
Definition: tls_messages.h:433

◆ ciphersuite()

const Ciphersuite& Botan::TLS::Handshake_State::ciphersuite ( ) const
inline

◆ client_certs() [1/2]

void Botan::TLS::Handshake_State::client_certs ( Certificate client_certs)

Definition at line 255 of file tls_handshake_state.cpp.

References client_certs(), and note_message().

256  {
257  m_client_certs.reset(client_certs);
258  note_message(*m_client_certs);
259  }
const Certificate * client_certs() const
void note_message(const Handshake_Message &msg)

◆ client_certs() [2/2]

const Certificate* Botan::TLS::Handshake_State::client_certs ( ) const
inline

Definition at line 138 of file tls_handshake_state.h.

Referenced by client_certs().

139  { return m_client_certs.get(); }

◆ client_finished() [1/2]

void Botan::TLS::Handshake_State::client_finished ( Finished client_finished)

Definition at line 285 of file tls_handshake_state.cpp.

References client_finished(), and note_message().

286  {
287  m_client_finished.reset(client_finished);
288  note_message(*m_client_finished);
289  }
const Finished * client_finished() const
void note_message(const Handshake_Message &msg)

◆ client_finished() [2/2]

const Finished* Botan::TLS::Handshake_State::client_finished ( ) const
inline

Definition at line 156 of file tls_handshake_state.h.

Referenced by client_finished().

157  { return m_client_finished.get(); }

◆ client_hello() [1/2]

void Botan::TLS::Handshake_State::client_hello ( Client_Hello client_hello)

Definition at line 204 of file tls_handshake_state.cpp.

References client_hello(), hash(), note_message(), and Botan::TLS::Handshake_Hash::reset().

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), Botan::TLS::Session_Keys::Session_Keys(), and Botan::TLS::Server_Key_Exchange::verify().

205  {
206  if(client_hello == nullptr)
207  {
208  m_client_hello.reset();
209  hash().reset();
210  }
211  else
212  {
213  m_client_hello.reset(client_hello);
214  note_message(*m_client_hello);
215  }
216  }
void note_message(const Handshake_Message &msg)
const Client_Hello * client_hello() const

◆ client_hello() [2/2]

const Client_Hello* Botan::TLS::Handshake_State::client_hello ( ) const
inline

Definition at line 120 of file tls_handshake_state.h.

Referenced by choose_sig_format(), client_hello(), parse_sig_format(), session_ticket(), and srp_identifier().

121  { return m_client_hello.get(); }

◆ client_kex() [1/2]

void Botan::TLS::Handshake_State::client_kex ( Client_Key_Exchange client_kex)

Definition at line 261 of file tls_handshake_state.cpp.

References client_kex(), and note_message().

262  {
263  m_client_kex.reset(client_kex);
264  note_message(*m_client_kex);
265  }
const Client_Key_Exchange * client_kex() const
void note_message(const Handshake_Message &msg)

◆ client_kex() [2/2]

const Client_Key_Exchange* Botan::TLS::Handshake_State::client_kex ( ) const
inline

Definition at line 141 of file tls_handshake_state.h.

Referenced by client_kex(), and compute_session_keys().

142  { return m_client_kex.get(); }

◆ client_verify() [1/2]

void Botan::TLS::Handshake_State::client_verify ( Certificate_Verify client_verify)

Definition at line 267 of file tls_handshake_state.cpp.

References client_verify(), and note_message().

268  {
269  m_client_verify.reset(client_verify);
270  note_message(*m_client_verify);
271  }
const Certificate_Verify * client_verify() const
void note_message(const Handshake_Message &msg)

◆ client_verify() [2/2]

const Certificate_Verify* Botan::TLS::Handshake_State::client_verify ( ) const
inline

Definition at line 144 of file tls_handshake_state.h.

Referenced by client_verify().

145  { return m_client_verify.get(); }

◆ compute_session_keys() [1/2]

void Botan::TLS::Handshake_State::compute_session_keys ( )

Definition at line 296 of file tls_handshake_state.cpp.

References client_kex().

297  {
298  m_session_keys = Session_Keys(this, client_kex()->pre_master_secret(), false);
299  }
const Client_Key_Exchange * client_kex() const

◆ compute_session_keys() [2/2]

void Botan::TLS::Handshake_State::compute_session_keys ( const secure_vector< uint8_t > &  resume_master_secret)

Definition at line 301 of file tls_handshake_state.cpp.

302  {
303  m_session_keys = Session_Keys(this, resume_master_secret, true);
304  }

◆ confirm_transition_to()

void Botan::TLS::Handshake_State::confirm_transition_to ( Handshake_Type  msg_type)

Confirm that we were expecting this message type

Parameters
msg_typethe message type

Definition at line 306 of file tls_handshake_state.cpp.

307  {
308  const uint32_t mask = bitmask_for_handshake_type(handshake_msg);
309 
310  m_hand_received_mask |= mask;
311 
312  const bool ok = (m_hand_expecting_mask & mask) != 0; // overlap?
313 
314  if(!ok)
315  {
316  throw Unexpected_Message("Unexpected state transition in handshake, expected " +
317  handshake_mask_to_string(m_hand_expecting_mask, '|') +
318  " received " + handshake_mask_to_string(m_hand_received_mask, '+'));
319  }
320 
321  /* We don't know what to expect next, so force a call to
322  set_expected_next; if it doesn't happen, the next transition
323  check will always fail which is what we want.
324  */
325  m_hand_expecting_mask = 0;
326  }

◆ get_next_handshake_msg()

std::pair< Handshake_Type, std::vector< uint8_t > > Botan::TLS::Handshake_State::get_next_handshake_msg ( )

Definition at line 341 of file tls_handshake_state.cpp.

References Botan::TLS::HANDSHAKE_CCS.

342  {
343  const bool expecting_ccs =
344  (bitmask_for_handshake_type(HANDSHAKE_CCS) & m_hand_expecting_mask) != 0;
345 
346  return m_handshake_io->get_next_record(expecting_ccs);
347  }

◆ handshake_io()

Handshake_IO& Botan::TLS::Handshake_State::handshake_io ( )
inline

Definition at line 59 of file tls_handshake_state.h.

Referenced by hello_verify_request().

59 { return *m_handshake_io; }

◆ hash() [1/2]

Handshake_Hash& Botan::TLS::Handshake_State::hash ( )
inline

◆ hash() [2/2]

const Handshake_Hash& Botan::TLS::Handshake_State::hash ( ) const
inline

Definition at line 171 of file tls_handshake_state.h.

171 { return m_handshake_hash; }

◆ hello_verify_request()

void Botan::TLS::Handshake_State::hello_verify_request ( const Hello_Verify_Request hello_verify)

Definition at line 194 of file tls_handshake_state.cpp.

References handshake_io(), hash(), note_message(), Botan::TLS::Handshake_Hash::reset(), and Botan::TLS::Handshake_Hash::update().

195  {
196  note_message(hello_verify);
197 
198  m_client_hello->update_hello_cookie(hello_verify);
199  hash().reset();
200  hash().update(handshake_io().send(*m_client_hello));
201  note_message(*m_client_hello);
202  }
void update(const uint8_t in[], size_t length)
void note_message(const Handshake_Message &msg)

◆ new_session_ticket() [1/2]

void Botan::TLS::Handshake_State::new_session_ticket ( New_Session_Ticket new_session_ticket)

Definition at line 273 of file tls_handshake_state.cpp.

References new_session_ticket(), and note_message().

274  {
275  m_new_session_ticket.reset(new_session_ticket);
276  note_message(*m_new_session_ticket);
277  }
void note_message(const Handshake_Message &msg)
const New_Session_Ticket * new_session_ticket() const

◆ new_session_ticket() [2/2]

const New_Session_Ticket* Botan::TLS::Handshake_State::new_session_ticket ( ) const
inline

Definition at line 150 of file tls_handshake_state.h.

Referenced by new_session_ticket(), and session_ticket().

151  { return m_new_session_ticket.get(); }

◆ note_message()

void Botan::TLS::Handshake_State::note_message ( const Handshake_Message msg)

◆ operator=()

Handshake_State& Botan::TLS::Handshake_State::operator= ( const Handshake_State )
delete

◆ parse_sig_format()

std::pair< std::string, Signature_Format > Botan::TLS::Handshake_State::parse_sig_format ( const Public_Key key,
Signature_Scheme  scheme,
bool  for_client_auth,
const Policy policy 
) const

Definition at line 482 of file tls_handshake_state.cpp.

References Botan::Public_Key::algo_name(), Botan::TLS::Policy::allowed_signature_method(), cert_req(), client_hello(), Botan::DER_SEQUENCE, Botan::TLS::Alert::HANDSHAKE_FAILURE, hash_algo, Botan::TLS::hash_function_of_scheme(), Botan::IEEE_1363, Botan::TLS::Alert::ILLEGAL_PARAMETER, Botan::TLS::NONE, Botan::TLS::padding_string_for_scheme(), Botan::TLS::signature_algorithm_of_scheme(), Botan::TLS::signature_scheme_is_known(), Botan::TLS::Client_Hello::signature_schemes(), Botan::TLS::Certificate_Req::signature_schemes(), and version().

Referenced by Botan::TLS::Certificate_Verify::verify(), and Botan::TLS::Server_Key_Exchange::verify().

486  {
487  const std::string key_type = key.algo_name();
488 
489  if(!policy.allowed_signature_method(key_type))
490  {
491  throw TLS_Exception(Alert::HANDSHAKE_FAILURE,
492  "Rejecting " + key_type + " signature");
493  }
494 
495  if(this->version().supports_negotiable_signature_algorithms() == false)
496  {
497  if(scheme != Signature_Scheme::NONE)
498  throw Decoding_Error("Counterparty sent hash/sig IDs with old version");
499 
500  /*
501  There is no check on the acceptability of a v1.0/v1.1 hash type,
502  since it's implicit with use of the protocol
503  */
504 
505  if(key_type == "RSA")
506  {
507  const std::string padding = "PKCS1v15(Parallel(MD5,SHA-160))";
508  return std::make_pair(padding, IEEE_1363);
509  }
510  else if(key_type == "DSA" || key_type == "ECDSA")
511  {
512  const std::string padding = "EMSA1(SHA-1)";
513  return std::make_pair(padding, DER_SEQUENCE);
514  }
515  else
516  throw Invalid_Argument(key_type + " is invalid/unknown for TLS signatures");
517  }
518 
519  if(scheme == Signature_Scheme::NONE)
520  throw Decoding_Error("Counterparty did not send hash/sig IDS");
521 
522  if(key_type != signature_algorithm_of_scheme(scheme))
523  throw Decoding_Error("Counterparty sent inconsistent key and sig types");
524 
525  if(for_client_auth && !cert_req())
526  {
527  throw TLS_Exception(Alert::HANDSHAKE_FAILURE,
528  "No certificate verify set");
529  }
530 
531  /*
532  Confirm the signature type we just received against the
533  supported_algos list that we sent; it better be there.
534  */
535 
536  const std::vector<Signature_Scheme> supported_algos =
537  for_client_auth ? cert_req()->signature_schemes() :
539 
540  if(!signature_scheme_is_known(scheme))
541  throw TLS_Exception(Alert::HANDSHAKE_FAILURE,
542  "Peer sent unknown signature scheme");
543 
544  const std::string hash_algo = hash_function_of_scheme(scheme);
545 
546  if(!supported_algos_include(supported_algos, key_type, hash_algo))
547  {
548  throw TLS_Exception(Alert::ILLEGAL_PARAMETER,
549  "TLS signature extension did not allow for " +
550  key_type + "/" + hash_algo + " signature");
551  }
552 
553  if(key_type == "RSA")
554  {
555  return std::make_pair(padding_string_for_scheme(scheme), IEEE_1363);
556  }
557  else if(key_type == "DSA" || key_type == "ECDSA")
558  {
559  return std::make_pair(padding_string_for_scheme(scheme), DER_SEQUENCE);
560  }
561 
562  throw Invalid_Argument(key_type + " is invalid/unknown for TLS signatures");
563  }
std::string hash_function_of_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:191
std::string padding_string_for_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:379
bool signature_scheme_is_known(Signature_Scheme scheme)
Definition: tls_algos.cpp:262
const Certificate_Req * cert_req() const
std::vector< Signature_Scheme > signature_schemes() const
AlgorithmIdentifier hash_algo
Definition: x509_obj.cpp:23
std::string signature_algorithm_of_scheme(Signature_Scheme scheme)
Definition: tls_algos.cpp:291
Protocol_Version version() const
const Client_Hello * client_hello() const
const std::vector< Signature_Scheme > & signature_schemes() const
Definition: tls_messages.h:433

◆ protocol_specific_prf()

KDF * Botan::TLS::Handshake_State::protocol_specific_prf ( ) const

Definition at line 369 of file tls_handshake_state.cpp.

References ciphersuite(), Botan::get_kdf(), Botan::TLS::Ciphersuite::prf_algo(), and version().

Referenced by Botan::TLS::Session_Keys::Session_Keys().

370  {
371  if(version().supports_ciphersuite_specific_prf())
372  {
373  const std::string prf_algo = ciphersuite().prf_algo();
374 
375  if(prf_algo == "MD5" || prf_algo == "SHA-1")
376  return get_kdf("TLS-12-PRF(SHA-256)");
377 
378  return get_kdf("TLS-12-PRF(" + prf_algo + ")");
379  }
380 
381  // Old PRF used in TLS v1.0, v1.1 and DTLS v1.0
382  return get_kdf("TLS-PRF");
383  }
std::string prf_algo() const
const Ciphersuite & ciphersuite() const
KDF * get_kdf(const std::string &algo_spec)
Definition: kdf.cpp:237
Protocol_Version version() const

◆ received_handshake_msg()

bool Botan::TLS::Handshake_State::received_handshake_msg ( Handshake_Type  msg_type) const

Return true iff we have received a particular message already

Parameters
msg_typethe message type

Definition at line 333 of file tls_handshake_state.cpp.

334  {
335  const uint32_t mask = bitmask_for_handshake_type(handshake_msg);
336 
337  return (m_hand_received_mask & mask) != 0;
338  }

◆ server_cert_status() [1/2]

void Botan::TLS::Handshake_State::server_cert_status ( Certificate_Status server_cert_status)

Definition at line 231 of file tls_handshake_state.cpp.

References note_message(), and server_cert_status().

232  {
233  m_server_cert_status.reset(server_cert_status);
234  note_message(*m_server_cert_status);
235  }
const Certificate_Status * server_cert_status() const
void note_message(const Handshake_Message &msg)

◆ server_cert_status() [2/2]

const Certificate_Status* Botan::TLS::Handshake_State::server_cert_status ( ) const
inline

Definition at line 147 of file tls_handshake_state.h.

Referenced by server_cert_status().

148  { return m_server_cert_status.get(); }

◆ server_certs() [1/2]

void Botan::TLS::Handshake_State::server_certs ( Certificate server_certs)

Definition at line 225 of file tls_handshake_state.cpp.

References note_message(), and server_certs().

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().

226  {
227  m_server_certs.reset(server_certs);
228  note_message(*m_server_certs);
229  }
const Certificate * server_certs() const
void note_message(const Handshake_Message &msg)

◆ server_certs() [2/2]

const Certificate* Botan::TLS::Handshake_State::server_certs ( ) const
inline

Definition at line 126 of file tls_handshake_state.h.

Referenced by server_certs().

127  { return m_server_certs.get(); }

◆ server_finished() [1/2]

void Botan::TLS::Handshake_State::server_finished ( Finished server_finished)

Definition at line 279 of file tls_handshake_state.cpp.

References note_message(), and server_finished().

280  {
281  m_server_finished.reset(server_finished);
282  note_message(*m_server_finished);
283  }
const Finished * server_finished() const
void note_message(const Handshake_Message &msg)

◆ server_finished() [2/2]

const Finished* Botan::TLS::Handshake_State::server_finished ( ) const
inline

Definition at line 153 of file tls_handshake_state.h.

Referenced by server_finished().

154  { return m_server_finished.get(); }

◆ server_hello() [1/2]

void Botan::TLS::Handshake_State::server_hello ( Server_Hello server_hello)

Definition at line 218 of file tls_handshake_state.cpp.

References Botan::TLS::Ciphersuite::by_id(), note_message(), and server_hello().

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Server_Key_Exchange::Server_Key_Exchange(), Botan::TLS::Session_Keys::Session_Keys(), and Botan::TLS::Server_Key_Exchange::verify().

219  {
220  m_server_hello.reset(server_hello);
221  m_ciphersuite = Ciphersuite::by_id(m_server_hello->ciphersuite());
222  note_message(*m_server_hello);
223  }
const Server_Hello * server_hello() const
void note_message(const Handshake_Message &msg)
static Ciphersuite by_id(uint16_t suite)

◆ server_hello() [2/2]

const Server_Hello* Botan::TLS::Handshake_State::server_hello ( ) const
inline

Definition at line 123 of file tls_handshake_state.h.

Referenced by server_hello().

124  { return m_server_hello.get(); }

◆ server_hello_done() [1/2]

void Botan::TLS::Handshake_State::server_hello_done ( Server_Hello_Done server_hello_done)

Definition at line 249 of file tls_handshake_state.cpp.

References note_message(), and server_hello_done().

250  {
251  m_server_hello_done.reset(server_hello_done);
252  note_message(*m_server_hello_done);
253  }
void note_message(const Handshake_Message &msg)
const Server_Hello_Done * server_hello_done() const

◆ server_hello_done() [2/2]

const Server_Hello_Done* Botan::TLS::Handshake_State::server_hello_done ( ) const
inline

Definition at line 135 of file tls_handshake_state.h.

Referenced by server_hello_done().

136  { return m_server_hello_done.get(); }

◆ server_kex() [1/2]

void Botan::TLS::Handshake_State::server_kex ( Server_Key_Exchange server_kex)

Definition at line 237 of file tls_handshake_state.cpp.

References note_message(), and server_kex().

Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().

238  {
239  m_server_kex.reset(server_kex);
240  note_message(*m_server_kex);
241  }
const Server_Key_Exchange * server_kex() const
void note_message(const Handshake_Message &msg)

◆ server_kex() [2/2]

const Server_Key_Exchange* Botan::TLS::Handshake_State::server_kex ( ) const
inline

Definition at line 129 of file tls_handshake_state.h.

Referenced by server_kex().

130  { return m_server_kex.get(); }

◆ session_keys()

const Session_Keys& Botan::TLS::Handshake_State::session_keys ( ) const
inline

Definition at line 161 of file tls_handshake_state.h.

161 { return m_session_keys; }

◆ session_ticket()

std::vector< uint8_t > Botan::TLS::Handshake_State::session_ticket ( ) const

Definition at line 361 of file tls_handshake_state.cpp.

References client_hello(), new_session_ticket(), Botan::TLS::Client_Hello::session_ticket(), and Botan::TLS::New_Session_Ticket::ticket().

362  {
363  if(new_session_ticket() && !new_session_ticket()->ticket().empty())
364  return new_session_ticket()->ticket();
365 
366  return client_hello()->session_ticket();
367  }
std::vector< uint8_t > session_ticket() const
const std::vector< uint8_t > & ticket() const
Definition: tls_messages.h:617
const New_Session_Ticket * new_session_ticket() const
const Client_Hello * client_hello() const

◆ set_expected_next()

void Botan::TLS::Handshake_State::set_expected_next ( Handshake_Type  msg_type)

Record that we are expecting a particular message type next

Parameters
msg_typethe message type

Definition at line 328 of file tls_handshake_state.cpp.

329  {
330  m_hand_expecting_mask |= bitmask_for_handshake_type(handshake_msg);
331  }

◆ set_version()

void Botan::TLS::Handshake_State::set_version ( const Protocol_Version version)

Definition at line 291 of file tls_handshake_state.cpp.

References version().

292  {
293  m_version = version;
294  }
Protocol_Version version() const

◆ srp_identifier()

std::string Botan::TLS::Handshake_State::srp_identifier ( ) const

Definition at line 349 of file tls_handshake_state.cpp.

References ciphersuite(), client_hello(), and Botan::TLS::SRP_SHA.

350  {
351 #if defined(BOTAN_HAS_SRP6)
352  // Authenticated via the successful key exchange
353  if(ciphersuite().valid() && ciphersuite().kex_method() == Kex_Algo::SRP_SHA)
354  return client_hello()->srp_identifier();
355 #endif
356 
357  return "";
358  }
const Ciphersuite & ciphersuite() const
const Client_Hello * client_hello() const

◆ version()

Protocol_Version Botan::TLS::Handshake_State::version ( ) const
inline

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