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 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 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 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 fROC
 
u_int32_t fSRTCPIndex
 

Detailed Description

Definition at line 27 of file SRTPCryptographicContext.hh.

Member Enumeration Documentation

◆ SRTPKeyDerivationLabel

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

◆ 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

◆ masterKey()

u_int8_t const* SRTPCryptographicContext::masterKey ( ) const
inlineprivate

Definition at line 121 of file SRTPCryptographicContext.hh.

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

References masterKeyPlusSalt().

◆ masterKeyPlusSalt()

u_int8_t const* SRTPCryptographicContext::masterKeyPlusSalt ( ) const
inlineprivate

Definition at line 119 of file SRTPCryptographicContext.hh.

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

References fMIKEYState, and MIKEYState::keyData().

Referenced by masterKey(), and masterSalt().

◆ masterSalt()

u_int8_t const* SRTPCryptographicContext::masterSalt ( ) const
inlineprivate

Definition at line 122 of file SRTPCryptographicContext.hh.

u_int8_t const * masterKeyPlusSalt() const
#define SRTP_CIPHER_KEY_LENGTH

References masterKeyPlusSalt(), and SRTP_CIPHER_KEY_LENGTH.

◆ MKI()

u_int32_t SRTPCryptographicContext::MKI ( ) const
inlineprivate

Definition at line 127 of file SRTPCryptographicContext.hh.

127 { return fMIKEYState.MKI(); }
u_int32_t MKI() const
Definition: MIKEY.hh:50

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 
)

◆ 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 126 of file SRTPCryptographicContext.hh.

126 { return fMIKEYState.useAuthentication(); }
Boolean useAuthentication() const
Definition: MIKEY.hh:51

References fMIKEYState, and MIKEYState::useAuthentication().

◆ weEncryptSRTCP()

Boolean SRTPCryptographicContext::weEncryptSRTCP ( ) const
inlineprivate

Definition at line 125 of file SRTPCryptographicContext.hh.

125 { return fMIKEYState.encryptSRTCP(); }
Boolean encryptSRTCP() const
Definition: MIKEY.hh:48

References MIKEYState::encryptSRTCP(), and fMIKEYState.

◆ weEncryptSRTP()

Boolean SRTPCryptographicContext::weEncryptSRTP ( ) const
inlineprivate

Definition at line 124 of file SRTPCryptographicContext.hh.

124 { return fMIKEYState.encryptSRTP(); }
Boolean encryptSRTP() const
Definition: MIKEY.hh:47

References MIKEYState::encryptSRTP(), and fMIKEYState.

Field Documentation

◆ fDerivedKeys

allDerivedKeys SRTPCryptographicContext::fDerivedKeys
private

Definition at line 130 of file SRTPCryptographicContext.hh.

◆ fHaveReceivedSRTPPackets

Boolean SRTPCryptographicContext::fHaveReceivedSRTPPackets
private

Definition at line 133 of file SRTPCryptographicContext.hh.

◆ fMIKEYState

MIKEYState const& SRTPCryptographicContext::fMIKEYState
private

◆ fPreviousHighRTPSeqNum

u_int16_t SRTPCryptographicContext::fPreviousHighRTPSeqNum
private

Definition at line 134 of file SRTPCryptographicContext.hh.

◆ fROC

u_int32_t SRTPCryptographicContext::fROC
private

Definition at line 135 of file SRTPCryptographicContext.hh.

◆ fSRTCPIndex

u_int32_t SRTPCryptographicContext::fSRTCPIndex
private

Definition at line 138 of file SRTPCryptographicContext.hh.


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