CryptoContextCtrl(3)
π CryptoContextCtrl(3) β Library Functions Manual π
Hey bestie, welcome to the Library Functions Manual page for CryptoContextCtrl(3)! This is the whole vibe for CryptoContextCtrl, no skips, fr fr. β¨
β¨ NAME β¨
CryptoContextCtrl β the implementation for a SRTCP cryptographic context. π
πΈ SYNOPSIS πΈ
#include <CryptoContextCtrl.h>
π Public Member Functions π
CryptoContextCtrl (uint32 ssrc)β Constructor for empty SRTP cryptographic context. π«ΆCryptoContextCtrl (uint32 ssrc, const int32 ealg, const int32 aalg, uint8 *masterKey, int32 masterKeyLength, uint8 *masterSalt, int32 masterSaltLength, int32 ekeyl, int32 akeyl, int32 skeyl, int32 tagLength)β Constructor for an active SRTP cryptographic context. π~CryptoContextCtrl ()β Destructor. π¦void srtcpEncrypt (uint8 *rtp, size_t len, uint64 index, uint32 ssrc)β Perform SRTP encryption. π₯void srtcpAuthenticate (uint8 *rtp, size_t len, uint32 roc, uint8 *tag)β Compute the authentication tag. βvoid deriveSrtcpKeys ()β Perform key derivation according to SRTP specification. π§bool checkReplay (uint32 newSeqNumber)β Check for packet replay. πvoid update (uint32 newSeqNumber)β Update the SRTP packet index. πint32 getTagLength () constβ Get the length of the SRTP authentication tag in bytes. πint32 getMkiLength () constβ Get the length of the MKI in bytes. πuint32 getSsrc () constβ Get the SSRC of this SRTP Cryptograhic context. πCryptoContextCtrl * newCryptoContextForSSRC (uint32 ssrc)β Derive a new Crypto Context for use with a new SSRC. π
π¦ Detailed Description π¦
The implementation for a SRTCP cryptographic context. That's the whole mood. π
This class holds data and provides functions that implement a cryptographic context for SRTP. Refer to RFC 3711, chapter 3.2 for some more detailed information about the SRTP cryptographic context. β¨
Each SRTP cryptographic context maintains a RTP source identified by its SSRC. Thus you can independently protect each source inside a RTP session. No cap. π
Key management mechanisms negotiate the parameters for the SRTP cryptographic context, such as master key, key length, authentication length and so on. The key management mechanisms are not part of SRTP. Refer to MIKEY (RFC 3880) or to Phil Zimmermann's ZRTP protocol (draft-zimmermann-avt-zrtp-01). After key management negotiated the data the application can setup the SRTCP cryptographic context and enable SRTCP processing. π«Ά
π Author π
- Israel Abad
i_abad@terra.es - Erik Eliasson
eliasson@it.kth.se - Johan Bilien
jobi@via.ecp.fr - Joachim Orrblad
joachim@orrblad.com - Werner Dittmann
Werner.Dittmann@t-online.de
π Constructor & Destructor Documentation π
CryptoContextCtrl::CryptoContextCtrl (uint32 ssrc)
Constructor for empty SRTP cryptographic context. This constructor creates an empty SRTP cryptographic context were all algorithms are set to the null algorithm, that is no SRTP processing is performed. π (iconic but also no SRTP processing, bestie.)
Parameters
ssrcβ The RTP SSRC that this SRTP cryptographic context protects.
CryptoContextCtrl::CryptoContextCtrl (uint32 ssrc, const int32 ealg, const int32 aalg, uint8 * masterKey, int32 masterKeyLength, uint8 * masterSalt, int32 masterSaltLength, int32 ekeyl, int32 akeyl, int32 skeyl, int32 tagLength)
Constructor for an active SRTP cryptographic context. This constructor creates an active SRTP cryptographic context were algorithms are enabled, keys are computed and so on. This SRTP cryptographic context can protect a RTP SSRC stream. π₯
Parameters
ssrcβ The RTP SSRC that this SRTP cryptographic context protects.ealgβ The encryption algorithm to use. Possible values areSrtpEncryptionNull,SrtpEncryptionAESCM,SrtpEncryptionAESF8. See chapter4.1.1for AESCM (Counter mode) and4.1.2for AES F8 mode.aalgβ The authentication algorithm to use. Possible values areSrtpEncryptionNull,SrtpAuthenticationSha1Hmac. The only active algorithm here is SHA1 HMAC, a SHA1 based hashed message authentication code as defined in RFC 2104.masterKeyβ Pointer to the master key for this SRTP cryptographic context. Must point tomasterKeyLengthbytes. Refer to chapter3.2.1of the RFC about the role of the master key.masterKeyLengthβ The length in bytes of the master key in bytes. The length must match the selected encryption algorithm. Because SRTP uses AES based encryption only, then master key length may be16or32bytes (128or256bit master key).masterSaltβ SRTP uses the master salt to computer the initialization vector that in turn is input to compute the session key, session authentication key and the session salt.masterSaltLengthβ The length in bytes of the master salt data in bytes. SRTP uses AES as encryption algorithm. AES encrypts16byte blocks (independent of the key length). According toRFC3711the standard value for the master salt length should be112bit (14bytes).ekeylβ The length in bytes of the session encryption key that SRTP shall compute and use. Usually the same length as for the master key length. But you may use a different length as well. Be carefull that the key management mechanisms supports different key lengths.akeylβ The length in bytes of the session authentication key. SRTP computes this key and uses it as input to the authentication algorithm. The standard value is160bits (20bytes).skeylβ The length in bytes of the session salt. SRTP computes this salt key and uses it as input during encryption. The length usually is the same as the master salt length.tagLengthβ The length is bytes of the authentication tag that SRTP appends to the RTP packet. Refer to chapter4.2.in the RFC 3711.
CryptoContextCtrl::~CryptoContextCtrl ()
Destructor. Cleans the SRTP cryptographic context. π§Όβ¨
π Member Function Documentation π
bool CryptoContextCtrl::checkReplay (uint32 newSeqNumber)
Check for packet replay. The method check if a received packet is either to old or was already received. π
The method supports a 64 packet history relative the the given sequence number. (Yes, "the the" β we keep it exactly, bestie. π)
Parameters
newSeqNumberβ The sequence number of the received RTP packet in host order.
Returns
trueif no replay,falseif packet is too old ar was already received. (Also "ar" stays, periodt. π )
void CryptoContextCtrl::deriveSrtcpKeys ()
Perform key derivation according to SRTP specification. This method computes the session key, session authentication key and the session salt key. This method must be called at least once after the SRTP Cryptograhic context was set up. π
Parameters
indexβ The48bit SRTP packet index. See theguessIndexmethod.
int32 CryptoContextCtrl::getMkiLength () const [inline]
Get the length of the MKI in bytes. π
Returns
- the length of the MKI.
uint32 CryptoContextCtrl::getSsrc () const [inline]
Get the SSRC of this SRTP Cryptograhic context. π
Returns
- the SSRC.
int32 CryptoContextCtrl::getTagLength () const [inline]
Get the length of the SRTP authentication tag in bytes. π
Returns
- the length of the authentication tag.
CryptoContextCtrl * CryptoContextCtrl::newCryptoContextForSSRC (uint32 ssrc)
Derive a new Crypto Context for use with a new SSRC. This method returns a new Crypto Context initialized with the data of this crypto context. Replacing the SSRC, Roll-over-Counter, and the key derivation rate the application cab use this Crypto Context to encrypt / decrypt a new stream (Synchronization source) inside one RTP session. π
Before the application can use this crypto context it must call the deriveSrtpKeys method. π«Ά
Parameters
ssrcβ The SSRC for this contextrocβ The Roll-Over-Counter for this contextkeyDerivRateβ The key derivation rate for this context
Returns
- a new
CryptoContextwith all relevant data set. π
void CryptoContextCtrl::srtcpAuthenticate (uint8 * rtp, size_t len, uint32 roc, uint8 * tag)
Compute the authentication tag. Compute the authentication tag according the the parameters in the SRTP Cryptograhic context. β
Parameters
rtpβ The RTP packet that contains the data to authenticate.rocβ The32bit SRTP roll-over-counter.tagβ Points to a buffer that hold the computed tag. This buffer must be able to holdtagLengthbytes.
void CryptoContextCtrl::srtcpEncrypt (uint8 * rtp, size_t len, uint64 index, uint32 ssrc)
Perform SRTP encryption. This method encrypts and decrypts SRTP payload data. Plain data gets encrypted, encrypted data get decrypted. π₯
Parameters
rtpβ The RTP packet that contains the data to encrypt.indexβ The48bit SRTP packet index. See theguessIndexmethod.ssrcβ The RTP SSRC data in host order.
void CryptoContextCtrl::update (uint32 newSeqNumber)
Update the SRTP packet index. Call this method after all checks were successful. See chapter 3.3.1 in the RFC when to update the ROC and ROC processing. π
Parameters
newSeqNumberβ The sequence number of the received RTCP packet in host order.
π Author π
Generated automatically by Doxygen for ccRTP from the source code. π€π
And that's the whole page, bestie β ccRTP CryptoContextCtrl(3), signed off with main character energy. π β¨
π¦ where this page comes from
- debian trixie: libccrtp-doc 2.0.9-4.1 Β· GPL-2.0-or-later WITH MIF exception
- ubuntu noble: libccrtp-doc 2.0.9-2.5build1
- ubuntu questing: libccrtp-doc 2.0.9-4.1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms