live
Data Structures | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SRTPCryptographicContext Class Reference

#include <SRTPCryptographicContext.hh>

Collaboration diagram for SRTPCryptographicContext:
Collaboration graph
[legend]

Data Structures

struct  allDerivedKeys
 
struct  derivedKeys
 

Public Member Functions

 SRTPCryptographicContext (MIKEYState const &mikeyState)
 
virtual ~SRTPCryptographicContext ()
 
Boolean processIncomingSRTPPacket (u_int8_t *buffer, unsigned inPacketSize, unsigned &outPacketSize)
 
Boolean processIncomingSRTCPPacket (u_int8_t *buffer, unsigned inPacketSize, unsigned &outPacketSize)
 
Boolean processOutgoingSRTPPacket (u_int8_t *buffer, unsigned inPacketSize, unsigned &outPacketSize)
 
Boolean processOutgoingSRTCPPacket (u_int8_t *buffer, unsigned inPacketSize, unsigned &outPacketSize)
 

Private Types

enum  SRTPKeyDerivationLabel {
  label_srtp_encryption = 0x00 , label_srtp_msg_auth = 0x01 , label_srtp_salt = 0x02 , label_srtcp_encryption = 0x03 ,
  label_srtcp_msg_auth = 0x04 , label_srtcp_salt = 0x05
}
 

Private Member Functions

unsigned generateSRTPAuthenticationTag (u_int8_t const *dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t *resultAuthenticationTag)
 
unsigned generateSRTCPAuthenticationTag (u_int8_t const *dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t *resultAuthenticationTag)
 
Boolean verifySRTPAuthenticationTag (u_int8_t *dataToAuthenticate, unsigned numBytesToAuthenticate, u_int32_t roc, u_int8_t const *authenticationTag)
 
Boolean verifySRTCPAuthenticationTag (u_int8_t const *dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t const *authenticationTag)
 
void decryptSRTPPacket (u_int64_t index, u_int32_t ssrc, u_int8_t *data, unsigned numDataBytes)
 
void decryptSRTCPPacket (u_int32_t index, u_int32_t ssrc, u_int8_t *data, unsigned numDataBytes)
 
void encryptSRTPPacket (u_int64_t index, u_int32_t ssrc, u_int8_t *data, unsigned numDataBytes)
 
void encryptSRTCPPacket (u_int32_t index, u_int32_t ssrc, u_int8_t *data, unsigned numDataBytes)
 
unsigned generateAuthenticationTag (derivedKeys &keysToUse, u_int8_t const *dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t *resultAuthenticationTag)
 
Boolean verifyAuthenticationTag (derivedKeys &keysToUse, u_int8_t const *dataToAuthenticate, unsigned numBytesToAuthenticate, u_int8_t const *authenticationTag)
 
void cryptData (derivedKeys &keys, u_int64_t index, u_int32_t ssrc, u_int8_t *data, unsigned numDataBytes)
 
void performKeyDerivation ()
 
void deriveKeysFromMaster (u_int8_t const *masterKey, u_int8_t const *salt, allDerivedKeys &allKeysResult)
 
void deriveSingleKey (u_int8_t const *masterKey, u_int8_t const *salt, SRTPKeyDerivationLabel label, unsigned resultKeyLength, u_int8_t *resultKey)
 
u_int8_t const * masterKeyPlusSalt () const
 
u_int8_t const * masterKey () const
 
u_int8_t const * masterSalt () const
 
Boolean weEncryptSRTP () const
 
Boolean weEncryptSRTCP () const
 
Boolean weAuthenticate () const
 
u_int32_t MKI () const
 

Private Attributes

MIKEYState const & fMIKEYState
 
allDerivedKeys fDerivedKeys
 
Boolean fHaveReceivedSRTPPackets
 
u_int16_t fPreviousHighRTPSeqNum
 
u_int32_t fReceptionROC
 
Boolean fHaveSentSRTPPackets
 
u_int32_t fSendingROC
 
u_int32_t fSRTCPIndex
 

Detailed Description

Definition at line 27 of file SRTPCryptographicContext.hh.

Member Enumeration Documentation

◆ SRTPKeyDerivationLabel

Enumerator
label_srtp_encryption 
label_srtp_msg_auth 
label_srtp_salt 
label_srtcp_encryption 
label_srtcp_msg_auth 
label_srtcp_salt 

Definition at line 71 of file SRTPCryptographicContext.hh.

Constructor & Destructor Documentation

◆ SRTPCryptographicContext()

SRTPCryptographicContext::SRTPCryptographicContext ( MIKEYState const &  mikeyState)

◆ ~SRTPCryptographicContext()

virtual SRTPCryptographicContext::~SRTPCryptographicContext ( )
virtual

Member Function Documentation

◆ cryptData()

void SRTPCryptographicContext::cryptData ( derivedKeys keys,
u_int64_t  index,
u_int32_t  ssrc,
u_int8_t *  data,
unsigned  numDataBytes 
)
private

◆ decryptSRTCPPacket()

void SRTPCryptographicContext::decryptSRTCPPacket ( u_int32_t  index,
u_int32_t  ssrc,
u_int8_t *  data,
unsigned  numDataBytes 
)
private

◆ decryptSRTPPacket()

void SRTPCryptographicContext::decryptSRTPPacket ( u_int64_t  index,
u_int32_t  ssrc,
u_int8_t *  data,
unsigned  numDataBytes 
)
private

◆ deriveKeysFromMaster()

void SRTPCryptographicContext::deriveKeysFromMaster ( u_int8_t const *  masterKey,
u_int8_t const *  salt,
allDerivedKeys allKeysResult 
)
private

◆ deriveSingleKey()

void SRTPCryptographicContext::deriveSingleKey ( u_int8_t const *  masterKey,
u_int8_t const *  salt,
SRTPKeyDerivationLabel  label,
unsigned  resultKeyLength,
u_int8_t *  resultKey 
)
private

◆ encryptSRTCPPacket()

void SRTPCryptographicContext::encryptSRTCPPacket ( u_int32_t  index,
u_int32_t  ssrc,
u_int8_t *  data,
unsigned  numDataBytes 
)
private

◆ encryptSRTPPacket()

void SRTPCryptographicContext::encryptSRTPPacket ( u_int64_t  index,
u_int32_t  ssrc,
u_int8_t *  data,
unsigned  numDataBytes 
)
private

◆ generateAuthenticationTag()

unsigned SRTPCryptographicContext::generateAuthenticationTag ( derivedKeys keysToUse,
u_int8_t const *  dataToAuthenticate,
unsigned  numBytesToAuthenticate,
u_int8_t *  resultAuthenticationTag 
)
private

◆ generateSRTCPAuthenticationTag()

unsigned SRTPCryptographicContext::generateSRTCPAuthenticationTag ( u_int8_t const *  dataToAuthenticate,
unsigned  numBytesToAuthenticate,
u_int8_t *  resultAuthenticationTag 
)
private

◆ generateSRTPAuthenticationTag()

unsigned SRTPCryptographicContext::generateSRTPAuthenticationTag ( u_int8_t const *  dataToAuthenticate,
unsigned  numBytesToAuthenticate,
u_int8_t *  resultAuthenticationTag 
)
private

◆ masterKey()

u_int8_t const * SRTPCryptographicContext::masterKey ( ) const
inlineprivate

Definition at line 127 of file SRTPCryptographicContext.hh.

127{ return &masterKeyPlusSalt()[0]; }
u_int8_t const * masterKeyPlusSalt() const

References masterKeyPlusSalt().

◆ masterKeyPlusSalt()

u_int8_t const * SRTPCryptographicContext::masterKeyPlusSalt ( ) const
inlineprivate

Definition at line 125 of file SRTPCryptographicContext.hh.

125{ return fMIKEYState.keyData(); }
u_int8_t const * keyData() const
Definition: MIKEY.hh:47

References fMIKEYState, and MIKEYState::keyData().

Referenced by masterKey(), and masterSalt().

◆ masterSalt()

u_int8_t const * SRTPCryptographicContext::masterSalt ( ) const
inlineprivate

Definition at line 128 of file SRTPCryptographicContext.hh.

#define SRTP_CIPHER_KEY_LENGTH

References masterKeyPlusSalt(), and SRTP_CIPHER_KEY_LENGTH.

◆ MKI()

u_int32_t SRTPCryptographicContext::MKI ( ) const
inlineprivate

Definition at line 133 of file SRTPCryptographicContext.hh.

133{ return fMIKEYState.MKI(); }
u_int32_t MKI() const
Definition: MIKEY.hh:48

References fMIKEYState, and MIKEYState::MKI().

◆ performKeyDerivation()

void SRTPCryptographicContext::performKeyDerivation ( )
private

◆ processIncomingSRTCPPacket()

Boolean SRTPCryptographicContext::processIncomingSRTCPPacket ( u_int8_t *  buffer,
unsigned  inPacketSize,
unsigned &  outPacketSize 
)

◆ processIncomingSRTPPacket()

Boolean SRTPCryptographicContext::processIncomingSRTPPacket ( u_int8_t *  buffer,
unsigned  inPacketSize,
unsigned &  outPacketSize 
)

◆ processOutgoingSRTCPPacket()

Boolean SRTPCryptographicContext::processOutgoingSRTCPPacket ( u_int8_t *  buffer,
unsigned  inPacketSize,
unsigned &  outPacketSize 
)

◆ processOutgoingSRTPPacket()

Boolean SRTPCryptographicContext::processOutgoingSRTPPacket ( u_int8_t *  buffer,
unsigned  inPacketSize,
unsigned &  outPacketSize 
)

◆ verifyAuthenticationTag()

Boolean SRTPCryptographicContext::verifyAuthenticationTag ( derivedKeys keysToUse,
u_int8_t const *  dataToAuthenticate,
unsigned  numBytesToAuthenticate,
u_int8_t const *  authenticationTag 
)
private

◆ verifySRTCPAuthenticationTag()

Boolean SRTPCryptographicContext::verifySRTCPAuthenticationTag ( u_int8_t const *  dataToAuthenticate,
unsigned  numBytesToAuthenticate,
u_int8_t const *  authenticationTag 
)
private

◆ verifySRTPAuthenticationTag()

Boolean SRTPCryptographicContext::verifySRTPAuthenticationTag ( u_int8_t *  dataToAuthenticate,
unsigned  numBytesToAuthenticate,
u_int32_t  roc,
u_int8_t const *  authenticationTag 
)
private

◆ weAuthenticate()

Boolean SRTPCryptographicContext::weAuthenticate ( ) const
inlineprivate

Definition at line 132 of file SRTPCryptographicContext.hh.

132{ return fMIKEYState.useAuthentication(); }
Boolean useAuthentication() const
Definition: MIKEY.hh:49

References fMIKEYState, and MIKEYState::useAuthentication().

◆ weEncryptSRTCP()

Boolean SRTPCryptographicContext::weEncryptSRTCP ( ) const
inlineprivate

Definition at line 131 of file SRTPCryptographicContext.hh.

131{ return fMIKEYState.encryptSRTCP(); }
Boolean encryptSRTCP() const
Definition: MIKEY.hh:46

References MIKEYState::encryptSRTCP(), and fMIKEYState.

◆ weEncryptSRTP()

Boolean SRTPCryptographicContext::weEncryptSRTP ( ) const
inlineprivate

Definition at line 130 of file SRTPCryptographicContext.hh.

130{ return fMIKEYState.encryptSRTP(); }
Boolean encryptSRTP() const
Definition: MIKEY.hh:45

References MIKEYState::encryptSRTP(), and fMIKEYState.

Field Documentation

◆ fDerivedKeys

allDerivedKeys SRTPCryptographicContext::fDerivedKeys
private

Definition at line 136 of file SRTPCryptographicContext.hh.

◆ fHaveReceivedSRTPPackets

Boolean SRTPCryptographicContext::fHaveReceivedSRTPPackets
private

Definition at line 139 of file SRTPCryptographicContext.hh.

◆ fHaveSentSRTPPackets

Boolean SRTPCryptographicContext::fHaveSentSRTPPackets
private

Definition at line 144 of file SRTPCryptographicContext.hh.

◆ fMIKEYState

MIKEYState const& SRTPCryptographicContext::fMIKEYState
private

◆ fPreviousHighRTPSeqNum

u_int16_t SRTPCryptographicContext::fPreviousHighRTPSeqNum
private

Definition at line 140 of file SRTPCryptographicContext.hh.

◆ fReceptionROC

u_int32_t SRTPCryptographicContext::fReceptionROC
private

Definition at line 141 of file SRTPCryptographicContext.hh.

◆ fSendingROC

u_int32_t SRTPCryptographicContext::fSendingROC
private

Definition at line 145 of file SRTPCryptographicContext.hh.

◆ fSRTCPIndex

u_int32_t SRTPCryptographicContext::fSRTCPIndex
private

Definition at line 148 of file SRTPCryptographicContext.hh.


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