Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

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

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

`#include <tls_extensions.h>`

Inheritance diagram for Botan::TLS::Supported_Point_Formats:

## Public Types
enum | ECPointFormat : uint8_t { UNCOMPRESSED = 0, ANSIX962_COMPRESSED_PRIME = 1, ANSIX962_COMPRESSED_CHAR2 = 2 }

## Public Member Functions
bool | empty () const override
bool | prefers_compressed ()
std::vector< uint8_t > | serialize () const override
| Supported_Point_Formats (bool prefer_compressed)
| Supported_Point_Formats (TLS_Data_Reader &reader, uint16_t extension_size)
Handshake_Extension_Type | type () const override

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

## Detailed Description

Supported Point Formats Extension (RFC 4492)

Definition at line 261 of file tls_extensions.h.

## Member Enumeration Documentation

enum Botan::TLS::Supported_Point_Formats::ECPointFormat : uint8_t

Enumerator
UNCOMPRESSED |
ANSIX962_COMPRESSED_PRIME |
ANSIX962_COMPRESSED_CHAR2 |

Definition at line 264 of file tls_extensions.h.

264 : uint8_t {
265 UNCOMPRESSED = 0,
266 ANSIX962_COMPRESSED_PRIME = 1,
267 ANSIX962_COMPRESSED_CHAR2 = 2, // don't support these curves
268 };
Botan::TLS::Supported_Point_Formats::ANSIX962_COMPRESSED_PRIME
Definition: tls_extensions.h:266
Botan::TLS::Supported_Point_Formats::ANSIX962_COMPRESSED_CHAR2
Definition: tls_extensions.h:267
Botan::TLS::Supported_Point_Formats::UNCOMPRESSED
Definition: tls_extensions.h:265

## Constructor & Destructor Documentation

Botan::TLS::Supported_Point_Formats::Supported_Point_Formats | ( | bool | prefer_compressed | ) |
| inline explicit

Definition at line 277 of file tls_extensions.h.

277 :
278 m_prefers_compressed(prefer_compressed) {}

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

Definition at line 398 of file tls_extensions.cpp.

References ANSIX962_COMPRESSED_PRIME, Botan::TLS::TLS_Data_Reader::discard_next(), Botan::TLS::TLS_Data_Reader::get_byte(), and UNCOMPRESSED.

400 {
401 uint8_t len = reader.get_byte();
402
403 if(len + 1 != extension_size)
404 throw Decoding_Error("Inconsistent length field in supported point formats list");
405
406 for(size_t i = 0; i != len; ++i)
407 {
408 uint8_t format = reader.get_byte();
409
410 if(static_cast<ECPointFormat>(format) == UNCOMPRESSED)
411 {
412 m_prefers_compressed = false;
413 reader.discard_next(len-i-1);
414 return;
415 }
416 else if(static_cast<ECPointFormat>(format) == ANSIX962_COMPRESSED_PRIME)
417 {
418 m_prefers_compressed = true;
419 reader.discard_next(len-i-1);
420 return;
421 }
422
423 // ignore ANSIX962_COMPRESSED_CHAR2, we don't support these curves
424 }
425 }
Botan::TLS::Supported_Point_Formats::ANSIX962_COMPRESSED_PRIME
Definition: tls_extensions.h:266
Botan::TLS::Supported_Point_Formats::UNCOMPRESSED
Definition: tls_extensions.h:265

## Member Function Documentation

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

Returns
  if we should encode this extension or not

Implements Botan::TLS::Extension.

Definition at line 283 of file tls_extensions.h.

283 { return false; }

bool Botan::TLS::Supported_Point_Formats::prefers_compressed | ( |  | ) |
| inline

Definition at line 285 of file tls_extensions.h.

285 { return m_prefers_compressed; }

std::vector< uint8_t > Botan::TLS::Supported_Point_Formats::serialize | ( |  | ) | const
| override virtual

Returns
  serialized binary for the extension

Implements Botan::TLS::Extension.

Definition at line 385 of file tls_extensions.cpp.

References ANSIX962_COMPRESSED_PRIME, and UNCOMPRESSED.

386 {
387 // if this extension is sent, it MUST include uncompressed (RFC 4492, section 5.1)
388 if(m_prefers_compressed)
389 {
390 return std::vector<uint8_t>{2, ANSIX962_COMPRESSED_PRIME, UNCOMPRESSED};
391 }
392 else
393 {
394 return std::vector<uint8_t>{1, UNCOMPRESSED};
395 }
396 }
Botan::TLS::Supported_Point_Formats::ANSIX962_COMPRESSED_PRIME
Definition: tls_extensions.h:266
Botan::TLS::Supported_Point_Formats::UNCOMPRESSED
Definition: tls_extensions.h:265

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

Definition at line 270 of file tls_extensions.h.

References Botan::TLS::TLSEXT_EC_POINT_FORMATS.

Referenced by type().

271 { return TLSEXT_EC_POINT_FORMATS; }
Botan::TLS::TLSEXT_EC_POINT_FORMATS
Definition: tls_extensions.h:33

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

Returns
  code number of the extension

Implements Botan::TLS::Extension.

Definition at line 273 of file tls_extensions.h.

References static_type().

273 { return static_type(); }
Botan::TLS::Supported_Point_Formats::static_type
static Handshake_Extension_Type static_type()
Definition: tls_extensions.h:270

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

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