2 * @file sipe-sec-ntlm-tests.c
6 * Copyright (C) 2010 pier11 <pier11@operamail.com>
7 * Copyright (C) 2008 Novell, Inc.
9 * Implemented with reference to the follow documentation:
10 * - http://davenport.sourceforge.net/ntlm.html
11 * - MS-NLMP: http://msdn.microsoft.com/en-us/library/cc207842.aspx
12 * - MS-SIP : http://msdn.microsoft.com/en-us/library/cc246115.aspx
14 * Please use "make tests" to build & run them!
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 #include <glib/gprintf.h>
45 #include "sipe-sign.h"
46 #define _SIPE_COMPILING_TESTS
47 #include "sip-sec-ntlm.c"
51 static int successes
= 0;
52 static int failures
= 0;
54 gboolean
sip_sec_ntlm_tests(void);
56 static void assert_equal(const char * expected
, gpointer got
, int len
, gboolean stringify
)
58 const gchar
* res
= (gchar
*) got
;
59 gchar to_str
[len
*2 + 1];
62 const guint8
*bin
= got
;
64 for (i
= 0, j
= 0; i
< len
; i
++, j
+=2) {
65 g_sprintf(&to_str
[j
], "%02X", (bin
[i
]&0xff));
71 printf("expected: %s\n", expected
);
72 printf("received: %s\n", res
);
74 if (g_ascii_strncasecmp(expected
, res
, len
) == 0) {
83 /* NOTE: both values are expected to be in host byte order! */
84 static void assert_equal_guint32(guint32 expected
, guint32 got
)
86 printf("expected: %08X\n", expected
);
87 printf("received: %08X\n", got
);
89 if (expected
== got
) {
98 gboolean
sip_sec_ntlm_tests(void)
100 const char *password
;
103 const guchar
*client_challenge
;
105 const guchar
*exported_session_key
;
109 guchar hmac_md5
[16];
111 guchar response_key_lm
[16];
112 guchar response_key_nt
[16];
113 guchar nt_challenge_response
[24];
114 guchar lm_challenge_response
[24];
115 guchar session_base_key
[16];
116 guchar key_exchange_key
[16];
117 guchar encrypted_random_session_key
[16];
119 guchar client_seal_key
[16];
120 guchar client_sign_key
[16];
121 guchar server_sign_key
[16];
122 guchar server_seal_key
[16];
124 guchar text_enc
[18 + 12];
126 struct sipmsg_breakdown msgbd
;
129 const char *password2
;
133 const char *type2_hex
;
134 const char *type3_hex
;
136 const char *response
;
137 const gchar
*request_sig
;
138 const gchar
*response_sig
;
140 printf ("Starting Tests\n");
142 /* Initialization for NSS */
144 if (!NSS_IsInitialized()) {
146 SIPE_DEBUG_INFO_NOFORMAT("NSS initialised");
149 /* Initialization for NTLM */
150 sip_sec_init__ntlm();
152 /* These tests are from the MS-SIPE document */
154 password
= "Password";
157 client_challenge
= (guchar
*)"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa";
158 /* server challenge */
159 nonce
= (guchar
*)"\x01\x23\x45\x67\x89\xab\xcd\xef";
161 exported_session_key
= (guchar
*)"\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55";
162 text
= (guchar
*)"\x50\x00\x6c\x00\x61\x00\x69\x00\x6e\x00\x74\x00\x65\x00\x78\x00\x74\x00"; //P·l·a·i·n·t·e·x·t·
165 ////// internal Cyphers tests ///////
166 printf ("\nTesting MD4()\n");
167 MD4 ((const unsigned char *)"message digest", 14, md4
);
168 assert_equal("D9130A8164549FE818874806E1C7014B", md4
, 16, TRUE
);
170 printf ("\nTesting MD5()\n");
171 MD5 ((const unsigned char *)"message digest", 14, md5
);
172 assert_equal("F96B697D7CB7938D525A2F31AAF161D0", md5
, 16, TRUE
);
174 printf ("\nTesting HMAC_MD5()\n");
175 HMAC_MD5 ((const unsigned char *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", 16, (const unsigned char *)"Hi There", 8, hmac_md5
);
176 assert_equal("9294727A3638BB1C13F48EF8158BFC9D", hmac_md5
, 16, TRUE
);
179 ////// NTLMv1 (without Extended Session Security) ///////
183 | NTLMSSP_NEGOTIATE_KEY_EXCH
184 | NTLMSSP_NEGOTIATE_56
185 | NTLMSSP_NEGOTIATE_128
186 | NTLMSSP_NEGOTIATE_VERSION
187 | NTLMSSP_TARGET_TYPE_SERVER
188 | NTLMSSP_NEGOTIATE_ALWAYS_SIGN
189 | NTLMSSP_NEGOTIATE_NTLM
190 | NTLMSSP_NEGOTIATE_SEAL
191 | NTLMSSP_NEGOTIATE_SIGN
192 | NTLMSSP_NEGOTIATE_OEM
193 | NTLMSSP_NEGOTIATE_UNICODE
;
195 printf ("\n\nTesting Negotiation Flags\n");
196 assert_equal_guint32(0xE2028233, flags
);
198 printf ("\n\nTesting LMOWFv1()\n");
199 LMOWFv1 (password
, user
, domain
, response_key_lm
);
200 assert_equal("E52CAC67419A9A224A3B108F3FA6CB6D", response_key_lm
, 16, TRUE
);
202 printf ("\n\nTesting NTOWFv1()\n");
203 NTOWFv1 (password
, user
, domain
, response_key_nt
);
204 assert_equal("A4F49C406510BDCAB6824EE7C30FD852", response_key_nt
, 16, TRUE
);
206 printf ("\n\nTesting LM Response Generation\n");
207 printf ("Testing NT Response Generation\n");
208 printf ("Testing Session Base Key\n");
210 compute_response(flags
,
216 NULL
, /* target_info */
217 0, /* target_info_len */
218 lm_challenge_response
, /* out */
219 nt_challenge_response
, /* out */
220 session_base_key
); /* out */
222 assert_equal("98DEF7B87F88AA5DAFE2DF779688A172DEF11C7D5CCDEF13", lm_challenge_response
, 24, TRUE
);
223 assert_equal("67C43011F30298A2AD35ECE64F16331C44BDBED927841F94", nt_challenge_response
, 24, TRUE
);
224 assert_equal("D87262B0CDE4B1CB7499BECCCDF10784", session_base_key
, 16, TRUE
);
226 printf ("\n\nTesting Key Exchange Key\n");
227 KXKEY(flags
, session_base_key
, lm_challenge_response
, nonce
, key_exchange_key
);
228 assert_equal("D87262B0CDE4B1CB7499BECCCDF10784", key_exchange_key
, 16, TRUE
);
230 printf ("\n\nTesting Encrypted Session Key Generation\n");
231 RC4K (key_exchange_key
, 16, exported_session_key
, 16, encrypted_random_session_key
);
232 assert_equal("518822B1B3F350C8958682ECBB3E3CB7", encrypted_random_session_key
, 16, TRUE
);
234 printf ("\n\nTesting CRC32\n");
235 crc
= CRC32((char*)text
, 18);
236 assert_equal_guint32(0x93AA847D, crc
);
238 printf ("\n\nTesting Encryption\n");
240 //SEALKEY (flags, exported_session_key, TRUE, client_seal_key);
241 guchar buff
[18 + 12];
244 memcpy(buff
, text
, 18);
245 to_enc
[0] = GUINT32_TO_LE(0); // random pad
246 to_enc
[1] = GUINT32_TO_LE(crc
);
247 to_enc
[2] = GUINT32_TO_LE(0); // zero
248 memcpy(buff
+18, (gchar
*)to_enc
, 12);
249 RC4K (exported_session_key
, 16, buff
, 18 + 12, text_enc
);
250 //The point is to not reinitialize rc4 cypher
252 assert_equal("56FE04D861F9319AF0D7238A2E3B4D457FB8" "45C844E5" "09DCD1DF" "2E459D36", text_enc
, 18 + 12, TRUE
);
255 printf ("\n\nTesting MAC\n");
257 // won't work in the case with sealing because RC4 is re-initialized inside.
258 // MAC (flags, (gchar*)text, 18, (guchar*)exported_session_key, 16, (guchar*)exported_session_key,16, 0x00000000, 0, mac);
262 memcpy((gchar
*)enc
, text_enc
+18, 12);
263 mac2
[0] = GUINT32_TO_LE(1); // version
266 mac2
[3] = enc
[2] ^ (GUINT32_TO_LE(0)); // ^ seq
267 assert_equal("0100000045C844E509DCD1DF2E459D36", (guchar
*)mac2
, 16, TRUE
);
271 ////// EXTENDED_SESSIONSECURITY ///////
274 | NTLMSSP_NEGOTIATE_56
275 | NTLMSSP_NEGOTIATE_VERSION
276 | NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
277 | NTLMSSP_TARGET_TYPE_SERVER
278 | NTLMSSP_NEGOTIATE_ALWAYS_SIGN
279 | NTLMSSP_NEGOTIATE_NTLM
280 | NTLMSSP_NEGOTIATE_SEAL
281 | NTLMSSP_NEGOTIATE_SIGN
282 | NTLMSSP_NEGOTIATE_OEM
283 | NTLMSSP_NEGOTIATE_UNICODE
;
285 printf ("\n\n(Extended session security) Testing Negotiation Flags\n");
286 assert_equal_guint32(0x820A8233, flags
);
288 /* NTOWFv1() is not different from the above test for the same */
290 printf ("\n\n(Extended session security) Testing LM Response\n");
291 printf ("(Extended session security) Testing NT Response\n");
292 printf ("(Extended session security) Testing Session Base Key\n");
293 compute_response(flags
,
299 NULL
, /* target_info */
300 0, /* target_info_len */
301 lm_challenge_response
, /* out */
302 nt_challenge_response
, /* out */
303 session_base_key
); /* out */
305 assert_equal("AAAAAAAAAAAAAAAA00000000000000000000000000000000", lm_challenge_response
, 24, TRUE
);
306 assert_equal("7537F803AE367128CA458204BDE7CAF81E97ED2683267232", nt_challenge_response
, 24, TRUE
);
307 assert_equal("D87262B0CDE4B1CB7499BECCCDF10784", session_base_key
, 16, TRUE
);
309 printf ("\n\n(Extended session security) Testing Key Exchange Key\n");
310 KXKEY(flags
, session_base_key
, lm_challenge_response
, nonce
, key_exchange_key
);
311 assert_equal("EB93429A8BD952F8B89C55B87F475EDC", key_exchange_key
, 16, TRUE
);
313 printf ("\n\n(Extended session security) SIGNKEY\n");
314 SIGNKEY (key_exchange_key
, TRUE
, client_sign_key
);
315 assert_equal("60E799BE5C72FC92922AE8EBE961FB8D", client_sign_key
, 16, TRUE
);
317 printf ("\n\n(Extended session security) SEALKEY\n");
318 SEALKEY (flags
, key_exchange_key
, TRUE
, client_seal_key
);
319 assert_equal("04DD7F014D8504D265A25CC86A3A7C06", client_seal_key
, 16, TRUE
);
321 printf ("\n\n(Extended session security) Testing Encryption\n");
322 RC4K (client_seal_key
, 16, text
, 18, text_enc
);
323 assert_equal("A02372F6530273F3AA1EB90190CE5200C99D", text_enc
, 18, TRUE
);
325 printf ("\n\n(Extended session security) Testing MAC\n");
326 MAC (flags
, (gchar
*)text
,18, client_sign_key
,16, client_seal_key
,16, 0, 0, mac
);
327 assert_equal("01000000FF2AEB52F681793A00000000", mac
, 16, TRUE
);
330 ////// NTLMv2 ///////
333 | NTLMSSP_NEGOTIATE_KEY_EXCH
334 | NTLMSSP_NEGOTIATE_56
335 | NTLMSSP_NEGOTIATE_128
336 | NTLMSSP_NEGOTIATE_VERSION
337 | NTLMSSP_NEGOTIATE_TARGET_INFO
338 | NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
339 | NTLMSSP_TARGET_TYPE_SERVER
340 | NTLMSSP_NEGOTIATE_ALWAYS_SIGN
341 | NTLMSSP_NEGOTIATE_NTLM
342 | NTLMSSP_NEGOTIATE_SEAL
343 | NTLMSSP_NEGOTIATE_SIGN
344 | NTLMSSP_NEGOTIATE_OEM
345 | NTLMSSP_NEGOTIATE_UNICODE
;
347 printf ("\n\nTesting (NTLMv2) Negotiation Flags\n");
348 assert_equal_guint32(0xE28A8233, flags
);
350 printf ("\n\nTesting NTOWFv2()\n");
351 NTOWFv2 (password
, user
, domain
, response_key_nt
);
352 NTOWFv2 (password
, user
, domain
, response_key_lm
);
353 assert_equal("0C868A403BFD7A93A3001EF22EF02E3F", response_key_nt
, 16, TRUE
);
356 printf ("\n\nTesting (NTLMv2) LM Response Generation\n");
357 printf ("Testing (NTLMv2) NT Response Generation and Session Base Key\n");
360 4e544c4d53535000020000000c000c003800000033828ae20123456789abcdef00000000000000002400240044000000060070170000000f53006500720076006500720002000c0044006f006d00610069006e0001000c0053006500720076006500720000000000
362 NTLMSSP_NEGOTIATE_UNICODE
363 NTLMSSP_NEGOTIATE_OEM
364 NTLMSSP_NEGOTIATE_SIGN
365 NTLMSSP_NEGOTIATE_SEAL
366 NTLMSSP_NEGOTIATE_NTLM
367 NTLMSSP_NEGOTIATE_ALWAYS_SIGN
368 NTLMSSP_TARGET_TYPE_SERVER
369 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
370 NTLMSSP_NEGOTIATE_TARGET_INFO
371 NTLMSSP_NEGOTIATE_VERSION
372 NTLMSSP_NEGOTIATE_128
373 NTLMSSP_NEGOTIATE_KEY_EXCH
376 target_name.maxlen: 12
377 target_name.offset: 56
379 target_info.maxlen: 36
380 target_info.offset: 68
381 product: 6.0.6000 (Windows Vista, Windows Server 2008, Windows 7 or Windows Server 2008 R2)
382 ntlm_revision_current: 0x0F (NTLMSSP_REVISION_W2K3)
384 MsvAvNbDomainName: Domain
385 MsvAvNbComputerName: Server
388 530065007200760065007200
390 02000c0044006f006d00610069006e0001000c0053006500720076006500720000000000
393 4e544c4d5353500003000000180018006c00000054005400840000000c000c00480000000800080054000000100010005c00000010001000d8000000358288e20501280a0000000f44006f006d00610069006e00550073006500720043004f004d005000550054004500520086c35097ac9cec102554764a57cccc19aaaaaaaaaaaaaaaa68cd0ab851e51c96aabc927bebef6a1c01010000000000000000000000000000aaaaaaaaaaaaaaaa0000000002000c0044006f006d00610069006e0001000c005300650072007600650072000000000000000000c5dad2544fc9799094ce1ce90bc9d03e
398 const guint64 time_val
= 0;
399 const guint8 target_info
[] = {
400 0x02, 0x00, 0x0C, 0x00, //NetBIOS Domain name, 4 bytes
401 0x44, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6E, 0x00, //D.o.m.a.i.n. 12bytes
402 0x01, 0x00, 0x0C, 0x00, //NetBIOS Server name, 4 bytes
403 0x53, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, //S.e.r.v.e.r. 12bytes
404 0x00, 0x00, 0x00, 0x00, //Av End, 4 bytes
406 const int target_info_len
= 32+4;
407 int ntlmssp_nt_resp_len
= (16 + (32+target_info_len
));
408 guchar nt_challenge_response_v2
[ntlmssp_nt_resp_len
];
410 compute_response(flags
,
416 target_info
, /* target_info */
417 target_info_len
, /* target_info_len */
418 lm_challenge_response
, /* out */
419 nt_challenge_response_v2
, /* out */
420 session_base_key
); /* out */
422 assert_equal("86C35097AC9CEC102554764A57CCCC19AAAAAAAAAAAAAAAA", lm_challenge_response
, 24, TRUE
);
423 assert_equal("68CD0AB851E51C96AABC927BEBEF6A1C", nt_challenge_response_v2
, 16, TRUE
);
424 /* the ref string is taken from binary dump of AUTHENTICATE_MESSAGE */
425 assert_equal("68CD0AB851E51C96AABC927BEBEF6A1C01010000000000000000000000000000AAAAAAAAAAAAAAAA0000000002000C0044006F006D00610069006E0001000C005300650072007600650072000000000000000000", nt_challenge_response_v2
, ntlmssp_nt_resp_len
, TRUE
);
426 assert_equal("8DE40CCADBC14A82F15CB0AD0DE95CA3", session_base_key
, 16, TRUE
);
429 printf ("\n\nTesting (NTLMv2) Encrypted Session Key\n");
430 // key_exchange_key = session_base_key for NTLMv2
431 KXKEY(flags
, session_base_key
, lm_challenge_response
, nonce
, key_exchange_key
);
432 //RC4 encryption of the RandomSessionKey with the KeyExchangeKey:
433 RC4K (key_exchange_key
, 16, exported_session_key
, 16, encrypted_random_session_key
);
434 assert_equal("C5DAD2544FC9799094CE1CE90BC9D03E", encrypted_random_session_key
, 16, TRUE
);
436 printf ("\n\nTesting (NTLMv2) SIGNKEY\n");
437 SIGNKEY (exported_session_key
, TRUE
, client_sign_key
);
438 assert_equal("4788DC861B4782F35D43FD98FE1A2D39", client_sign_key
, 16, TRUE
);
440 printf ("\n\nTesting (NTLMv2) SEALKEY\n");
441 SEALKEY (flags
, exported_session_key
, TRUE
, client_seal_key
);
442 assert_equal("59F600973CC4960A25480A7C196E4C58", client_seal_key
, 16, TRUE
);
444 printf ("\n\nTesting (NTLMv2) Encryption\n");
445 RC4K (client_seal_key
, 16, text
, 18, text_enc
);
446 assert_equal("54E50165BF1936DC996020C1811B0F06FB5F", text_enc
, 18, TRUE
);
448 // printf ("\n\nTesting (NTLMv2) Encryption\n");
449 //const guchar text2 [] = {0x50, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x78, 0x00, 0x74, 0x00
450 // , 0x70, 0x35, 0x28, 0x51, 0xf2, 0x56, 0x43, 0x09}; //P·l·a·i·n·t·e·x·t·
451 //guchar text_enc2 [18+8];
452 // RC4K (client_seal_key, 16, text2, 18+8, text_enc2);
453 // assert_equal("54E50165BF1936DC996020C1811B0F06FB5F", text_enc2, 18+8, TRUE);
455 printf ("\n\nTesting (NTLMv2) MAC (without RC4, as we don't keep its handle yet)\n");
456 MAC (flags
& ~NTLMSSP_NEGOTIATE_KEY_EXCH
, (gchar
*)text
,18, client_sign_key
,16, client_seal_key
,16, 0, 0, mac
);
457 assert_equal("0100000070352851F256430900000000", mac
, 16, TRUE
);
460 /* End tests from the MS-SIPE document */
463 ////// davenport tests ///////
464 // Test from http://davenport.sourceforge.net/ntlm.html#ntlm1Signing
466 const gchar
*text_j
= "jCIFS";
467 printf ("\n\n(davenport) Testing Signature Algorithm\n");
469 guchar sk
[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0xe5, 0x38, 0xb0};
470 MAC (NEGOTIATE_FLAGS_CONNLESS
& ~NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
, text_j
, strlen(text_j
), sk
, 8, sk
,8, 0x00090178, 0, mac
);
471 assert_equal("0100000078010900397420FE0E5A0F89", mac
, 16, TRUE
);
474 // Tests from http://davenport.sourceforge.net/ntlm.html#ntlm2Signing
475 printf ("\n\n(davenport) SIGNKEY\n");
477 const guchar master_key
[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00};
478 SIGNKEY (master_key
, TRUE
, client_sign_key
);
479 assert_equal("F7F97A82EC390F9C903DAC4F6ACEB132", client_sign_key
, 16, TRUE
);
481 printf ("\n\n(davenport) Testing MAC - no Key Exchange flag\n");
482 MAC (flags
& ~NTLMSSP_NEGOTIATE_KEY_EXCH
, text_j
, strlen(text_j
), client_sign_key
, 16, client_sign_key
,16, 0, 0, mac
);
483 assert_equal("010000000A003602317A759A00000000", mac
, 16, TRUE
);
488 ////// SIPE internal tests ///////
489 // Verify signature of SIPE message received from OCS 2007 after authenticating with pidgin-sipe
490 printf ("\n\nTesting MS-SIPE Example Message Signing\n");
493 char * msg1
= "<NTLM><0878F41B><1><SIP Communications Service><ocs1.ocs.provo.novell.com><8592g5DCBa1694i5887m0D0Bt2247b3F38xAE9Fx><3><REGISTER><sip:gabriel@ocs.provo.novell.com><2947328781><B816D65C2300A32CFA6D371F2AF537FD><900><200>";
494 guchar exported_session_key2
[] = { 0x5F, 0x02, 0x91, 0x53, 0xBC, 0x02, 0x50, 0x58, 0x96, 0x95, 0x48, 0x61, 0x5E, 0x70, 0x99, 0xBA };
496 MAC (NEGOTIATE_FLAGS_CONNLESS
& ~NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
,
497 msg1
, strlen(msg1
), exported_session_key2
, 16, exported_session_key2
,16, 0, 100, mac
);
498 assert_equal("0100000000000000BF2E52667DDF6DED", mac
, 16, TRUE
);
500 // Verify parsing of message and signature verification
501 printf ("\n\nTesting MS-SIPE Example Message Parsing, Signing, and Verification\n(Authentication Protocol Version 2)\n");
502 msg2
= "SIP/2.0 200 OK\r\nms-keep-alive: UAS; tcp=no; hop-hop=yes; end-end=no; timeout=300\r\nAuthentication-Info: NTLM rspauth=\"0100000000000000BF2E52667DDF6DED\", srand=\"0878F41B\", snum=\"1\", opaque=\"4452DFB0\", qop=\"auth\", targetname=\"ocs1.ocs.provo.novell.com\", realm=\"SIP Communications Service\"\r\nFrom: \"Gabriel Burt\"<sip:gabriel@ocs.provo.novell.com>;tag=2947328781;epid=1234567890\r\nTo: <sip:gabriel@ocs.provo.novell.com>;tag=B816D65C2300A32CFA6D371F2AF537FD\r\nCall-ID: 8592g5DCBa1694i5887m0D0Bt2247b3F38xAE9Fx\r\nCSeq: 3 REGISTER\r\nVia: SIP/2.0/TLS 164.99.194.49:10409;branch=z9hG4bKE0E37DBAF252C3255BAD;received=164.99.195.20;ms-received-port=10409;ms-received-cid=1E00\r\nContact: <sip:164.99.195.20:10409;transport=tls;ms-received-cid=1E00>;expires=900\r\nExpires: 900\r\nAllow-Events: vnd-microsoft-provisioning,vnd-microsoft-roaming-contacts,vnd-microsoft-roaming-ACL,presence,presence.wpending,vnd-microsoft-roaming-self,vnd-microsoft-provisioning-v2\r\nSupported: adhoclist\r\nServer: RTC/3.0\r\nSupported: com.microsoft.msrtc.presence\r\nContent-Length: 0\r\n\r\n";
503 msg
= sipmsg_parse_msg(msg2
);
506 sipmsg_breakdown_parse(&msgbd
, "SIP Communications Service", "ocs1.ocs.provo.novell.com");
507 msg_str
= sipmsg_breakdown_get_string(2, &msgbd
);
508 sip_sec_ntlm_sipe_signature_make (NEGOTIATE_FLAGS_CONNLESS
& ~NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
,
509 msg_str
, 0, exported_session_key2
, exported_session_key2
, mac
);
510 sipmsg_breakdown_free(&msgbd
);
511 assert_equal ("0100000000000000BF2E52667DDF6DED", mac
, 16, TRUE
);
512 sig
= buff_to_hex_str((guint8
*)mac
, 16);
516 ////// real Communicator 2007 R2 tests //////
517 ////// Recreated/verifyed real authentication communication between
518 ////// Communicator 2007 R2 and Office Communications Server 2007 R2
519 ////// with SIPE NTLMv2 implementation.
521 password2
= "Pa$$word";
524 host2
= "COSMO-OCS-R2";
527 //const char *type2 = "TlRMTVNTUAACAAAAAAAAADgAAADzgpji3Ruq9OfiGNEAAAAAAAAAAJYAlgA4AAAABQLODgAAAA8CAAoAQwBPAFMATQBPAAEAGABDAE8AUwBNAE8ALQBPAEMAUwAtAFIAMgAEABYAYwBvAHMAbQBvAC4AbABvAGMAYQBsAAMAMABjAG8AcwBtAG8ALQBvAGMAcwAtAHIAMgAuAGMAbwBzAG0AbwAuAGwAbwBjAGEAbAAFABYAYwBvAHMAbQBvAC4AbABvAGMAYQBsAAAAAAA=";
528 //in hex (base64 decoded):
529 type2_hex
= "4E544C4D53535000020000000000000038000000F38298E2DD1BAAF4E7E218D1000000000000000096009600380000000502CE0E0000000F02000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C0000000000";
531 Message (length 206):
532 NTLMSSP_NEGOTIATE_UNICODE
533 NTLMSSP_NEGOTIATE_OEM
534 NTLMSSP_NEGOTIATE_SIGN
535 NTLMSSP_NEGOTIATE_SEAL
536 NTLMSSP_NEGOTIATE_DATAGRAM
537 NTLMSSP_NEGOTIATE_LM_KEY
538 NTLMSSP_NEGOTIATE_NTLM
539 NTLMSSP_NEGOTIATE_ALWAYS_SIGN
540 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
541 NTLMSSP_NEGOTIATE_IDENTIFY
542 NTLMSSP_NEGOTIATE_TARGET_INFO
543 NTLMSSP_NEGOTIATE_VERSION
544 NTLMSSP_NEGOTIATE_128
545 NTLMSSP_NEGOTIATE_KEY_EXCH
547 server_challenge: DD1BAAF4E7E218D1
549 target_name.maxlen: 0
550 target_name.offset: 56
551 target_info.len : 150
552 target_info.maxlen: 150
553 target_info.offset: 56
554 product: 5.2.3790 (Windows Server 2003)
555 ntlm_revision_current: 0x0F (NTLMSSP_REVISION_W2K3)
556 target_info raw: 02000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C0000000000
557 MsvAvNbDomainName: COSMO
558 MsvAvNbComputerName: COSMO-OCS-R2
559 MsvAvDnsDomainName: cosmo.local
560 MsvAvDnsComputerName: cosmo-ocs-r2.cosmo.local
561 MsvAvDnsTreeName: cosmo.local
566 //const char *type3 = "TlRMTVNTUAADAAAAGAAYAHIAAADGAMYAigAAAAoACgBIAAAACAAIAFIAAAAYABgAWgAAABAAEABQAQAAVYKYYgUCzg4AAAAPQwBPAFMATQBPAFUAcwBlAHIAQwBPAFMATQBPAC0ATwBDAFMALQBSADIAoeku/k4Hi/fFwASazGFmwtauh1yw/apBjcDIAK527KYG0rn769BHMQEBAAAAAAAAWVGaFye5ygHWrodcsP2qQQAAAAACAAoAQwBPAFMATQBPAAEAGABDAE8AUwBNAE8ALQBPAEMAUwAtAFIAMgAEABYAYwBvAHMAbQBvAC4AbABvAGMAYQBsAAMAMABjAG8AcwBtAG8ALQBvAGMAcwAtAHIAMgAuAGMAbwBzAG0AbwAuAGwAbwBjAGEAbAAFABYAYwBvAHMAbQBvAC4AbABvAGMAYQBsAAAAAAAAAAAAMctznhyoCkmFkeiueXEV5A==";
567 //in hex (base64 decoded):
568 type3_hex
= "4E544C4D53535000030000001800180072000000C600C6008A0000000A000A00480000000800080052000000180018005A0000001000100050010000558298620502CE0E0000000F43004F0053004D004F00550073006500720043004F0053004D004F002D004F00430053002D0052003200A1E92EFE4E078BF7C5C0049ACC6166C2D6AE875CB0FDAA418DC0C800AE76ECA606D2B9FBEBD04731010100000000000059519A1727B9CA01D6AE875CB0FDAA410000000002000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C00000000000000000031CB739E1CA80A498591E8AE797115E4";
570 Message (length 352):
571 NTLMSSP_NEGOTIATE_UNICODE
572 NTLMSSP_REQUEST_TARGET
573 NTLMSSP_NEGOTIATE_SIGN
574 NTLMSSP_NEGOTIATE_DATAGRAM
575 NTLMSSP_NEGOTIATE_NTLM
576 NTLMSSP_NEGOTIATE_ALWAYS_SIGN
577 NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
578 NTLMSSP_NEGOTIATE_IDENTIFY
579 NTLMSSP_NEGOTIATE_TARGET_INFO
580 NTLMSSP_NEGOTIATE_VERSION
581 NTLMSSP_NEGOTIATE_128
582 NTLMSSP_NEGOTIATE_KEY_EXCH
599 session_key.maxlen: 16
600 session_key.offset: 336
601 product: 5.2.3790 (Windows Server 2003)
602 ntlm_revision_current: 0x0F (NTLMSSP_REVISION_W2K3)
603 lm_resp: A1E92EFE4E078BF7C5C0049ACC6166C2D6AE875CB0FDAA41
604 nt_resp raw: 8DC0C800AE76ECA606D2B9FBEBD04731010100000000000059519A1727B9CA01D6AE875CB0FDAA410000000002000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C000000000000000000
605 nt_resp: 8DC0C800AE76ECA606D2B9FBEBD04731
606 target_info raw: 02000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C0000000000
608 hi_response_version: 1
609 time: 59519A1727B9CA01 - Mon Mar 01 10:08:08 2010
610 client_challenge: D6AE875CB0FDAA41
611 MsvAvNbDomainName: COSMO
612 MsvAvNbComputerName: COSMO-OCS-R2
613 MsvAvDnsDomainName: cosmo.local
614 MsvAvDnsComputerName: cosmo-ocs-r2.cosmo.local
615 MsvAvDnsTreeName: cosmo.local
616 ----------- end of nt_resp v2 -----------
620 session_key: 31CB739E1CA80A498591E8AE797115E4
624 "REGISTER sip:cosmo.local SIP/2.0\r\n"
625 "Via: SIP/2.0/TLS 192.168.172.6:12723\r\n"
626 "Max-Forwards: 70\r\n"
627 "From: <sip:user@cosmo.local>;tag=3e49177a52;epid=c8ca638a15\r\n"
628 "To: <sip:user@cosmo.local>\r\n"
629 "Call-ID: 4037df9284354df39065195bd57a4b14\r\n"
630 "CSeq: 3 REGISTER\r\n"
631 "Contact: <sip:192.168.172.6:12723;transport=tls;ms-opaque=fad3dfab32>;methods=\"INVITE, MESSAGE, INFO, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER, BENOTIFY\";proxy=replace;+sip.instance=\"<urn:uuid:34D859DB-6585-5F91-A3B4-DE853C15347D>\"\r\n"
632 "User-Agent: UCCAPI/3.5.6907.0 OC/3.5.6907.0 (Microsoft Office Communicator 2007 R2)\r\n"
633 "Supported: gruu-10, adhoclist, msrtc-event-categories\r\n"
634 "Supported: ms-forking\r\n"
635 "ms-keep-alive: UAC;hop-hop=yes\r\n"
636 "Event: registration\r\n"
637 "Proxy-Authorization: NTLM qop=\"auth\", realm=\"SIP Communications Service\", opaque=\"2BDBAC9D\", targetname=\"cosmo-ocs-r2.cosmo.local\", version=4, gssapi-data=\"TlRMTVNTUAADAAAAGAAYAHIAAADGAMYAigAAAAoACgBIAAAACAAIAFIAAAAYABgAWgAAABAAEABQAQAAVYKYYgUCzg4AAAAPQwBPAFMATQBPAFUAcwBlAHIAQwBPAFMATQBPAC0ATwBDAFMALQBSADIAoeku/k4Hi/fFwASazGFmwtauh1yw/apBjcDIAK527KYG0rn769BHMQEBAAAAAAAAWVGaFye5ygHWrodcsP2qQQAAAAACAAoAQwBPAFMATQBPAAEAGABDAE8AUwBNAE8ALQBPAEMAUwAtAFIAMgAEABYAYwBvAHMAbQBvAC4AbABvAGMAYQBsAAMAMABjAG8AcwBtAG8ALQBvAGMAcwAtAHIAMgAuAGMAbwBzAG0AbwAuAGwAbwBjAGEAbAAFABYAYwBvAHMAbQBvAC4AbABvAGMAYQBsAAAAAAAAAAAAMctznhyoCkmFkeiueXEV5A==\", crand=\"13317733\", cnum=\"1\", response=\"0100000029618e9651b65a7764000000\"\r\n"
638 "Content-Length: 0\r\n"
641 request_sig
= "<NTLM><13317733><1><SIP Communications Service><cosmo-ocs-r2.cosmo.local><4037df9284354df39065195bd57a4b14><3><REGISTER><sip:user@cosmo.local><3e49177a52><sip:user@cosmo.local><><><><>";
643 //0100000029618e9651b65a7764000000
647 "ms-keep-alive: UAS; tcp=no; hop-hop=yes; end-end=no; timeout=300\r\n"
648 "Authentication-Info: NTLM rspauth=\"01000000E615438A917661BE64000000\", srand=\"9616454F\", snum=\"1\", opaque=\"2BDBAC9D\", qop=\"auth\", targetname=\"cosmo-ocs-r2.cosmo.local\", realm=\"SIP Communications Service\"\r\n"
649 "From: \"User\"<sip:user@cosmo.local>;tag=3e49177a52;epid=c8ca638a15\r\n"
650 "To: <sip:user@cosmo.local>;tag=5E61CCD925D17E043D9A74835A88F664\r\n"
651 "Call-ID: 4037df9284354df39065195bd57a4b14\r\n"
652 "CSeq: 3 REGISTER\r\n"
653 "Via: SIP/2.0/TLS 192.168.172.6:12723;ms-received-port=12723;ms-received-cid=2600\r\n"
654 "Contact: <sip:192.168.172.6:12723;transport=tls;ms-opaque=fad3dfab32;ms-received-cid=2600>;expires=7200;+sip.instance=\"<urn:uuid:34d859db-6585-5f91-a3b4-de853c15347d>\";gruu=\"sip:user@cosmo.local;opaque=user:epid:21nYNIVlkV-jtN6FPBU0fQAA;gruu\"\r\n"
656 "presence-state: register-action=\"added\"\r\n"
657 "Allow-Events: vnd-microsoft-provisioning,vnd-microsoft-roaming-contacts,vnd-microsoft-roaming-ACL,presence,presence.wpending,vnd-microsoft-roaming-self,vnd-microsoft-provisioning-v2\r\n"
658 "Supported: adhoclist\r\n"
659 "Server: RTC/3.5\r\n"
660 "Supported: msrtc-event-categories\r\n"
661 "Content-Length: 0\r\n"
664 response_sig
= "<NTLM><9616454F><1><SIP Communications Service><cosmo-ocs-r2.cosmo.local><4037df9284354df39065195bd57a4b14><3><REGISTER><sip:user@cosmo.local><3e49177a52><sip:user@cosmo.local><5E61CCD925D17E043D9A74835A88F664><><><7200><200>";
666 //01000000E615438A917661BE64000000
670 | NTLMSSP_NEGOTIATE_UNICODE
671 | NTLMSSP_REQUEST_TARGET
672 | NTLMSSP_NEGOTIATE_SIGN
673 | NTLMSSP_NEGOTIATE_DATAGRAM
674 | NTLMSSP_NEGOTIATE_NTLM
675 | NTLMSSP_NEGOTIATE_ALWAYS_SIGN
676 | NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY
677 | NTLMSSP_NEGOTIATE_IDENTIFY
678 | NTLMSSP_NEGOTIATE_TARGET_INFO
679 | NTLMSSP_NEGOTIATE_VERSION
680 | NTLMSSP_NEGOTIATE_128
681 | NTLMSSP_NEGOTIATE_KEY_EXCH
;
684 test_version
.product_major_version
= 5;
685 test_version
.product_minor_version
= 2;
686 test_version
.product_build
= GUINT16_FROM_LE(3790);
687 test_version
.ntlm_revision_current
= 0x0F;
689 NTOWFv2 (password2
, user2
, domain2
, response_key_nt
);
690 NTOWFv2 (password2
, user2
, domain2
, response_key_lm
);
693 int ntlmssp_nt_resp_len
;
694 int target_info2_len
;
696 guint8
*target_info2
;
698 /* buff2 points to correctly aligned memory. Disable alignment check */
699 hex_str_to_buff("59519A1727B9CA01", (void *)&buff2
);
701 test_time_val
= GUINT64_FROM_LE(*buff2
);
704 target_info2_len
= hex_str_to_buff("02000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C0000000000", &target_info2
);
706 hex_str_to_buff("DD1BAAF4E7E218D1", &nonce2
);
708 /* buff2 points to correctly aligned memory. Disable alignment check */
709 hex_str_to_buff("D6AE875CB0FDAA41", (void *)&buff2
);
711 memcpy(test_client_challenge
, buff2
, 8);
714 ntlmssp_nt_resp_len
= (16 + (32+target_info2_len
));
716 guchar nt_challenge_response_v2_2
[ntlmssp_nt_resp_len
];
718 printf ("\n\nTesting (NTLMv2 / OC 2007 R2) LM Response Generation\n");
719 printf ( "Testing (NTLMv2 / OC 2007 R2) NT Response Generation\n");
720 compute_response(flags
,
724 test_client_challenge
,
726 target_info2
, /* target_info */
727 target_info2_len
, /* target_info_len */
728 lm_challenge_response
, /* out */
729 nt_challenge_response_v2_2
, /* out */
730 session_base_key
); /* out */
732 g_free(target_info2
);
734 assert_equal("A1E92EFE4E078BF7C5C0049ACC6166C2D6AE875CB0FDAA41", lm_challenge_response
, 24, TRUE
);
735 assert_equal("8DC0C800AE76ECA606D2B9FBEBD04731", nt_challenge_response_v2_2
, 16, TRUE
);
736 /* the ref string is taken from binary dump of AUTHENTICATE_MESSAGE */
737 assert_equal("8DC0C800AE76ECA606D2B9FBEBD04731010100000000000059519A1727B9CA01D6AE875CB0FDAA410000000002000A0043004F0053004D004F000100180043004F0053004D004F002D004F00430053002D00520032000400160063006F0073006D006F002E006C006F00630061006C000300300063006F0073006D006F002D006F00630073002D00720032002E0063006F0073006D006F002E006C006F00630061006C000500160063006F0073006D006F002E006C006F00630061006C000000000000000000", nt_challenge_response_v2_2
, ntlmssp_nt_resp_len
, TRUE
);
740 KXKEY(flags
, session_base_key
, lm_challenge_response
, nonce2
, key_exchange_key
);
744 //as in the Type3 message
746 guint8
*encrypted_random_session_key2
;
747 hex_str_to_buff("31CB739E1CA80A498591E8AE797115E4", &encrypted_random_session_key2
);
748 /* global buff - test_random_session_key */
749 //decoding exported_session_key
750 RC4K (key_exchange_key
, 16, encrypted_random_session_key2
, 16, test_random_session_key
);
751 g_free(encrypted_random_session_key2
);
754 SIGNKEY (test_random_session_key
, TRUE
, client_sign_key
);
755 SEALKEY (flags
, test_random_session_key
, TRUE
, client_seal_key
);
756 SIGNKEY (test_random_session_key
, FALSE
, server_sign_key
);
757 SEALKEY (flags
, test_random_session_key
, FALSE
, server_seal_key
);
759 printf ("\n\nTesting (NTLMv2 / OC 2007 R2) Message Parsing, Signing, and Verification\nClient request\n(Authentication Protocol version 4)\n");
760 msg
= sipmsg_parse_msg(request
);
762 sipmsg_breakdown_parse(&msgbd
, "SIP Communications Service", "cosmo-ocs-r2.cosmo.local");
763 msg_str
= sipmsg_breakdown_get_string(4, &msgbd
);
764 assert_equal (request_sig
, (guchar
*)msg_str
, strlen(request_sig
), FALSE
);
765 sip_sec_ntlm_sipe_signature_make (flags
, msg_str
, 0, client_sign_key
, client_seal_key
, mac
);
766 sipmsg_breakdown_free(&msgbd
);
767 assert_equal ("0100000029618e9651b65a7764000000", mac
, 16, TRUE
);
768 sig
= buff_to_hex_str((guint8
*)mac
, 16);
770 printf ("\n\nTesting (NTLMv2 / OC 2007 R2) Message Parsing, Signing, and Verification\nServer response\n(Authentication Protocol version 4)\n");
771 msg
= sipmsg_parse_msg(response
);
773 sipmsg_breakdown_parse(&msgbd
, "SIP Communications Service", "cosmo-ocs-r2.cosmo.local");
774 msg_str
= sipmsg_breakdown_get_string(4, &msgbd
);
775 assert_equal (response_sig
, (guchar
*)msg_str
, strlen(response_sig
), FALSE
);
777 sip_sec_ntlm_sipe_signature_make (flags
, msg_str
, 0, server_sign_key
, server_seal_key
, mac
);
778 sipmsg_breakdown_free(&msgbd
);
779 assert_equal ("01000000E615438A917661BE64000000", mac
, 16, TRUE
);
780 sig
= buff_to_hex_str((guint8
*)mac
, 16);
782 printf ("\n\nTesting (NTLMv2 / OC 2007 R2) MAC - client signing\n");
783 MAC (flags
, (gchar
*)request_sig
,strlen(request_sig
), client_sign_key
,16, client_seal_key
,16, 0, 100, mac
);
784 assert_equal("0100000029618e9651b65a7764000000", mac
, 16, TRUE
);
786 printf ("\n\nTesting (NTLMv2 / OC 2007 R2) MAC - server's verifying\n");
787 MAC (flags
, (gchar
*)response_sig
,strlen(response_sig
), server_sign_key
,16, server_seal_key
,16, 0, 100, mac
);
788 assert_equal("01000000E615438A917661BE64000000", mac
, 16, TRUE
);
790 printf ("\n\nTesting (NTLMv2 / OC 2007 R2) Type3 generation test\n");
792 guchar
*client_sign_key2
;
793 guchar
*server_sign_key2
;
794 guchar
*client_seal_key2
;
795 guchar
*server_seal_key2
;
797 guchar
*server_challenge
= NULL
;
798 guint64 time_val2
= 0;
799 guchar
*target_info3
= NULL
;
800 int target_info3_len
= 0;
802 SipSecBuffer in_buff
;
803 SipSecBuffer out_buff
;
805 in_buff
.length
= hex_str_to_buff(type2_hex
, (guint8
**)&(in_buff
.value
));
807 sip_sec_ntlm_parse_challenge(in_buff
,
814 sip_sec_ntlm_gen_authenticate(&client_sign_key2
,
830 g_free(server_challenge
);
831 g_free(target_info3
);
833 assert_equal(type3_hex
, out_buff
.value
, out_buff
.length
, TRUE
);
836 printf ("\n\nTesting Authentication Algorithm's v4 Signature String\n");
838 char *response_symbian
=
839 "SIP/2.0 180 Ringing\r\n"
840 "Authentication-Info: NTLM rspauth=\"010000003EA8D688BA51D5CD64000000\", srand=\"1B6D47A1\", snum=\"11\", opaque=\"357E6F72\", qop=\"auth\", targetname=\"LOC-COMPANYT-FE03.COMPANY.COM\", realm=\"SIP Communications Service\"\r\n"
841 "Via: SIP/2.0/tls 192.168.44.10:50230;received=10.117.245.254;ms-received-port=50230;ms-received-cid=37ABE00\r\n"
842 "FROM: \"Sender\"<sip:sender@company.com>;tag=2420628112;epid=54392f1bbf01\r\n"
843 "TO: \"recipient\"<sip:recipient@company.com>;tag=7aee15546a;epid=3102EB8BD1\r\n"
845 "CALL-ID: 41CEg82ECa0AC8i3DD7mE673t9CF4b19DAxF780x\r\n"
846 "RECORD-ROUTE: <sip:LOC-COMPANYT-OCSR2P01.COMPANY.COM:5061;transport=tls;ms-fe=LOC-COMPANYT-FE03.COMPANY.COM;opaque=state:F:T:Eu:Ci.R37abe00;lr;ms-route-sig=gdOGgL7NiL3hv_oBc0NdrJOxZk_r-8naq-k_DtpgAA>\r\n"
847 "CONTACT: <sip:recipient@company.com;opaque=user:epid:-gLwenLTVVqy-Ak8TJn1ZAAA;gruu>;text;audio;video\r\n"
848 "CONTENT-LENGTH: 0\r\n"
849 "SUPPORTED: gruu-10\r\n"
851 "P-ASSERTED-IDENTITY: \"recipient\"<SIP:recipient@company.com>\r\n"
852 "SERVER: RTCC/3.5.0.0 MCXService/3.5.0.0 communicator.NOKIAS60R2.JVP.EN_US/1.0.6875.0\r\n"
855 response_sig
= "<NTLM><1B6D47A1><11><SIP Communications Service><LOC-COMPANYT-FE03.COMPANY.COM><41CEg82ECa0AC8i3DD7mE673t9CF4b19DAxF780x><1><INVITE><sip:sender@company.com><2420628112><sip:recipient@company.com><7aee15546a><SIP:recipient@company.com><><><180>";
857 msg
= sipmsg_parse_msg(response_symbian
);
859 sipmsg_breakdown_parse(&msgbd
, "SIP Communications Service", "LOC-COMPANYT-FE03.COMPANY.COM");
860 msg_str
= sipmsg_breakdown_get_string(4, &msgbd
);
862 assert_equal (response_sig
, (guchar
*)msg_str
, strlen(response_sig
), FALSE
);
864 sipmsg_breakdown_free(&msgbd
);
867 ////// UUID tests ///////
868 /* begin tests from MS-SIPRE */
870 const char *testEpid
= "01010101";
871 const char *expectedUUID
= "4b1682a8-f968-5701-83fc-7c6741dc6697";
872 gchar
*calcUUID
= generateUUIDfromEPID(testEpid
);
874 printf("\n\nTesting MS-SIPRE UUID derivation\n");
876 assert_equal(expectedUUID
, (guchar
*) calcUUID
, strlen(expectedUUID
), FALSE
);
880 /* end tests from MS-SIPRE */
882 printf ("\nFinished With Tests; %d successs %d failures\n", successes
, failures
);
884 sip_sec_destroy__ntlm();
886 return(failures
== 0);