-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdtls_record_test.py
33 lines (17 loc) · 1.74 KB
/
dtls_record_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import binascii
from webrtc.dtls.dtlstransport import RecordLayer
data = b"16feff0000000000000000008c010000800000000000000080fefd13b3ac327e56ae1c96882705b7e69b21cbc30df1695e244570eb7943635866b000000016c02bc02fcca9cca8c009c013c00ac014009c002f003501000040000a00080006001d0017001800170000000d00140012040308040401050308050501080606010201000e0009000600010008000700000b00020100ff01000100"
result = RecordLayer.unmarshal(binascii.unhexlify(data))
result = result.marshal()
print("result:", binascii.hexlify(result))
print("except:", data)
data = b"16fefd000000000000000501330b00012700020000000001270001240001213082011d3081c4a00302010202100f5e5ca649025cb72d7ce75b18d9189a300a06082a8648ce3d0403023011310f300d06035504031306576562525443301e170d3234313132303233313932305a170d3234313232303233313932305a3011310f300d060355040313065765625254433059301306072a8648ce3d020106082a8648ce3d03010703420004c8de55470f26e198d55b4200cbf2cab0e05ccfa4a806ae0c0443ea22181ae3c132b8ece8fc43aa3eae101041c97e21613823ff9cc52a550677f80fc3291707ba300a06082a8648ce3d04030203480030450221009c52066516a02a41256c4ed6feafa5071793c76a02e5b962b4e6319fd13087590220588060072fdca9b3324456d6e10da6f421379b874337899089ebcd27adc6808d"
result = RecordLayer.unmarshal(binascii.unhexlify(data))
result = result.marshal()
print("result:", binascii.hexlify(result))
print("except:", data)
data = b"16fefd0000000000000006007b0c00006f000300000000006f03001d208ecf787b40253be8dde8d8134934a179a00f0c8901d222beca49f60114b86e2e040300473045022100cdad20987821b79634be7a5819df18d7e67c04e8b498b2d14870265ea8bc48fe022073dcc221e4932157b1a50479a760381cddba0989c6940fb4ae5967e142f262b3"
result = RecordLayer.unmarshal(binascii.unhexlify(data))
result = result.marshal()
print("result:", binascii.hexlify(result))
print("except:", data)