Botan 2.1.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::SRTP_Protection_Profiles Class Referencefinal

`#include <tls_extensions.h>`

Inheritance diagram for Botan::TLS::SRTP_Protection_Profiles:

## Public Member Functions
bool | empty () const override
const std::vector< uint16_t > & | profiles () const
std::vector< uint8_t > | serialize () const override
| SRTP_Protection_Profiles (const std::vector< uint16_t > &pp)
| SRTP_Protection_Profiles (uint16_t pp)
| SRTP_Protection_Profiles (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

Used to indicate SRTP algorithms for DTLS (RFC 5764)

Definition at line 334 of file tls_extensions.h.

## Constructor & Destructor Documentation

Botan::TLS::SRTP_Protection_Profiles::SRTP_Protection_Profiles | ( | const std::vector< uint16_t > & | pp | ) |
| inline explicit

Definition at line 348 of file tls_extensions.h.

348 : m_pp(pp) {}

Botan::TLS::SRTP_Protection_Profiles::SRTP_Protection_Profiles | ( | uint16_t | pp | ) |
| inline explicit

Definition at line 350 of file tls_extensions.h.

350 : m_pp(1, pp) {}

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

Definition at line 565 of file tls_extensions.cpp.

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

566 : m_pp(reader.get_range<uint16_t>(2, 0, 65535))
567 {
568 const std::vector<uint8_t> mki = reader.get_range<uint8_t>(1, 0, 255);
569
570 if(m_pp.size() * 2 + mki.size() + 3 != extension_size)
571 throw Decoding_Error("Bad encoding for SRTP protection extension");
572
573 if(!mki.empty())
574 throw Decoding_Error("Unhandled non-empty MKI for SRTP protection extension");
575 }

## Member Function Documentation

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

Returns
  if we should encode this extension or not

Implements Botan::TLS::Extension.

Definition at line 346 of file tls_extensions.h.

346 { return m_pp.empty(); }

const std::vector<uint16_t>& Botan::TLS::SRTP_Protection_Profiles::profiles | ( |  | ) | const
| inline

Definition at line 342 of file tls_extensions.h.

342 { return m_pp; }

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

Returns
  serialized binary for the extension

Implements Botan::TLS::Extension.

Definition at line 577 of file tls_extensions.cpp.

References Botan::get_byte().

578 {
579 std::vector<uint8_t> buf;
580
581 const uint16_t pp_len = static_cast<uint16_t>(m_pp.size() * 2);
582 buf.push_back(get_byte(0, pp_len));
583 buf.push_back(get_byte(1, pp_len));
584
585 for(uint16_t pp : m_pp)
586 {
587 buf.push_back(get_byte(0, pp));
588 buf.push_back(get_byte(1, pp));
589 }
590
591 buf.push_back(0); // srtp_mki, always empty here
592
593 return buf;
594 }
Botan::get_byte
uint8_t get_byte(size_t byte_num, T input)
Definition: loadstor.h:47

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

Definition at line 337 of file tls_extensions.h.

References Botan::TLS::TLSEXT_USE_SRTP.

Referenced by type().

338 { return TLSEXT_USE_SRTP; }
Botan::TLS::TLSEXT_USE_SRTP
Definition: tls_extensions.h:36

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

Returns
  code number of the extension

Implements Botan::TLS::Extension.

Definition at line 340 of file tls_extensions.h.

References static_type().

340 { return static_type(); }
Botan::TLS::SRTP_Protection_Profiles::static_type
static Handshake_Extension_Type static_type()
Definition: tls_extensions.h:337

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

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