Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
Botan::TLS::Signature_Algorithms Class Referencefinal

`#include <tls_extensions.h>`

Inheritance diagram for Botan::TLS::Signature_Algorithms:

## Public Member Functions
bool | empty () const override
std::vector< uint8_t > | serialize (Connection_Side whoami) const override
| Signature_Algorithms (const std::vector< Signature_Scheme > &schemes)
| Signature_Algorithms (TLS_Data_Reader &reader, uint16_t extension_size)
const std::vector< Signature_Scheme > & | supported_schemes () const
Handshake_Extension_Type | type () const override

## Static Public Member Functions
static Handshake_Extension_Type | static_type ()

## Detailed Description

Signature Algorithms Extension for TLS 1.2 (RFC 5246)

Definition at line 302 of file tls_extensions.h.

## Constructor & Destructor Documentation

Botan::TLS::Signature_Algorithms::Signature_Algorithms | ( | const std::vector< Signature_Scheme > & | schemes | ) |
| inline explicit

Definition at line 316 of file tls_extensions.h.

316 :
317 m_schemes(schemes) {}

Botan::TLS::Signature_Algorithms::Signature_Algorithms | ( | TLS_Data_Reader & | reader,
|  | uint16_t | extension_size
| ) |  |

Definition at line 441 of file tls_extensions.cpp.

References Botan::TLS::TLS_Data_Reader::get_uint16_t().

443 {
444 uint16_t len = reader.get_uint16_t();
445
446 if(len + 2 != extension_size || len % 2 == 1 || len == 0)
447 {
448 throw Decoding_Error("Bad encoding on signature algorithms extension");
449 }
450
451 while(len)
452 {
453 const uint16_t scheme_code = reader.get_uint16_t();
454 m_schemes.push_back(static_cast<Signature_Scheme>(scheme_code));
455 len -= 2;
456 }
457 }

## Member Function Documentation

bool Botan::TLS::Signature_Algorithms::empty | ( |  | ) | const
| inline override virtual

Returns
  if we should encode this extension or not

Implements Botan::TLS::Extension.

Definition at line 314 of file tls_extensions.h.

314 { return m_schemes.empty(); }

std::vector< uint8_t > Botan::TLS::Signature_Algorithms::serialize | ( | Connection_Side | whoami | ) | const
| override virtual

Returns
  serialized binary for the extension

Implements Botan::TLS::Extension.

Definition at line 419 of file tls_extensions.cpp.

References BOTAN_ASSERT, and Botan::get_byte().

420 {
421 BOTAN_ASSERT(m_schemes.size() < 256, "Too many signature schemes");
422
423 std::vector<uint8_t> buf;
424
425 const uint16_t len = static_cast<uint16_t>(m_schemes.size() * 2);
426
427 buf.push_back(get_byte(0, len));
428 buf.push_back(get_byte(1, len));
429
430 for(Signature_Scheme scheme : m_schemes)
431 {
432 const uint16_t scheme_code = static_cast<uint16_t>(scheme);
433
434 buf.push_back(get_byte(0, scheme_code));
435 buf.push_back(get_byte(1, scheme_code));
436 }
437
438 return buf;
439 }
Botan::TLS::Signature_Scheme
Signature_Scheme
Definition: tls_algos.h:86
Botan::get_byte
constexpr uint8_t get_byte(size_t byte_num, T input)
Definition: loadstor.h:41
BOTAN_ASSERT
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:55

static Handshake_Extension_Type Botan::TLS::Signature_Algorithms::static_type | ( |  | ) |
| inline static

Definition at line 305 of file tls_extensions.h.

References Botan::TLS::TLSEXT_SIGNATURE_ALGORITHMS.

306 { return TLSEXT_SIGNATURE_ALGORITHMS; }
Botan::TLS::TLSEXT_SIGNATURE_ALGORITHMS
Definition: tls_extensions.h:40

const std::vector<Signature_Scheme>& Botan::TLS::Signature_Algorithms::supported_schemes | ( |  | ) | const
| inline

Definition at line 310 of file tls_extensions.h.

310 { return m_schemes; }

Handshake_Extension_Type Botan::TLS::Signature_Algorithms::type | ( |  | ) | const
| inline override virtual

Returns
  code number of the extension

Implements Botan::TLS::Extension.

Definition at line 308 of file tls_extensions.h.

308 { return static_type(); }
Botan::TLS::Signature_Algorithms::static_type
static Handshake_Extension_Type static_type()
Definition: tls_extensions.h:305

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

- src/lib/tls/tls_extensions.h
- src/lib/tls/tls_extensions.cpp