csweng
Newbie
Offline
Posts: 4
|
 |
« Reply #5 on: December 01, 2009, 08:26:09 am » |
|
Dear kakaroto, I have read RFC3489 . I know message integrity is using HMAC-SHA1 method , it must have a key to generate the message integrity. I follow RFC3489 and use libnic/stun/tests/test-parser to testing . I can not get correct message integrity. Could you help me check the generate key and encrypt data method are right ? my step show below INVITE sip:64.4.16.25 .. m=audio 30242 RTP/AVP 114 111 112 115 116 4 8 0 97 13 118 101
a=candidate:6hEO5ZzDdHgZaDRo98cdo7s8M8yhSvGkcXUrIXiciqA 1 kD+dyAmcRaCPPy3BrdnPYQ UDP 0.830 192.168.126.1 9510 a=candidate:6hEO5ZzDdHgZaDRo98cdo7s8M8yhSvGkcXUrIXiciqA 2 kD+dyAmcRaCPPy3BrdnPYQ UDP 0.830 192.168.126.1 15904 .
I use INVITE packet base64_decode(kD+dyAmcRaCPPy3BrdnPYQ) as encrypt Key (is right ?) or I must use md5(username:realm:passwd) as encrypt key, but I can not find get realm packet in msn packet log.
username = base64_decode(6hEO5ZzDdHgZaDRo98cdo7s8M8yhSvGkcXUrIXiciqA) + 0x3a, 0x31, 0x3a + ramdom(32 bytes) (as local candidate) + 0x3a,0x31, 0x00, 0x00, 0x00
messenge-integrity = HMAC-SHA1(encrypt-data,key);
encrypt_data ={ 0x00, 0x01, 0x00, 0x64, 0x5a, 0xdd, 0x83, 0x79, //id 0x63, 0x66, 0x11, 0x2f, 0xc6, 0xa9, 0xef, 0xa1, 0x2b, 0x09, 0xa7, 0x5b, 0x00, 0x06, 0x00, 0x48, // username 0xea, 0x11, 0x0e, 0xe5, 0x9c, 0xc3, 0x74, 0x78, 0x19, 0x68, 0x34, 0x68, 0xf7, 0xc7, 0x1d, 0xa3, 0xbb, 0x3c, 0x33, 0xcc, 0xa1, 0x4a, 0xf1, 0xa4, 0x71, 0x75, 0x2b, 0x21, 0x78, 0x9c, 0x8a, 0xa0, 0x3a, 0x31, 0x3a, 0xfa, 0x1c, 0xc7, 0xbe, 0x96, 0x38, 0xfe, 0xf1, 0x54, 0xbe, 0xc0, 0x8f, 0x67, 0x3c, 0x9e, 0xa1, 0x28, 0x50, 0xcf, 0x24, 0x5b, 0xb1, 0xef, 0x96, 0xd7, 0x6a, 0xd8, 0x8b, 0x67, 0xe7, 0xa1, 0x16, 0x3a, 0x31, 0x00, 0x00, 0x00 }
messenge-integrity = { 0x54, 0x8e, 0x09, 0x64, 0x6f, 0x84, 0x9d, 0xbe, 0xe9, 0xe1, 0x7c, 0xe6, 0x2c, 0x6c, 0xbf, 0x80, 0xaa, 0xd3, 0x17, 0x20 }
// log packet stun binding request binding_request[] = { 0x00, 0x01, 0x00, 0x64, 0x5a, 0xdd, 0x83, 0x79, //id 0x63, 0x66, 0x11, 0x2f, 0xc6, 0xa9, 0xef, 0xa1, 0x2b, 0x09, 0xa7, 0x5b,
0x00, 0x06, 0x00, 0x48, // username 0xea, 0x11, 0x0e, 0xe5, 0x9c, 0xc3, 0x74, 0x78, 0x19, 0x68, 0x34, 0x68, 0xf7, 0xc7, 0x1d, 0xa3, 0xbb, 0x3c, 0x33, 0xcc, 0xa1, 0x4a, 0xf1, 0xa4, 0x71, 0x75, 0x2b, 0x21, 0x78, 0x9c, 0x8a, 0xa0, 0x3a, 0x31, 0x3a, 0xfa, 0x1c, 0xc7, 0xbe, 0x96, 0x38, 0xfe, 0xf1, 0x54, 0xbe, 0xc0, 0x8f, 0x67, 0x3c, 0x9e, 0xa1, 0x28, 0x50, 0xcf, 0x24, 0x5b, 0xb1, 0xef, 0x96, 0xd7, 0x6a, 0xd8, 0x8b, 0x67, 0xe7, 0xa1, 0x16, 0x3a, 0x31, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x14, // message integrity 0x54, 0x8e, 0x09, 0x64, 0x6f, 0x84, 0x9d, 0xbe, 0xe9, 0xe1, 0x7c, 0xe6, 0x2c, 0x6c, 0xbf, 0x80, 0xaa, 0xd3, 0x17, 0x20} ;
Best Regard,
|