Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Some test data that can be used when parsing stun messages (WebRTC/ICE/STUN)
Below is a dump of a STUN message that can be used to validate your
STUN message integrity check. The password that is used to encrypt
the Message-Integrity is: "Q9wQj99nsQzldVI5ZuGXbEWRK5RhRXdC" (without quotes)
/* Raw STUN message as received from Chrome */
-----------
00 01 00 58
21 12 A4 42
48 75 38 77
4E 4F 49 53
62 54 65 4A
00 06 00 1B
35 50 4E 32
71 6D 57 71
42 6C 3A 34
68 52 42 6D
66 4B 48 75
58 6A 4F 67
6B 56 4A 00
80 2A 00 08
D2 DB 70 25
70 6B CD 98
00 25 00 00
00 24 00 04
6E 7F 1E FF
00 08 00 14
5A CA 22 D7
F4 39 FA DE
AF D3 9B D6
EC 00 D4 96
E2 17 09 32
80 28 00 04
78 5D 2E EB
-----------
In C/C++ notation:
-------------------
const unsigned char respv4[] = "\x00\x01\x00\x58\x21\x12\xa4\x42\x48\x75\x38\x77\x4e\x4f\x49\x53\x62\x54\x65\x4a\x00\x06\x00\x1b\x35\x50\x4e\x32\x71\x6d\x57\x71\x42\x6c\x3a\x34\x68\x52\x42\x6d\x66\x4b\x48\x75\x58\x6a\x4f\x67\x6b\x56\x4a\x00\x80\x2a\x00\x08\xd2\xdb\x70\x25\x70\x6b\xcd\x98\x00\x25\x00\x00\x00\x24\x00\x04\x6e\x7f\x1e\xff\x00\x08\x00\x14\x5a\xca\x22\xd7\xf4\x39\xfa\xde\xaf\xd3\x9b\xd6\xec\x00\xd4\x96\xe2\x17\x09\x32\x80\x28\x00\x04\x78\x5d\x2e\xeb";
My parser produces the following output:
-----------------------------------------
Msg: STUN_BINDING_REQUEST, Type: STUN_ATTR_USERNAME, Length: 27, bytes left: 84, current index: 24
Msg: STUN_BINDING_REQUEST, Type: STUN_ATTR_ICE_CONTROLLING, Length: 8, bytes left: 52, current index: 56
Msg: STUN_BINDING_REQUEST, Type: STUN_ATTR_USE_CANDIDATE, Length: 0, bytes left: 40, current index: 68
Msg: STUN_BINDING_REQUEST, Type: STUN_ATTR_PRIORITY, Length: 4, bytes left: 36, current index: 72
Msg: STUN_BINDING_REQUEST, Type: STUN_ATTR_MESSAGE_INTEGRITY, Length: 20, bytes left: 28, current index: 80
-----------------------------------------
Received integrity: 5A CA 22 D7 F4 39 FA DE AF D3 9B D6 EC 00 D4 96 E2 17 09 32
The HMAC-SHA1 is computed over (note that we changes the Message-Length in the Stun header):
---------------------------------------------------------------------------------------------
00 01 00 50
21 12 A4 42
48 75 38 77
4E 4F 49 53
62 54 65 4A
00 06 00 1B
35 50 4E 32
71 6D 57 71
42 6C 3A 34
68 52 42 6D
66 4B 48 75
58 6A 4F 67
6B 56 4A 00
80 2A 00 08
D2 DB 70 25
70 6B CD 98
00 25 00 00
00 24 00 04
6E 7F 1E FF
References:
-----------
https://gist.github.com/roxlu/6ae94d42591e2ae563d9#file-test_stun_message_integrity-cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.