Botan 3.8.1
Crypto and TLS for C&
Botan::TLS::SRTP_Protection_Profiles Class Referencefinal

#include <tls_extensions.h>

Inheritance diagram for Botan::TLS::SRTP_Protection_Profiles:
Botan::TLS::Extension

Public Member Functions

bool empty () const override
 
virtual bool is_implemented () const
 
const std::vector< uint16_t > & profiles () const
 
std::vector< uint8_t > serialize (Connection_Side whoami) const override
 
 SRTP_Protection_Profiles (const std::vector< uint16_t > &pp)
 
 SRTP_Protection_Profiles (TLS_Data_Reader &reader, uint16_t extension_size)
 
 SRTP_Protection_Profiles (uint16_t pp)
 
Extension_Code type () const override
 

Static Public Member Functions

static Extension_Code static_type ()
 

Detailed Description

Used to indicate SRTP algorithms for DTLS (RFC 5764)

Definition at line 434 of file tls_extensions.h.

Constructor & Destructor Documentation

◆ SRTP_Protection_Profiles() [1/3]

Botan::TLS::SRTP_Protection_Profiles::SRTP_Protection_Profiles ( const std::vector< uint16_t > & pp)
inlineexplicit

Definition at line 446 of file tls_extensions.h.

446: m_pp(pp) {}

◆ SRTP_Protection_Profiles() [2/3]

Botan::TLS::SRTP_Protection_Profiles::SRTP_Protection_Profiles ( uint16_t pp)
inlineexplicit

Definition at line 448 of file tls_extensions.h.

448: m_pp(1, pp) {}

◆ SRTP_Protection_Profiles() [3/3]

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

Definition at line 665 of file tls_extensions.cpp.

665 :
666 m_pp(reader.get_range<uint16_t>(2, 0, 65535)) {
667 const std::vector<uint8_t> mki = reader.get_range<uint8_t>(1, 0, 255);
668
669 if(m_pp.size() * 2 + mki.size() + 3 != extension_size) {
670 throw Decoding_Error("Bad encoding for SRTP protection extension");
671 }
672
673 if(!mki.empty()) {
674 throw Decoding_Error("Unhandled non-empty MKI for SRTP protection extension");
675 }
676}

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

Member Function Documentation

◆ empty()

bool Botan::TLS::SRTP_Protection_Profiles::empty ( ) const
inlineoverridevirtual
Returns
if we should encode this extension or not

Implements Botan::TLS::Extension.

Definition at line 444 of file tls_extensions.h.

444{ return m_pp.empty(); }

◆ is_implemented()

virtual bool Botan::TLS::Extension::is_implemented ( ) const
inlinevirtualinherited
Returns
true if this extension is known and implemented by Botan

Reimplemented in Botan::TLS::Unknown_Extension.

Definition at line 115 of file tls_extensions.h.

115{ return true; }

◆ profiles()

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

Definition at line 440 of file tls_extensions.h.

440{ return m_pp; }

◆ serialize()

std::vector< uint8_t > Botan::TLS::SRTP_Protection_Profiles::serialize ( Connection_Side whoami) const
overridevirtual
Returns
serialized binary for the extension

Implements Botan::TLS::Extension.

Definition at line 678 of file tls_extensions.cpp.

678 {
679 std::vector<uint8_t> buf;
680
681 const uint16_t pp_len = static_cast<uint16_t>(m_pp.size() * 2);
682 buf.push_back(get_byte<0>(pp_len));
683 buf.push_back(get_byte<1>(pp_len));
684
685 for(uint16_t pp : m_pp) {
686 buf.push_back(get_byte<0>(pp));
687 buf.push_back(get_byte<1>(pp));
688 }
689
690 buf.push_back(0); // srtp_mki, always empty here
691
692 return buf;
693}
constexpr uint8_t get_byte(T input)
Definition loadstor.h:79

References Botan::get_byte().

◆ static_type()

static Extension_Code Botan::TLS::SRTP_Protection_Profiles::static_type ( )
inlinestatic

Definition at line 436 of file tls_extensions.h.

References Botan::TLS::UseSrtp.

Referenced by type().

◆ type()

Extension_Code Botan::TLS::SRTP_Protection_Profiles::type ( ) const
inlineoverridevirtual
Returns
code number of the extension

Implements Botan::TLS::Extension.

Definition at line 438 of file tls_extensions.h.

438{ return static_type(); }
static Extension_Code static_type()

References static_type().


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