aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrian Sipos <brian.sipos@gmail.com>2021-05-10 23:50:41 -0400
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-09-29 08:51:13 +0000
commitabd0f1183f4dcc8d2fe6b3fb6750328fc3f6036c (patch)
tree56f52b25d9002149663a30312c7a74f0a1ab0c54 /test
parent4010502a8251ac21e829ecab8ccc1ae2a2b96219 (diff)
COSE dissector from dtn-wireshark project
Diffstat (limited to 'test')
-rw-r--r--test/captures/cose_encrypt0_tagged.cbordiag12
-rw-r--r--test/captures/cose_encrypt0_tagged.pcapbin0 -> 255 bytes
-rw-r--r--test/captures/cose_encrypt_tagged.cbordiag24
-rw-r--r--test/captures/cose_encrypt_tagged.pcapbin0 -> 294 bytes
-rw-r--r--test/captures/cose_keyset.cbordiag19
-rw-r--r--test/captures/cose_keyset.pcapbin0 -> 439 bytes
-rw-r--r--test/captures/cose_mac0_tagged.cbordiag10
-rw-r--r--test/captures/cose_mac0_tagged.pcapbin0 -> 240 bytes
-rw-r--r--test/captures/cose_mac_tagged.cbordiag40
-rw-r--r--test/captures/cose_mac_tagged.pcapbin0 -> 513 bytes
-rw-r--r--test/captures/cose_sign1_tagged.cbordiag14
-rw-r--r--test/captures/cose_sign1_tagged.pcapbin0 -> 301 bytes
-rw-r--r--test/captures/cose_sign_tagged.cbordiag39
-rw-r--r--test/captures/cose_sign_tagged.pcapbin0 -> 503 bytes
-rw-r--r--test/suite_dissection.py57
-rw-r--r--test/suite_unittests.py4
16 files changed, 219 insertions, 0 deletions
diff --git a/test/captures/cose_encrypt0_tagged.cbordiag b/test/captures/cose_encrypt0_tagged.cbordiag
new file mode 100644
index 0000000000..36b9d62e53
--- /dev/null
+++ b/test/captures/cose_encrypt0_tagged.cbordiag
@@ -0,0 +1,12 @@
+16(
+ [
+ / protected h'a1010a' / << {
+ / alg / 1:10 / AES-CCM-16-64-128 /
+ } >> ,
+ / unprotected / {
+ / iv / 5:h'89f52f65a1c580933b5261a78c'
+ },
+ / ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce
+460ffb569'
+ ]
+)
diff --git a/test/captures/cose_encrypt0_tagged.pcap b/test/captures/cose_encrypt0_tagged.pcap
new file mode 100644
index 0000000000..51d1cbf634
--- /dev/null
+++ b/test/captures/cose_encrypt0_tagged.pcap
Binary files differ
diff --git a/test/captures/cose_encrypt_tagged.cbordiag b/test/captures/cose_encrypt_tagged.cbordiag
new file mode 100644
index 0000000000..30767f9d8c
--- /dev/null
+++ b/test/captures/cose_encrypt_tagged.cbordiag
@@ -0,0 +1,24 @@
+96(
+ [
+ / protected h'a1010a' / << {
+ / alg / 1:10 / AES-CCM-16-64-128 /
+ } >>,
+ / unprotected / {
+ / iv / 5:h'89f52f65a1c580933b5261a76c'
+ },
+ / ciphertext / h'753548a19b1307084ca7b2056924ed95f2e3b17006dfe93
+1b687b847',
+ / recipients / [
+ [
+ / protected h'a10129' / << {
+ / alg / 1:-10
+ } >>,
+ / unprotected / {
+ / salt / -20:'aabbccddeeffgghh',
+ / kid / 4:'our-secret'
+ },
+ / ciphertext / h''
+ ]
+ ]
+ ]
+)
diff --git a/test/captures/cose_encrypt_tagged.pcap b/test/captures/cose_encrypt_tagged.pcap
new file mode 100644
index 0000000000..71f5ad8cef
--- /dev/null
+++ b/test/captures/cose_encrypt_tagged.pcap
Binary files differ
diff --git a/test/captures/cose_keyset.cbordiag b/test/captures/cose_keyset.cbordiag
new file mode 100644
index 0000000000..11b1df360e
--- /dev/null
+++ b/test/captures/cose_keyset.cbordiag
@@ -0,0 +1,19 @@
+[
+ {
+ 1:2,
+ 2:'meriadoc.brandybuck@buckland.example',
+ -1:1,
+ -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0
+8551d',
+ -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008
+4d19c',
+ -4:h'aff907c99f9ad3aae6c4cdf21122bce2bd68b5283e6907154ad911840fa
+208cf'
+ },
+ {
+ 1:4,
+ 2:'018c0ae5-4d9b-471b-bfd6-eef314bc7037',
+ -1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4
+27188'
+ }
+]
diff --git a/test/captures/cose_keyset.pcap b/test/captures/cose_keyset.pcap
new file mode 100644
index 0000000000..5b98d31a5a
--- /dev/null
+++ b/test/captures/cose_keyset.pcap
Binary files differ
diff --git a/test/captures/cose_mac0_tagged.cbordiag b/test/captures/cose_mac0_tagged.cbordiag
new file mode 100644
index 0000000000..ead2910d82
--- /dev/null
+++ b/test/captures/cose_mac0_tagged.cbordiag
@@ -0,0 +1,10 @@
+17(
+ [
+ / protected h'a1010f' / << {
+ / alg / 1:15 / AES-CBC-MAC-256//64 /
+ } >> ,
+ / unprotected / {},
+ / payload / 'This is the content.',
+ / tag / h'726043745027214f'
+ ]
+)
diff --git a/test/captures/cose_mac0_tagged.pcap b/test/captures/cose_mac0_tagged.pcap
new file mode 100644
index 0000000000..0454b19cf4
--- /dev/null
+++ b/test/captures/cose_mac0_tagged.pcap
Binary files differ
diff --git a/test/captures/cose_mac_tagged.cbordiag b/test/captures/cose_mac_tagged.cbordiag
new file mode 100644
index 0000000000..91d9b89bbb
--- /dev/null
+++ b/test/captures/cose_mac_tagged.cbordiag
@@ -0,0 +1,40 @@
+97(
+ [
+ / protected h'a10105' / << {
+ / alg / 1:5 / HMAC 256//256 /
+ } >> ,
+ / unprotected / {},
+ / payload / 'This is the content.',
+ / tag / h'bf48235e809b5c42e995f2b7d5fa13620e7ed834e337f6aa43df16
+1e49e9323e',
+ / recipients / [
+ [
+ / protected h'a101381c' / << {
+ / alg / 1:-29 / ECHD-ES+A128KW /
+ } >> ,
+ / unprotected / {
+ / ephemeral / -1:{
+ / kty / 1:2,
+ / crv / -1:3,
+ / x / -2:h'0043b12669acac3fd27898ffba0bcd2e6c366d53bc4db
+71f909a759304acfb5e18cdc7ba0b13ff8c7636271a6924b1ac63c02688075b55ef2
+d613574e7dc242f79c3',
+ / y / -3:true
+ },
+ / kid / 4:'bilbo.baggins@hobbiton.example'
+ },
+ / ciphertext / h'339bc4f79984cdc6b3e6ce5f315a4c7d2b0ac466fce
+a69e8c07dfbca5bb1f661bc5f8e0df9e3eff5'
+ ],
+ [
+ / protected / h'',
+ / unprotected / {
+ / alg / 1:-5 / A256KW /,
+ / kid / 4:'018c0ae5-4d9b-471b-bfd6-eef314bc7037'
+ },
+ / ciphertext / h'0b2c7cfce04e98276342d6476a7723c090dfdd15f9a
+518e7736549e998370695e6d6a83b4ae507bb'
+ ]
+ ]
+ ]
+)
diff --git a/test/captures/cose_mac_tagged.pcap b/test/captures/cose_mac_tagged.pcap
new file mode 100644
index 0000000000..3c685b29e7
--- /dev/null
+++ b/test/captures/cose_mac_tagged.pcap
Binary files differ
diff --git a/test/captures/cose_sign1_tagged.cbordiag b/test/captures/cose_sign1_tagged.cbordiag
new file mode 100644
index 0000000000..64063320cd
--- /dev/null
+++ b/test/captures/cose_sign1_tagged.cbordiag
@@ -0,0 +1,14 @@
+18(
+ [
+ / protected h'a10126' / << {
+ / alg / 1:-7 / ECDSA 256 /
+ } >>,
+ / unprotected / {
+ / kid / 4:'11'
+ },
+ / payload / 'This is the content.',
+ / signature / h'8eb33e4ca31d1c465ab05aac34cc6b23d58fef5c083106c4
+d25a91aef0b0117e2af9a291aa32e14ab834dc56ed2a223444547e01f11d3b0916e5
+a4c345cacb36'
+ ]
+)
diff --git a/test/captures/cose_sign1_tagged.pcap b/test/captures/cose_sign1_tagged.pcap
new file mode 100644
index 0000000000..f3c844012d
--- /dev/null
+++ b/test/captures/cose_sign1_tagged.pcap
Binary files differ
diff --git a/test/captures/cose_sign_tagged.cbordiag b/test/captures/cose_sign_tagged.cbordiag
new file mode 100644
index 0000000000..92003a4c7e
--- /dev/null
+++ b/test/captures/cose_sign_tagged.cbordiag
@@ -0,0 +1,39 @@
+98(
+ [
+ / protected h'a2687265736572766564f40281687265736572766564' /
+ << {
+ "reserved":false,
+ / crit / 2:[
+ "reserved"
+ ]
+ } >>,
+ / unprotected / {},
+ / payload / 'This is the content.',
+ / signatures / [
+ [
+ / protected h'a10126' / << {
+ / alg / 1:-7 / ECDSA 256 /
+ } >>,
+ / unprotected / {
+ / kid / 4:'11'
+ },
+ / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb
+5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b
+98f53afd2fa0f30a'
+ ],
+ [
+ / protected h'a1013823' / << {
+ / alg / 1:-36 / ECDSA 521 /
+ } >> ,
+ / unprotected / {
+ / kid / 4:'bilbo.baggins@hobbiton.example'
+ },
+ / signature / h'00a2d28a7c2bdb1587877420f65adf7d0b9a06635dd1
+de64bb62974c863f0b160dd2163734034e6ac003b01e8705524c5c4ca479a952f024
+7ee8cb0b4fb7397ba08d009e0c8bf482270cc5771aa143966e5a469a09f613488030
+c5b07ec6d722e3835adb5b2d8c44e95ffb13877dd2582866883535de3bb03d01753f
+83ab87bb4f7a0297'
+ ]
+ ]
+ ]
+)
diff --git a/test/captures/cose_sign_tagged.pcap b/test/captures/cose_sign_tagged.pcap
new file mode 100644
index 0000000000..428acb9a2b
--- /dev/null
+++ b/test/captures/cose_sign_tagged.pcap
Binary files differ
diff --git a/test/suite_dissection.py b/test/suite_dissection.py
index ba02c68be9..686a23bf59 100644
--- a/test/suite_dissection.py
+++ b/test/suite_dissection.py
@@ -16,6 +16,63 @@ import sys
@fixtures.mark_usefixtures('test_env')
@fixtures.uses_fixtures
+class case_dissect_cose(subprocesstest.SubprocessTestCase):
+ '''
+ These test captures were generated from the COSE example files with command:
+ for FN in test/captures/cose*.cbordiag; do python3 tools/generate_cbor_pcap.py --content-type 'application/cose' --infile $FN --outfile ${FN%.cbordiag}.pcap; done
+ '''
+ def test_cose_sign_tagged(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_sign_tagged.pcap'),
+ '-Tfields', '-ecose.msg.signature',
+ ))
+ self.assertTrue(self.grepOutput('e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b98f53afd2fa0f30a'))
+
+ def test_cose_sign1_tagged(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_sign1_tagged.pcap'),
+ '-Tfields', '-ecose.msg.signature',
+ ))
+ self.assertTrue(self.grepOutput('8eb33e4ca31d1c465ab05aac34cc6b23d58fef5c083106c4d25a91aef0b0117e2af9a291aa32e14ab834dc56ed2a223444547e01f11d3b0916e5a4c345cacb36'))
+
+ def test_cose_encrypt_tagged(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_encrypt_tagged.pcap'),
+ '-Tfields', '-ecose.kid',
+ ))
+ self.assertTrue(self.grepOutput('6f75722d736563726574'))
+
+ def test_cose_encrypt0_tagged(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_encrypt0_tagged.pcap'),
+ '-Tfields', '-ecose.iv',
+ ))
+ self.assertTrue(self.grepOutput('89f52f65a1c580933b5261a78c'))
+
+ def test_cose_mac_tagged(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_mac_tagged.pcap'),
+ '-Tfields', '-ecose.kid',
+ ))
+ self.assertTrue(self.grepOutput('30313863306165352d346439622d343731622d626664362d656566333134626337303337'))
+
+ def test_cose_mac0_tagged(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_mac0_tagged.pcap'),
+ '-Tfields', '-ecose.msg.mac_tag',
+ ))
+ self.assertTrue(self.grepOutput('726043745027214f'))
+
+ def test_cose_keyset(self, cmd_tshark, features, dirs, capture_file):
+ self.assertRun((cmd_tshark,
+ '-r', capture_file('cose_keyset.pcap'),
+ '-Tfields', '-ecose.key.k',
+ ))
+ self.assertTrue(self.grepOutput('849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c427188'))
+
+
+@fixtures.mark_usefixtures('test_env')
+@fixtures.uses_fixtures
class case_dissect_grpc(subprocesstest.SubprocessTestCase):
def test_grpc_with_json(self, cmd_tshark, features, dirs, capture_file):
'''gRPC with JSON payload'''
diff --git a/test/suite_unittests.py b/test/suite_unittests.py
index ccffbd3806..ce42697921 100644
--- a/test/suite_unittests.py
+++ b/test/suite_unittests.py
@@ -41,6 +41,10 @@ class case_unittests(subprocesstest.SubprocessTestCase):
'--verbose'
), env=base_env)
+ def test_unit_wscbor_test(self, program, base_env):
+ '''wscbor_test'''
+ self.assertRun(program('wscbor_test'), env=base_env)
+
def test_unit_wsutil(self, program, base_env):
'''wsutil unit tests'''
self.assertRun((program('test_wsutil'),