69
class SrtpException: public std::exception
71
virtual const char* what() const throw()
73
return "ZRTP ZID initialization failed.";
70
class SrtpException: public std::exception
72
virtual const char* what() const throw() {
73
return "ZRTP ZID initialization failed.";
77
class AudioSrtpSession : public ost::SymmetricRTPSession, public AudioRtpSession<AudioSrtpSession>
81
AudioSrtpSession(ManagerImpl * manager, SIPCall * sipcall);
83
std::vector<std::string> getLocalCryptoInfo(void);
85
void setRemoteCryptoInfo(sfl::SdesNegotiator& nego);
89
void initializeLocalMasterKey(void);
91
void initializeLocalMasterSalt(void);
93
void initializeRemoteCryptoContext(void);
95
void initializeLocalCryptoContext(void);
97
std::string getBase64ConcatenatedKeys();
99
void unBase64ConcatenatedKeys(std::string base64keys);
101
char* encodeBase64(unsigned char *input, int length);
103
char* decodeBase64(unsigned char *input, int length, int *length_out);
105
/** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/
106
int _localCryptoSuite;
108
/** Remote crypto suite is initialized at AES_CM_128_HMAC_SHA1_80*/
109
int _remoteCryptoSuite;
111
uint8 _localMasterKey[16];
113
/** local master key length in byte */
114
int _localMasterKeyLength;
116
uint8 _localMasterSalt[14];
118
/** local master salt length in byte */
119
int _localMasterSaltLength;
121
uint8 _remoteMasterKey[16];
123
/** remote master key length in byte */
124
int _remoteMasterKeyLength;
126
uint8 _remoteMasterSalt[14];
128
/** remote master salt length in byte */
129
int _remoteMasterSaltLength;
131
ost::CryptoContext* _remoteCryptoCtx;
133
ost::CryptoContext* _localCryptoCtx;
77
class AudioSrtpSession : public AudioRtpSession
82
* Constructor for this rtp session
84
AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall);
89
* Used to get sdp crypto header to be included in sdp session. This
90
* method must be called befor setRemoteCryptoInfo in case of an
91
* outgoing call or after in case of an outgoing call.
93
std::vector<std::string> getLocalCryptoInfo (void);
96
* Set remote crypto header from incoming sdp offer
98
void setRemoteCryptoInfo (sfl::SdesNegotiator& nego);
101
* Init local crypto context for outgoing data
102
* this method must be called before sending first Invite request
105
void initLocalCryptoInfo (void);
110
* Init local master key according to current crypto context
111
* as defined in SdesNegotiator.h
113
void initializeLocalMasterKey (void);
116
* Init local master salt according to current crypto context
117
* as defined in SdesNegotiator.h
119
void initializeLocalMasterSalt (void);
122
* Init remote crypto context in audio srtp session. This method
123
* must be called after unBase64ConcatenatedKeys.
125
void initializeRemoteCryptoContext (void);
128
* Init local crypto context in audio srtp session. Make sure remote
129
* crypto context is set before calling this method for incoming calls.
131
void initializeLocalCryptoContext (void);
134
* Used to generate local keys to be included in SDP offer/answer.
136
std::string getBase64ConcatenatedKeys();
139
* Used to retreive keys from base64 serialization
141
void unBase64ConcatenatedKeys (std::string base64keys);
144
* Encode input data as base64
146
char* encodeBase64 (unsigned char *input, int length);
151
char* decodeBase64 (unsigned char *input, int length, int *length_out);
153
/** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/
154
int _localCryptoSuite;
156
/** Remote crypto suite is initialized at AES_CM_128_HMAC_SHA1_80*/
157
int _remoteCryptoSuite;
159
uint8 _localMasterKey[16];
161
/** local master key length in byte */
162
int _localMasterKeyLength;
164
uint8 _localMasterSalt[14];
166
/** local master salt length in byte */
167
int _localMasterSaltLength;
169
uint8 _remoteMasterKey[16];
171
/** remote master key length in byte */
172
int _remoteMasterKeyLength;
174
uint8 _remoteMasterSalt[14];
176
/** remote master salt length in byte */
177
int _remoteMasterSaltLength;
179
/** Remote srtp crypto context to be set into incoming data queue. */
180
ost::CryptoContext* _remoteCryptoCtx;
182
/** Local srtp crypto context to be set into outgoing data queue. */
183
ost::CryptoContext* _localCryptoCtx;
185
/** Used to make sure remote crypto context not initialized wice. */
186
bool _remoteOfferIsSet;
138
191
#endif // __AUDIO_SRTP_SESSION_H__