Yate
RTPSecure Class Reference

SRTP implementation. More...

#include <yatertp.h>

Inheritance diagram for RTPSecure:
GenObject RTPDebug

Public Member Functions

 RTPSecure (DebugEnabler *dbg=0, const char *traceId=0)
 
 RTPSecure (const String &suite, DebugEnabler *dbg=0, const char *traceId=0)
 
 RTPSecure (const RTPSecure &other)
 
virtual ~RTPSecure ()
 
RTPBaseIOowner () const
 
void owner (RTPBaseIO *newOwner)
 
CipherrtpCipher () 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)
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from RTPDebug
 RTPDebug (DebugEnabler *dbg, const char *traceId)
 
 RTPDebug (RTPSession *session)
 
DebugEnablerdbg () const
 
const StringdbgTraceId () const
 

Protected Member Functions

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)
 
- Protected Member Functions inherited from RTPDebug
void setDebug (DebugEnabler *dbg, const char *traceId)
 

Friends

class RTPReceiver
 
class RTPSender
 
class RTPSession
 

Additional Inherited Members

- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Protected Attributes inherited from RTPDebug
DebugEnablerm_dbg
 
String m_traceId
 

Detailed Description

SRTP implementation.

Security and integrity implementation

Constructor & Destructor Documentation

◆ RTPSecure() [1/3]

RTPSecure ( DebugEnabler * dbg = 0,
const char * traceId = 0 )

Default constructor, builds an inactive implementation

Parameters
dbgDebugEnabler
traceIdTrace ID

References RTPDebug::dbg(), and GenObject::traceId().

Referenced by RTPSecure().

◆ RTPSecure() [2/3]

RTPSecure ( const String & suite,
DebugEnabler * dbg = 0,
const char * traceId = 0 )

Constructor that creates an active implementation

Parameters
suiteCryptographic suite to use by default
dbgDebugEnabler
traceIdTrace ID

References RTPDebug::dbg(), and GenObject::traceId().

◆ RTPSecure() [3/3]

RTPSecure ( const RTPSecure & other)

Constructor that copies the basic crypto lengths

Parameters
otherSecurity provider to copy parameters from

References RTPSecure().

◆ ~RTPSecure()

virtual ~RTPSecure ( )
virtual

Destructor

Member Function Documentation

◆ create()

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

Create a set of cryptographic parameters

Parameters
suiteReference of returned cryptographic suite description
keyParamsReference to returned keying material
buildMasterCreate random master key and salt if not already set
Returns
True if security instance is valid and ready

◆ deriveKey()

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

Internal method implementing key derivation

Parameters
cipherCipher used for key derivation
keyReference to derived key output
lenDesired length of the key, should be at most cipher block length
labelDerived key type
indexPacket index after being divided by KDR
Returns
True if success, false if invalid parameters or missing cipher

◆ init()

virtual void init ( )
protectedvirtual

Initialize security related variables in the RTP session

◆ owner() [1/2]

RTPBaseIO * owner ( ) const
inline

Get the owner of this security instance

Returns
Pointer to RTPBaseIO or NULL

◆ owner() [2/2]

void owner ( RTPBaseIO * newOwner)

Set the owner of this security instance

Parameters
newOwnerPointer to new RTPBaseIO owning this security instance

◆ rtpAddIntegrity()

virtual void rtpAddIntegrity ( const unsigned char * data,
int len,
unsigned char * authData )
protectedvirtual

Method called to add integrity information to the RTP packet

Parameters
dataPointer to the RTP packet to protect
lenLength of RTP data to be encrypted including header and padding
authDataAddress to write the integrity data to

◆ rtpCheckIntegrity()

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

Method called to check the integrity of the RTP packet

Parameters
dataPointer to RTP header and data
lenLength of header, data and padding
authDataPointer to authentication data
ssrcSSRC of the packet to validate
seqFull (48 bit) seqence number of the packet including rollovers
Returns
True is the packet passed integrity checks

◆ rtpCipher()

Cipher * rtpCipher ( ) const
inline

Get the current RTP cipher if set

Returns
Pointer to current RTP cipher or NULL

◆ rtpDecipher()

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

Method called to decipher RTP data in-place

Parameters
dataPointer to data block to decipher
lenLength of data including any padding
secDataPointer to security data if applicable
ssrcSSRC of the packet to decipher
seqFull (48 bit) seqence number of the packet including rollovers
Returns
True is the packet was deciphered correctly or can't tell

◆ rtpEncipher()

virtual void rtpEncipher ( unsigned char * data,
int len )
protectedvirtual

Method called to encipher RTP payload data in-place

Parameters
dataPointer to data block to encipher
lenLength of payload data to be encrypted including any padding

◆ setup()

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

Set up the cryptographic parameters

Parameters
suiteDescriptor of the encryption and authentication algorithms
keyParamsKeying material and related parameters
paramListOptional session parameters as list of Strings
Returns
True if the session parameters were applied successfully

◆ supported()

virtual bool supported ( RTPSession * session = 0) const
virtual

Check if the systems supports requirements for activating SRTP

Parameters
sessionRTP session to use for cipher checking, NULL to use owner session
Returns
True if it looks like SRTP can be activated later

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