cddl 0.8.6 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cddl.gemspec +2 -1
- data/data/cddl.abnf +2 -2
- data/lib/cddl.rb +43 -12
- data/test-data/7807.cddl +14 -0
- data/test-data/abignum.cddl +1 -0
- data/test-data/bpv7.cddl +136 -0
- data/test-data/bpv7a.cddl +181 -0
- data/test-data/bpv7b.cddl +167 -0
- data/test-data/coral.cddl +10 -0
- data/test-data/coral1.cddl +5 -0
- data/test-data/coral2.cddl +7 -0
- data/test-data/coral3.cddl +7 -0
- data/test-data/dotsize.cddl +7 -0
- data/test-data/feat1.cddl +4 -0
- data/test-data/foo.cddl +1 -0
- data/test-data/jim-cut-2.cddl +11 -0
- data/test-data/jim-cut.cddl +12 -0
- data/test-data/jsoniodef.cddl +719 -0
- data/test-data/mdl-ble.cddl +9 -0
- data/test-data/mdl-deve.cddl +54 -0
- data/test-data/mdl-dp.cddl +11 -0
- data/test-data/mdl-mso.cddl +20 -0
- data/test-data/mdl-request.cddl +26 -0
- data/test-data/mdl-response.cddl +66 -0
- data/test-data/mdl.cddl +11 -0
- data/test-data/mon-val.cddl +1 -0
- data/test-data/multipart-ct.cddl +2 -0
- data/test-data/named-group.cddl +7 -0
- data/test-data/test-gen.cddl +3 -0
- data/test/test-cddl.rb +51 -0
- metadata +32 -7
@@ -0,0 +1,9 @@
|
|
1
|
+
BLEIdentification = {
|
2
|
+
? 0 : bool,
|
3
|
+
? 1 : bool,
|
4
|
+
? 10 : bstr,
|
5
|
+
; Indicates support for Peripheral server mode
|
6
|
+
; Indicates support for Central client mode
|
7
|
+
; Optional UUID for peripheral server mode
|
8
|
+
? 11 : bstr ; Optional MAC address for peripheral server mode
|
9
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
deviceEngagement = [
|
2
|
+
uint,
|
3
|
+
security,
|
4
|
+
transferMethods,
|
5
|
+
options,
|
6
|
+
? proprietary
|
7
|
+
]
|
8
|
+
security = [
|
9
|
+
bstr,
|
10
|
+
uint, uint
|
11
|
+
]
|
12
|
+
transferMethods = [
|
13
|
+
* transferMethod
|
14
|
+
]
|
15
|
+
options = {
|
16
|
+
?"WebAPI" : WebAPI,
|
17
|
+
?"OIDC" : OIDC,
|
18
|
+
?"compact" : bool
|
19
|
+
}
|
20
|
+
proprietary = {
|
21
|
+
* tstr => any
|
22
|
+
}
|
23
|
+
transferMethod = [
|
24
|
+
uint,
|
25
|
+
uint, * any
|
26
|
+
]
|
27
|
+
OIDC = [
|
28
|
+
uint,
|
29
|
+
tstr,
|
30
|
+
tstr
|
31
|
+
]
|
32
|
+
WebAPI = [
|
33
|
+
uint,
|
34
|
+
tstr, tstr
|
35
|
+
]
|
36
|
+
; Version of device engagement structure, currently 1
|
37
|
+
; Security structure
|
38
|
+
; Transfer methods
|
39
|
+
; Optional elements
|
40
|
+
; Proprietary elements
|
41
|
+
; mDL public ephemeral key, mDL.EPub
|
42
|
+
; curve identifier, see Table 23
|
43
|
+
; cipher suite identifier, see Table 22
|
44
|
+
; details for transfer methods
|
45
|
+
; any number of elements
|
46
|
+
; type
|
47
|
+
; version
|
48
|
+
; specific option(s) to the type
|
49
|
+
; version
|
50
|
+
; url
|
51
|
+
; token
|
52
|
+
; version
|
53
|
+
; url
|
54
|
+
; token
|
@@ -0,0 +1,20 @@
|
|
1
|
+
MobileSecurityObject = {
|
2
|
+
"DigestAlgorithm" : tstr,
|
3
|
+
"ValueDigests" : ValueDigests,
|
4
|
+
"DeviceKey" : COSE_Key,
|
5
|
+
"DocType" : tstr
|
6
|
+
}
|
7
|
+
ValueDigests = {
|
8
|
+
"NameSpaces" : NameSpaces
|
9
|
+
}
|
10
|
+
NameSpaces = {
|
11
|
+
+ NameSpace => DigestIDs
|
12
|
+
}
|
13
|
+
DigestIDs = {
|
14
|
+
+ DigestID => Digest
|
15
|
+
}
|
16
|
+
NameSpace = tstr
|
17
|
+
DigestID = uint
|
18
|
+
Digest = bstr
|
19
|
+
|
20
|
+
COSE_Key = "COSE_Key"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Request = {
|
2
|
+
"Version" : tstr,
|
3
|
+
"DocRequests" : [+ DocRequest]
|
4
|
+
}
|
5
|
+
DocRequest = {
|
6
|
+
"ItemsRequest" : ItemsRequest,
|
7
|
+
? "ReaderAuth" : COSE_Sign1
|
8
|
+
}
|
9
|
+
ItemsRequest = {
|
10
|
+
? "DocType" : DocType,
|
11
|
+
"NameSpaces" : NameSpaces,
|
12
|
+
? "RequestInfo" : {* tstr => any}
|
13
|
+
}
|
14
|
+
NameSpaces = {
|
15
|
+
+ NameSpace => DataItemNames
|
16
|
+
}
|
17
|
+
DocType = tstr
|
18
|
+
NameSpace = tstr
|
19
|
+
DataItemNames = [ + tstr ]
|
20
|
+
; Additional info the reader wants to provide
|
21
|
+
; Requested data elements for each NameSpace
|
22
|
+
; See 7.3.2
|
23
|
+
; See 7.3.3
|
24
|
+
; See Table 2
|
25
|
+
|
26
|
+
COSE_Sign1 = "COSE_Sign1"
|
@@ -0,0 +1,66 @@
|
|
1
|
+
Response = {
|
2
|
+
"Version" : tstr,
|
3
|
+
? "Documents" : Documents,
|
4
|
+
? "Error" : int
|
5
|
+
}
|
6
|
+
Documents = {
|
7
|
+
+ DocType => ResponseData
|
8
|
+
}
|
9
|
+
; Version of the structure, currently 1.0
|
10
|
+
; Returned documents, may be absent if Error is present
|
11
|
+
; Error codes according to Table 8
|
12
|
+
ResponseData = {
|
13
|
+
"IssuerSigned" : IssuerSigned, ; Responded data elements signed by the issuer
|
14
|
+
"DeviceSigned" : DeviceSigned, ; Responded data elements signed by the mDL
|
15
|
+
"Errors" : Errors
|
16
|
+
}
|
17
|
+
IssuerSigned = {
|
18
|
+
"NameSpaces" : IssuerNameSpaces,
|
19
|
+
"IssuerAuth" : COSE_Sign1 ; The payload is the MobileSecurityObject, see 9.2.1.4
|
20
|
+
}
|
21
|
+
IssuerNameSpaces = {
|
22
|
+
+ NameSpace => [ + IssuerSignedItem ]
|
23
|
+
}
|
24
|
+
IssuerSignedItem = [
|
25
|
+
uint,
|
26
|
+
bstr,
|
27
|
+
tstr,
|
28
|
+
any
|
29
|
+
]
|
30
|
+
DeviceSigned = {
|
31
|
+
"NameSpaces" : DeviceNameSpaces, ; Currently only online token and URL are defined as DeviceSignedItems
|
32
|
+
"DeviceAuth" : DeviceAuth
|
33
|
+
}
|
34
|
+
DeviceNameSpaces = {
|
35
|
+
* NameSpace => DeviceSignedItems
|
36
|
+
}
|
37
|
+
DeviceSignedItems = {
|
38
|
+
+ DataItemName => DataItemValue
|
39
|
+
}
|
40
|
+
DeviceAuth = {
|
41
|
+
"Signature" : COSE_Sign1, //
|
42
|
+
; Use a nil value for the payload, the detached content is the DeviceAuthentication structure, see 9.2.2.4
|
43
|
+
"MAC" : COSE_Mac0
|
44
|
+
}
|
45
|
+
Errors = {
|
46
|
+
* NameSpace => [ + ErrorItem ]
|
47
|
+
}
|
48
|
+
ErrorItem = {
|
49
|
+
DataItemName => ErrorCode
|
50
|
+
}
|
51
|
+
DocType = tstr
|
52
|
+
NameSpace = tstr
|
53
|
+
DataItemName = tstr
|
54
|
+
DataItemValue = any
|
55
|
+
ErrorCode = int
|
56
|
+
; See table 9
|
57
|
+
; See 7.3.2
|
58
|
+
; See 7.3.3
|
59
|
+
; See Table 2
|
60
|
+
; See Table 2
|
61
|
+
; Error codes according to Table 9
|
62
|
+
; Structures used for DeviceAuth signature or MAC generation, see 9.2.2.4
|
63
|
+
; Structures used for MobileSecurityObject, see 9.2.1.4
|
64
|
+
|
65
|
+
COSE_Sign1 = "COSE_Sign1"
|
66
|
+
COSE_Mac0 = "COSE_Mac0"
|
data/test-data/mdl.cddl
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
decimal-monetary-value = text .regexp "-?[0-9]+(\\.[0-9]+)?"
|
data/test/test-cddl.rb
CHANGED
@@ -171,6 +171,57 @@ HERE
|
|
171
171
|
assert parser.validate_for_test(true)
|
172
172
|
end
|
173
173
|
|
174
|
+
def test_validate_bignum
|
175
|
+
parser = CDDL::Parser.new <<HERE
|
176
|
+
test = bigint
|
177
|
+
HERE
|
178
|
+
assert parser.validate_for_test(2**4711)
|
179
|
+
assert parser.validate_for_test(-2**815)
|
180
|
+
assert parser.validate_for_test(1)
|
181
|
+
assert parser.validate_for_test(0)
|
182
|
+
assert parser.validate_for_test(-11)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_aaaaaaaa_invalidate_bignum
|
186
|
+
parser = CDDL::Parser.new <<HERE
|
187
|
+
test = bignint
|
188
|
+
HERE
|
189
|
+
refute parser.validate_for_test(2**4711, false)
|
190
|
+
assert parser.validate_for_test(-2**815)
|
191
|
+
refute parser.validate_for_test(1, false)
|
192
|
+
refute parser.validate_for_test(0, false)
|
193
|
+
assert parser.validate_for_test(-11)
|
194
|
+
end
|
195
|
+
|
196
|
+
|
197
|
+
def test_aaaaaaaa_validate_bignum0b
|
198
|
+
parser = CDDL::Parser.new <<HERE
|
199
|
+
test = #6.2("")
|
200
|
+
HERE
|
201
|
+
refute parser.validate_for_test(1, false)
|
202
|
+
refute parser.validate_for_test(0, false)
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
def test_aaaaaaaa_validate_bignum0
|
207
|
+
parser = CDDL::Parser.new <<HERE
|
208
|
+
test = #6.2(h'')
|
209
|
+
HERE
|
210
|
+
assert parser.validate_for_test(0)
|
211
|
+
refute parser.validate_for_test(1, false)
|
212
|
+
end
|
213
|
+
|
214
|
+
|
215
|
+
def test_aaaaaaaa_validate_bignum1
|
216
|
+
parser = CDDL::Parser.new <<HERE
|
217
|
+
test = #6.2(h'01')
|
218
|
+
HERE
|
219
|
+
assert parser.validate_for_test(1)
|
220
|
+
refute parser.validate_for_test(0, false)
|
221
|
+
refute parser.validate_for_test(2, false)
|
222
|
+
end
|
223
|
+
|
224
|
+
|
174
225
|
def test_validate_a
|
175
226
|
parser = CDDL::Parser.new <<HERE
|
176
227
|
test = [* one: 1]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cbor-diag
|
@@ -97,16 +97,28 @@ files:
|
|
97
97
|
- test-data/7071-concise-cut.cddl
|
98
98
|
- test-data/7071-concise.cddl
|
99
99
|
- test-data/7071-verbose.cddl
|
100
|
+
- test-data/7807.cddl
|
100
101
|
- test-data/a.cddl
|
102
|
+
- test-data/abignum.cddl
|
101
103
|
- test-data/ambig.cddl
|
102
104
|
- test-data/b.cddl
|
103
105
|
- test-data/badaddr.cddl
|
104
106
|
- test-data/basic_syntax_example.cddl
|
107
|
+
- test-data/bpv7.cddl
|
108
|
+
- test-data/bpv7a.cddl
|
109
|
+
- test-data/bpv7b.cddl
|
105
110
|
- test-data/cdni-ct.cddl
|
111
|
+
- test-data/coral.cddl
|
112
|
+
- test-data/coral1.cddl
|
113
|
+
- test-data/coral2.cddl
|
114
|
+
- test-data/coral3.cddl
|
106
115
|
- test-data/cose.cddl
|
107
116
|
- test-data/dcaf.cddl
|
108
117
|
- test-data/dcaf1.cddl
|
118
|
+
- test-data/dotsize.cddl
|
109
119
|
- test-data/extractor-demo.cddl
|
120
|
+
- test-data/feat1.cddl
|
121
|
+
- test-data/foo.cddl
|
110
122
|
- test-data/grasp-01-extract.cddl
|
111
123
|
- test-data/grasp-01-test.cddl
|
112
124
|
- test-data/grasp-01.cddl
|
@@ -118,13 +130,27 @@ files:
|
|
118
130
|
- test-data/ifmap-metadata-2.2v9_fh-cabo.cddl
|
119
131
|
- test-data/ifmap2.cddl
|
120
132
|
- test-data/jcr-ex.cddl
|
133
|
+
- test-data/jim-cut-2.cddl
|
134
|
+
- test-data/jim-cut.cddl
|
135
|
+
- test-data/jsoniodef.cddl
|
121
136
|
- test-data/kevin5.cddl
|
122
137
|
- test-data/map-group.cddl
|
123
138
|
- test-data/mapkey.cddl
|
139
|
+
- test-data/mdl-ble.cddl
|
140
|
+
- test-data/mdl-deve.cddl
|
141
|
+
- test-data/mdl-dp.cddl
|
142
|
+
- test-data/mdl-mso.cddl
|
143
|
+
- test-data/mdl-request.cddl
|
144
|
+
- test-data/mdl-response.cddl
|
145
|
+
- test-data/mdl.cddl
|
124
146
|
- test-data/minimal.cddl
|
147
|
+
- test-data/mon-val.cddl
|
148
|
+
- test-data/multipart-ct.cddl
|
149
|
+
- test-data/named-group.cddl
|
125
150
|
- test-data/patch1.cddl
|
126
151
|
- test-data/reused_named_group.cddl
|
127
152
|
- test-data/structure.cddl
|
153
|
+
- test-data/test-gen.cddl
|
128
154
|
- test-data/toerless0.cddl
|
129
155
|
- test-data/toerless1.cddl
|
130
156
|
- test-data/two_anonymous_groups.cddl
|
@@ -138,7 +164,7 @@ homepage: http://github.com/cabo/cddl
|
|
138
164
|
licenses:
|
139
165
|
- MIT
|
140
166
|
metadata: {}
|
141
|
-
post_install_message:
|
167
|
+
post_install_message:
|
142
168
|
rdoc_options: []
|
143
169
|
require_paths:
|
144
170
|
- lib
|
@@ -153,9 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
179
|
- !ruby/object:Gem::Version
|
154
180
|
version: '0'
|
155
181
|
requirements: []
|
156
|
-
|
157
|
-
|
158
|
-
signing_key:
|
182
|
+
rubygems_version: 3.1.2
|
183
|
+
signing_key:
|
159
184
|
specification_version: 4
|
160
185
|
summary: CDDL generator and validator.
|
161
186
|
test_files: []
|