54 #define SIPXTACK_MAX_SRTP_KEY_LENGTH 31 55 #define SIPXTACK_MAX_SMIME_KEY_LENGTH 2048 56 #define SIPXTACK_MAX_PKCS12_KEY_LENGTH 4096 57 #define SIPXTACK_MAX_CERT_LENGTH 4096 58 #define SIPXTACK_MAX_PASSWORD_LENGTH 32 96 memset(szSrtpKey, 0,
sizeof(szSrtpKey));
97 memset(szSmimeKeyDer, 0,
sizeof(szSmimeKeyDer));
98 memset(dbLocation, 0,
sizeof(dbLocation));
99 memset(szMyCertNickname, 0,
sizeof(szMyCertNickname));
100 memset(szCertDbPassword, 0,
sizeof(szCertDbPassword));
101 nSmimeKeyLength = 0 ;
111 if (
this == &ref)
return *
this;
121 strncpy(szSrtpKey, szKey, length);
122 nSrtpKeyLength = length;
130 memcpy((
void*)szSmimeKeyDer, (
void*)szKey, length);
131 nSmimeKeyLength = length;
173 char dbLocation[256];
175 char szMyCertNickname[32];
180 nSrtpLevel = ref.nSrtpLevel;
181 nSrtpKeyLength = ref.nSrtpKeyLength;
182 nSmimeKeyLength = ref.nSmimeKeyLength;
183 strcpy(szSrtpKey, ref.szSrtpKey);
184 memcpy((
void*)szSmimeKeyDer, (
void*)ref.szSmimeKeyDer, ref.nSmimeKeyLength);
185 strncpy(dbLocation, ref.dbLocation,
sizeof(dbLocation) - 1);
186 strncpy(szMyCertNickname, ref.szMyCertNickname,
sizeof(szMyCertNickname) - 1);
187 strncpy(szCertDbPassword, ref.szCertDbPassword,
sizeof(szCertDbPassword) - 1);
198 virtual bool OnSignature(
void* pCert,
char* szSubjAltName) = 0 ;
213 SMIME_ENODING_UNKNOWN = 0,
226 const char* contentEncodingValueString);
251 UtlBoolean decrypt(
const char* derPkcs12,
253 const char* pkcs12password,
254 const char* certDbPassword,
255 const char* signerCertDER,
256 int signerCertDERLength,
273 UtlBoolean encrypt(
HttpBody* bodyToEncrypt,
275 const char* derPublicKeyCerts[],
276 int derPubliceKeyCertLengths[],
277 const char* szMyCertNickname,
278 const char* szCertDbPassword,
283 static void getSubjAltName(
char* szSubjAltName,
284 const CERTCertificate* pCert,
285 const size_t length);
302 static UtlBoolean nssSmimeEncrypt(
int numRecipientCerts,
303 const char* derPublicKeyCerts[],
304 int derPublicKeyCertLengths[],
305 const char* szMyCertNickname,
306 const char* szCertDbPassword,
307 const char* dataToEncrypt,
308 int dataToEncryptLength,
309 UtlBoolean encryptedDataInBase64Format,
310 UtlString& encryptedData,
332 static UtlBoolean nssSmimeDecrypt(
const char* derPkcs12,
334 const char* pkcs12Password,
335 const char* certDbPassword,
336 const char* signerCertDER,
337 int signerCertDERLength,
338 UtlBoolean dataIsInBase64Format,
339 const char* dataToDecrypt,
340 int dataToDecryptLength,
341 UtlString& decryptedData,
359 static UtlBoolean opensslSmimeEncrypt(
int numRecipientCerts,
360 const char* derPublicKeyCerts[],
361 int derPublicKeyCertLengths[],
362 const char* dataToEncrypt,
363 int dataToEncryptLength,
364 UtlBoolean encryptedDataInBase64Format,
365 UtlString& encryptedData);
386 static UtlBoolean opensslSmimeDecrypt(
const char* derPkcs12,
388 const char* pkcs12Password,
389 UtlBoolean dataIsInBase64Format,
390 const char* dataToDecrypt,
391 int dataToDecryptLength,
392 UtlString& decryptedData);
395 static UtlBoolean convertPemToDer(UtlString& pemData,
398 static bool importPKCS12Object(
const char* derPkcs12,
400 const char* pkcs12Password,
401 const char* certDbLocation,
402 const char* certDbPassword);
408 const HttpBody* getDecryptedBody()
const;
413 UtlBoolean isDecrypted()
const;
424 static UtlString createSignedData(CERTCertificate *cert,
425 const char* dataToSign,
426 const int dataToSignLength,
427 NSSCMSSignedData*& sigd,
428 char* szCertDbPassword);
438 #endif // _SmimeBody_h_ HttpBody * mpDecryptedBody
Definition: SmimeBody.h:418
#define SIPXTACK_MAX_SMIME_KEY_LENGTH
Definition: SmimeBody.h:55
Container class for security attributes.
Definition: SmimeBody.h:87
void setSrtpKey(const char *szKey, const int length)
Sets the symmetric srtp key.
Definition: SmimeBody.h:119
virtual ~SIPXTACK_SECURITY_ATTRIBUTES()
Definition: SmimeBody.h:108
const char * getCertDbLocation() const
Gets the Certificate Database location (set internally to the location specified in the call to sipxC...
Definition: SmimeBody.h:164
Definition: SmimeBody.h:79
const int getSrtpKeyLength() const
Gets the symmetric srtp key length.
Definition: SmimeBody.h:149
sipXtapi event declarations
Specialization of HttpMessage to contain and manipulate SIP messages.
Definition: SipMessage.h:343
Definition: SmimeBody.h:78
void setSmimeKey(const char *szKey, const int length)
Sets the public key of the remote party, which is used to encrypt the S/MIME container for the SDP...
Definition: SmimeBody.h:128
const char * getSmimeKey() const
Gets the public key of the remote party, which is used to encrypt the S/MIME container for the SDP...
Definition: SmimeBody.h:145
#define SIPXTACK_MAX_SRTP_KEY_LENGTH
Container class for security attributes.
Definition: SmimeBody.h:54
const int getSmimeKeyLength() const
Gets the public key of the remote party, which is used to encrypt the S/MIME container for the SDP...
Definition: SmimeBody.h:154
SIPXTACK_SECURITY_ATTRIBUTES()
Definition: SmimeBody.h:91
#define SIPXTACK_MAX_PASSWORD_LENGTH
Definition: SmimeBody.h:58
Definition: SmimeBody.h:194
SIPX_SECURITY_CAUSE
Enumeration of possible security causes.
Definition: sipXtapiEvents.h:448
const char * getSrtpKey() const
Gets the symmetric srtp key.
Definition: SmimeBody.h:140
void setSecurityLevel(SIPXTACK_SRTP_LEVEL security)
Sets the S/MIME & SRTP security level.
Definition: SmimeBody.h:136
SIPXTACK_SECURITY_ATTRIBUTES(const SIPXTACK_SECURITY_ATTRIBUTES &ref)
Definition: SmimeBody.h:104
SIPXTACK_SECURITY_ATTRIBUTES & operator=(const SIPXTACK_SECURITY_ATTRIBUTES &ref)
Definition: SmimeBody.h:109
Definition: SmimeBody.h:81
Definition: SmimeBody.h:214
virtual ~ISmimeNotifySink()
Definition: SmimeBody.h:200
ContentEncoding
Definition: SmimeBody.h:211
class to contain an PKCS7 (S/MIME) body
Definition: SmimeBody.h:206
Definition: SmimeBody.h:80
SIPXTACK_SRTP_LEVEL
Definition: SmimeBody.h:76
SIPX_SECURITY_EVENT
Enumeration of possible security events.
Definition: sipXtapiEvents.h:431
class to contain an HTTP body
Definition: HttpBody.h:55
const int getSecurityLevel() const
Sets the S/MIME & SRTP security level.
Definition: SmimeBody.h:158