# class RTPSecure | SRTP implementation. More...
Full name | `TelEngine::RTPSecure`
Definition | `#include <libs/yrtp/yatertp.h>`
Inherits | TelEngine::GenObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- RTPSecure ()
- RTPSecure (const String& suite)
- RTPSecure (const RTPSecure& other)
- virtual ~RTPSecure ()
- inline RTPBaseIO* owner () const
- void owner (RTPBaseIO* newOwner)
- inline Cipher* rtpCipher () const
- virtual bool supported (RTPSession* session = 0) const
- virtual bool setup (const String& suite, const String& keyParams, const ObjList* paramList = 0)
- virtual bool create (String& suite, String& keyParams, bool buildMaster = true)

#### Protected Methods

- virtual void init ()
- virtual void rtpEncipher (unsigned char* data, int len)
- virtual void rtpAddIntegrity (const unsigned char* data, int len, unsigned char* authData)
- virtual bool rtpDecipher (unsigned char* data, int len, const void* secData, u_int32_t ssrc, u_int64_t seq)
- virtual bool rtpCheckIntegrity (const unsigned char* data, int len, const void* authData, u_int32_t ssrc, u_int64_t seq)
- bool deriveKey (Cipher& cipher, DataBlock& key, unsigned int len, unsigned char label, u_int64_t index = 0)

## Detailed Description

Security and integrity implementation

RTPSecure () | ### RTPSecure

Default constructor, builds an inactive implementation

RTPSecure (const String& suite) | ### RTPSecure

Constructor that creates an active implementation

Parameters:

suite | Cryptographic suite to use by default

RTPSecure (const RTPSecure& other) | ### RTPSecure

Constructor that copies the basic crypto lengths

Parameters:

other | Security provider to copy parameters from

~RTPSecure () | ### ~RTPSecure

[virtual]

Destructor

inline RTPBaseIO* owner () | ### owner

[const]

Get the owner of this security instance

Returns: Pointer to RTPBaseIO or NULL

void owner (RTPBaseIO* newOwner) | ### owner

Set the owner of this security instance

Parameters:

newOwner | Pointer to new RTPBaseIO owning this security instance

inline Cipher* rtpCipher () | ### rtpCipher

[const]

Get the current RTP cipher if set

Returns: Pointer to current RTP cipher or NULL

bool supported (RTPSession* session = 0) | ### supported

[const virtual]

Check if the systems supports requirements for activating SRTP

Parameters:

session | RTP session to use for cipher checking, NULL to use owner session

Returns: True if it looks like SRTP can be activated later

bool setup (const String& suite, const String& keyParams, const ObjList* paramList = 0) | ### setup

[virtual]

Set up the cryptographic parameters

Parameters:

suite | Descriptor of the encryption and authentication algorithms
keyParams | Keying material and related parameters
paramList | Optional session parameters as list of Strings

Returns: True if the session parameters were applied successfully

bool create (String& suite, String& keyParams, bool buildMaster = true) | ### create

[virtual]

Create a set of cryptographic parameters

Parameters:

suite | Reference of returned cryptographic suite description
keyParams | Reference to returned keying material
buildMaster | Create random master key and salt if not already set

Returns: True if security instance is valid and ready

void init () | ### init

[protected virtual]

Initialize security related variables in the RTP session

void rtpEncipher (unsigned char* data, int len) | ### rtpEncipher

[protected virtual]

Method called to encipher RTP payload data in-place

Parameters:

data | Pointer to data block to encipher
len | Length of payload data to be encrypted including any padding

void rtpAddIntegrity (const unsigned char* data, int len, unsigned char* authData) | ### rtpAddIntegrity

[protected virtual]

Method called to add integrity information to the RTP packet

Parameters:

data | Pointer to the RTP packet to protect
len | Length of RTP data to be encrypted including header and padding
authData | Address to write the integrity data to

bool rtpDecipher (unsigned char* data, int len, const void* secData, u_int32_t ssrc, u_int64_t seq) | ### rtpDecipher

[protected virtual]

Method called to decipher RTP data in-place

Parameters:

data | Pointer to data block to decipher
len | Length of data including any padding
secData | Pointer to security data if applicable
ssrc | SSRC of the packet to decipher
seq | Full (48 bit) seqence number of the packet including rollovers

Returns: True is the packet was deciphered correctly or can't tell

bool rtpCheckIntegrity (const unsigned char* data, int len, const void* authData, u_int32_t ssrc, u_int64_t seq) | ### rtpCheckIntegrity

[protected virtual]

Method called to check the integrity of the RTP packet

Parameters:

data | Pointer to RTP header and data
len | Length of header, data and padding
authData | Pointer to authentication data
ssrc | SSRC of the packet to validate
seq | Full (48 bit) seqence number of the packet including rollovers

Returns: True is the packet passed integrity checks

bool deriveKey (Cipher& cipher, DataBlock& key, unsigned int len, unsigned char label, u_int64_t index = 0) | ### deriveKey

[protected]

Internal method implementing key derivation

Parameters:

cipher | Cipher used for key derivation
key | Reference to derived key output
len | Desired length of the key, should be at most cipher block length
label | Derived key type
index | Packet index after being divided by KDR

Returns: True if success, false if invalid parameters or missing cipher

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.