diff --git a/sflphone-common/src/audio/audiortp/AudioSrtpSession.h b/sflphone-common/src/audio/audiortp/AudioSrtpSession.h index 34e680f343e2eab7b2a5c6bbcb11a0fc0af3e49b..bc77019e43a586114099e9bd5da2d0bc37bda27f 100644 --- a/sflphone-common/src/audio/audiortp/AudioSrtpSession.h +++ b/sflphone-common/src/audio/audiortp/AudioSrtpSession.h @@ -78,30 +78,74 @@ class AudioSrtpSession : public ost::SymmetricRTPSession, public AudioRtpSession { public: + /** + * Constructor for this rtp session + */ AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall); + /** + * Used to get sdp crypto header to be included in sdp session. This + * method must be called befor setRemoteCryptoInfo in case of an + * outgoing call or after in case of an outgoing call. + */ std::vector<std::string> getLocalCryptoInfo (void); + /** + * Set remote crypto header from incoming sdp offer + */ void setRemoteCryptoInfo (sfl::SdesNegotiator& nego); + /** + * Init local crypto context for outgoing data + * this method must be called before sending first Invite request + * with SDP offer. + */ void initLocalCryptoInfo (void); private: + /** + * Init local master key according to current crypto context + * as defined in SdesNegotiator.h + */ void initializeLocalMasterKey (void); + /** + * Init local master salt according to current crypto context + * as defined in SdesNegotiator.h + */ void initializeLocalMasterSalt (void); + /** + * Init remote crypto context in audio srtp session. This method + * must be called after unBase64ConcatenatedKeys. + */ void initializeRemoteCryptoContext (void); + /** + * Init local crypto context in audio srtp session. Make sure remote + * crypto context is set before calling this method for incoming calls. + */ void initializeLocalCryptoContext (void); + /** + * Used to generate local keys to be included in SDP offer/answer. + */ std::string getBase64ConcatenatedKeys(); + /** + * Used to retreive keys from base64 serialization + */ void unBase64ConcatenatedKeys (std::string base64keys); + /** + * Encode input data as base64 + */ char* encodeBase64 (unsigned char *input, int length); + /** + * Decode base64 data + */ char* decodeBase64 (unsigned char *input, int length, int *length_out); /** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/ @@ -130,8 +174,10 @@ class AudioSrtpSession : public ost::SymmetricRTPSession, public AudioRtpSession /** remote master salt length in byte */ int _remoteMasterSaltLength; + /** Remote srtp crypto context to be set into incoming data queue. */ ost::CryptoContext* _remoteCryptoCtx; + /** Local srtp crypto context to be set into outgoing data queue. */ ost::CryptoContext* _localCryptoCtx; };