cddl 0.8.9 → 0.12.14

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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cddl +51 -15
  3. data/cddl.gemspec +10 -7
  4. data/data/cddl.abnf +30 -13
  5. data/lib/cbor-pp-play.rb +1 -0
  6. data/lib/cddl.rb +719 -71
  7. data/test/test-cddl.rb +53 -2
  8. data/test-data/7807.cddl +14 -0
  9. data/test-data/abignum.cddl +1 -0
  10. data/test-data/abnf1.cddl +3 -0
  11. data/test-data/abnf2.cddl +37 -0
  12. data/test-data/abnf3.cddl +32 -0
  13. data/test-data/b64c-sloppy.cddl +1 -0
  14. data/test-data/b64c.cddl +1 -0
  15. data/test-data/b64u-strict.cddl +12 -0
  16. data/test-data/b64u.cddl +1 -0
  17. data/test-data/base32.cddl +1 -0
  18. data/test-data/base32hex.cddl +1 -0
  19. data/test-data/bat.cddl +16 -0
  20. data/test-data/cat-re.cddl +4 -0
  21. data/test-data/catb64.cddl +8 -0
  22. data/test-data/complex-occ.cddl +11 -0
  23. data/test-data/coral.cddl +10 -0
  24. data/test-data/coral1.cddl +5 -0
  25. data/test-data/coral2.cddl +7 -0
  26. data/test-data/coral3.cddl +7 -0
  27. data/test-data/decimal-warn.cddl +1 -0
  28. data/test-data/decimal.cddl +1 -0
  29. data/test-data/decimal2.cddl +1 -0
  30. data/test-data/det1.cddl +12 -0
  31. data/test-data/dotplus1.cddl +3 -0
  32. data/test-data/dotplus2.cddl +3 -0
  33. data/test-data/dotplus3.cddl +3 -0
  34. data/test-data/dotplus4.cddl +3 -0
  35. data/test-data/enum.cddl +14 -0
  36. data/test-data/enum1.cddl +12 -0
  37. data/test-data/feat1.cddl +4 -0
  38. data/test-data/feature-controller.cddl +6 -0
  39. data/test-data/feature-detail.cddl +5 -0
  40. data/test-data/hex.cddl +1 -0
  41. data/test-data/hexlc.cddl +1 -0
  42. data/test-data/hexuc.cddl +1 -0
  43. data/test-data/homenet-de.cddl +12 -0
  44. data/test-data/homenet-fe.cddl +12 -0
  45. data/test-data/jim-cut-2.cddl +11 -0
  46. data/test-data/jim-cut.cddl +12 -0
  47. data/test-data/join.cddl +1 -0
  48. data/test-data/joini.cddl +1 -0
  49. data/test-data/joinx.cddl +1 -0
  50. data/test-data/json.cddl +1 -0
  51. data/test-data/json1.cddl +15 -0
  52. data/test-data/json2.cddl +1 -0
  53. data/test-data/jwt.cddl +15 -0
  54. data/test-data/lint1.cddl +9 -0
  55. data/test-data/mdl-ble.cddl +9 -0
  56. data/test-data/mdl-deve.cddl +54 -0
  57. data/test-data/mdl-dp.cddl +11 -0
  58. data/test-data/mdl-mso.cddl +20 -0
  59. data/test-data/mdl-request.cddl +26 -0
  60. data/test-data/mdl-response.cddl +66 -0
  61. data/test-data/mdl.cddl +11 -0
  62. data/test-data/mon-val.cddl +1 -0
  63. data/test-data/multipart-ct.cddl +2 -0
  64. data/test-data/non-empty.cddl +5 -0
  65. data/test-data/oid.cddl +8 -0
  66. data/test-data/oidbat.cddl +8 -0
  67. data/test-data/plus.cddl +3 -0
  68. data/test-data/prim.cddl +7 -0
  69. data/test-data/printf.cddl +2 -0
  70. data/test-data/printf0.cddl +1 -0
  71. data/test-data/printf1.cddl +2 -0
  72. data/test-data/printf2.cddl +2 -0
  73. data/test-data/printf3.cddl +2 -0
  74. data/test-data/sasl.cddl +24 -0
  75. data/test-data/sequence.cddl +1 -0
  76. data/test-data/sipos.cddl +8 -0
  77. data/test-data/star-edited.cddl +98 -0
  78. data/test-data/star.cddl +95 -0
  79. data/test-data/test-gen.cddl +3 -0
  80. data/test-data/time.cddl +11 -0
  81. data/test-data/valemb.cddl +16 -0
  82. data/test-data/yangid.cddl +1 -0
  83. data/test-data/yaron1.cddl +95 -0
  84. metadata +142 -13
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]
@@ -224,7 +275,7 @@ b = (
224
275
  (x: int // y: int), z: int
225
276
  )
226
277
  HERE
227
- assert parser.validate_for_test({})
278
+ refute parser.validate_for_test({}, false)
228
279
  assert parser.validate_for_test({"x" => 2, "z" => 1})
229
280
  assert parser.validate_for_test({"y" => 1, "z" => 2})
230
281
  refute parser.validate_for_test({"z" => 1}, false)
@@ -242,7 +293,7 @@ b = ( z: int
242
293
  (x: int // y: int)
243
294
  )
244
295
  HERE
245
- assert parser.validate_for_test({})
296
+ refute parser.validate_for_test({}, false)
246
297
  assert parser.validate_for_test({"x" => 2, "z" => 1})
247
298
  assert parser.validate_for_test({"y" => 1, "z" => 2})
248
299
  refute parser.validate_for_test({"z" => 1}, false)
@@ -0,0 +1,14 @@
1
+ coap-problem-details = {
2
+ type => uint,
3
+ ? title => text,
4
+ ? response-code => bstr .size 1,
5
+ ? detail => text,
6
+ ? instance => uri,
7
+ * $$coap-problem-details-extension,
8
+ }
9
+
10
+ type = 0
11
+ title = 1
12
+ response-code = 2
13
+ detail = 3
14
+ instance = 4
@@ -0,0 +1 @@
1
+ abignum = unsigned
@@ -0,0 +1,3 @@
1
+ foo = text .abnf '4DIGIT
2
+ DIGIT = %x30-39 ; 0-9
3
+ '
@@ -0,0 +1,37 @@
1
+ start = [Tag0, Tag1004]
2
+
3
+ ; for draft-ietf-cbor-date-tag
4
+ Tag1004 = #6.1004(text .abnf full-date)
5
+ ; for RFC 7049
6
+ Tag0 = #6.0(text .abnf date-time)
7
+
8
+ full-date = "full-date" .cat rfc3339
9
+ date-time = "date-time" .cat rfc3339
10
+
11
+ ; Note the trick of idiomatically starting with a newline, separating
12
+ ; off the element in the .cat from the rule-list
13
+ rfc3339 = '
14
+ date-fullyear = 4DIGIT
15
+ date-month = 2DIGIT ; 01-12
16
+ date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
17
+ ; month/year
18
+ time-hour = 2DIGIT ; 00-23
19
+ time-minute = 2DIGIT ; 00-59
20
+ time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap sec
21
+ ; rules
22
+ time-secfrac = "." 1*DIGIT
23
+ time-numoffset = ("+" / "-") time-hour ":" time-minute
24
+ time-offset = "Z" / time-numoffset
25
+
26
+ partial-time = time-hour ":" time-minute ":" time-second
27
+ [time-secfrac]
28
+ full-date = date-fullyear "-" date-month "-" date-mday
29
+ full-time = partial-time time-offset
30
+
31
+ date-time = full-date "T" full-time
32
+ ' .cat rfc5234-core
33
+
34
+ rfc5234-core = '
35
+ DIGIT = %x30-39 ; 0-9
36
+ ; abbreviated here
37
+ '
@@ -0,0 +1,32 @@
1
+ start = [tt, tb, bt, bb]
2
+
3
+
4
+ tt = text .abnf '4DIGIT 1FOO
5
+ DIGIT = %x30-39 ; 0-9
6
+ FOO = %xc0-cf
7
+ '
8
+ tb = text .abnfb '4DIGIT 1FOO
9
+ DIGIT = %x30-39 ; 0-9
10
+ FOO = %xc0-cf
11
+ '
12
+ bt = bytes .abnf '4DIGIT 1FOO
13
+ DIGIT = %x30-39 ; 0-9
14
+ FOO = %xc0-cf
15
+ '
16
+ bb = bytes .abnfb '4DIGIT 1FOO
17
+ DIGIT = %x30-39 ; 0-9
18
+ FOO = %xc0-cf
19
+ '
20
+
21
+ ; ["7408\xC6", "7073\xC3", h'30383131CD', h'32363738CD']
22
+ ; ["5892\u00ca", "2145\u00c6", h'33333338C38B', h'31343033C388']
23
+
24
+
25
+ ; ** ENCOED UTF-8
26
+ ; ** ENCOED UTF-8
27
+ ; ** ENCOED UTF-8
28
+ ; ** ENCOED UTF-8
29
+ ; ["5845\u00c6", "9329\u00cb", h'38393538C389', h'33343230C386']
30
+
31
+
32
+ ; ["1066\u00cc", "9253\xC9", h'38333533C38A', h'32373337C4']
@@ -0,0 +1 @@
1
+ a = text .b64c-sloppy 'mnoabcdue=='
@@ -0,0 +1 @@
1
+ a = text .b64c 'mnoabcd'
@@ -0,0 +1,12 @@
1
+ a = text .b64u bytes
2
+
3
+ ;;gp 10
4
+
5
+ ;;vp "AAAA"
6
+ ;;vp "AAA-"
7
+ ;;vp "AAA_"
8
+ ; fail with 0.11.5:
9
+ ;;vp "AAA+"
10
+ ;;vp "AAA/"
11
+ ;;vp "AAA="
12
+ ;;vp "+kd8"
@@ -0,0 +1 @@
1
+ a = text .b64u 'mnoabcd'
@@ -0,0 +1 @@
1
+ a = text .b32 'mnoabcd'
@@ -0,0 +1 @@
1
+ a = text .h32 'mnoabcd'
@@ -0,0 +1,16 @@
1
+ start = [v1, v2, v3, v4]
2
+
3
+ v1 = "a" .bat "b"
4
+
5
+ v2 = "a" .bat " b"
6
+
7
+ v3 = "a" .bat '
8
+ oid = 1*arc
9
+ roid = *arc
10
+ arc = [nlsb] %x00-7f
11
+ nlsb = %x81-ff *%x80-ff
12
+ '
13
+
14
+ bbat<v1, v2> = ("" .bat v1) .bat v2
15
+
16
+ v4 = bbat<" a", " b">
@@ -0,0 +1,4 @@
1
+ foo = text .regexp myregexp
2
+ myregexp = "A" .cat "B"
3
+
4
+ ;;gp 10
@@ -0,0 +1,8 @@
1
+ a1 = '' .cat a2
2
+ a2 = text .b64u ain
3
+ ; a = "e30" .b64u ain
4
+ ain = '{}'
5
+
6
+ ;;gp 3
7
+ ;;vp 'e30'
8
+ ;;vp "e30"
@@ -0,0 +1,11 @@
1
+ foo = {
2
+ 2*4 any => any
3
+ }
4
+
5
+ ;;sed -n 's/^; //p' complex-occ.cddl | sh
6
+ ; echo '{}' | cddl complex-occ.cddl v -
7
+ ; echo '{"1": 2}' | cddl complex-occ.cddl v -
8
+ ; echo '{"1": 2, "2": 3}' | cddl complex-occ.cddl v -
9
+ ; echo '{"1": 2, "2": 3, "3": 4}' | cddl complex-occ.cddl v -
10
+ ; echo '{"1": 2, "2": 3, "3": 4, "4": 5}' | cddl complex-occ.cddl v -
11
+ ; echo '{"1": 2, "2": 3, "3": 4, "4": 5, "5": 6}' | cddl complex-occ.cddl v -
@@ -0,0 +1,10 @@
1
+ coral = [+ s-exp]
2
+ s-exp = ((text, value, ?coral) // directive)
3
+ value = ctext / cbytes / cint / cfloat / cboolean / cdatetime / null / {"_link": tstr} / {"_form": tstr}
4
+ ctext = text / {"_text": text}
5
+ cint = {"_int": int}
6
+ cfloat = float / {"_float": float}
7
+ cboolean = bool / {"_bool": bool}
8
+ cdatetime = {"_datetime": text}
9
+ cbytes = {"_bytes": text} ; base64url no padding
10
+ directive = (("_using", {* text => text}) // ("_base", text))
@@ -0,0 +1,5 @@
1
+ document = {*element}
2
+ element = (relation => value / [2*value])
3
+
4
+ relation = text
5
+ value = text
@@ -0,0 +1,7 @@
1
+ document = {*element}
2
+ element = (text => value / [2*value])
3
+ value = text / float / bool / tagged
4
+ tagged = {"_int":int,*element} / {"_float":float,*element} / {"_text":text,*element} / {"_bytes":bytes,*element} / {"_datetime":text,*element} / {"_bool":bool,*element} / {"_link":ciri,*element} / {"_form":ciri,*element}
5
+ ciri = text ; full IRI given
6
+ / [text] ; suffix for default prefix
7
+ / [text, text] ; prefix, suffix for that prefix
@@ -0,0 +1,7 @@
1
+ document = {? ("_using" => {* text => text}), *element}
2
+ element = (text => value / [2*value])
3
+ value = text / float / bool / tagged / {*element}
4
+ tagged = {"_int": int, *element} / {"_float": float, *element} / {"_text": text, *element} / {"_bytes": bytes, *element} / {"_datetime": text, *element} / {"_bool": bool, *element} / {"_link": ciri, *element} / {"_form": ciri, *element}
5
+ ciri = text ; full IRI given
6
+ / [text] ; suffix for default prefix
7
+ / [text, text] ; prefix, suffix for that prefix
@@ -0,0 +1 @@
1
+ s = [text .decimal 4711, text .base10 4712]
@@ -0,0 +1 @@
1
+ a = text .decimal uint
@@ -0,0 +1 @@
1
+ a = text .decimal 4711
@@ -0,0 +1,12 @@
1
+ bar = ["" .cat foo, "" .cat cbor-tags-oid]
2
+
3
+ foo = '' .det cbor-tags-oid
4
+
5
+ cbor-tags-oid = '
6
+ oid = 1*arc
7
+ roid = *arc
8
+ arc = [nlsb] %x00-7f
9
+ nlsb = %x81-ff *%x80-ff
10
+ ' .det ''
11
+
12
+ cbor-tags-oid-decrypted = cbor-tags-oid .det (([]) .det ([]))
@@ -0,0 +1,3 @@
1
+ a = b<13..15>
2
+ b<T> = #7.<32 .plus T>
3
+ ; cddl dotplus1.cddl gp 10
@@ -0,0 +1,3 @@
1
+ a = d<17..19>
2
+ d<T> = #7.<T .plus 32>
3
+ ; cddl dotplus.cddl gp 10
@@ -0,0 +1,3 @@
1
+ a = d<17..19>
2
+ d<T> = 32.5 .plus T
3
+ ; cddl dotplus4.cddl gp 10
@@ -0,0 +1,3 @@
1
+ a = d<17..19>
2
+ d<T> = T .plus 32.5
3
+ ; cddl dotplus4.cddl gp 10
@@ -0,0 +1,14 @@
1
+ terminal-color = &basecolors
2
+ basecolors = (
3
+ black: 0, red: 1, green: 2, yellow: 3,
4
+ blue: 4, magenta: 5, cyan: 6, white: 7,
5
+ reserved: (8..255) .feature "extension"
6
+ )
7
+ ; extended-color = &(
8
+ ; basecolors,
9
+ ; orange: 8, pink: 9, purple: 10, brown: 11,
10
+ ; )
11
+
12
+ ;;gp 10
13
+ ;;vp 42
14
+ ;;vp 433
@@ -0,0 +1,12 @@
1
+ terminal-color = $terminal-color / text .feature "extension"
2
+ $terminal-color /= &basecolors
3
+ basecolors = (
4
+ black: "black", red: "red", green: "green",
5
+ )
6
+
7
+ pastelcolors = ( pink: "pink", mauve: "mauve", peach: "peach", lavender: "lavender" )
8
+ $terminal-color /= &pastelcolors
9
+
10
+ ;;gp 10
11
+ ;;vp "florp"
12
+ ;;vp "lavender"
@@ -0,0 +1,4 @@
1
+ bla = {
2
+ a: int
3
+ ? ("b" .feature "foo") => float
4
+ }
@@ -0,0 +1,6 @@
1
+ a = b .feature 3
2
+ b = c .feature 3.3
3
+ c = d .feature (["drei", "ok"])
4
+ d = e .feature ([[], "ok"])
5
+ e = f .feature ([1, "ok"])
6
+ f = int .feature (1)
@@ -0,0 +1,5 @@
1
+ foo = {
2
+ kind: bar / baz .feature (["foo-extensions", "bazify"])
3
+ }
4
+ bar = int
5
+ baz = text ; complex stuff that doesn't all need to be in the detail
@@ -0,0 +1 @@
1
+ a = text .hex 'mnoabcd'
@@ -0,0 +1 @@
1
+ a = text .hexlc 'mnoabcd'
@@ -0,0 +1 @@
1
+ a = text .hexuc 'mnoabcd'
@@ -0,0 +1,12 @@
1
+ hna-configuration = {
2
+ "registred_domain" : tstr,
3
+ "dm" : tstr,
4
+ ? "dm_transport" : "53" // "DoT" // "DoH" // "DoQ"
5
+ ? "dm_port" : uint,
6
+ ? "dm_acl" : hna-acl // [ +hna-acl ]
7
+ ? "hna_auth_method": hna-auth-method
8
+ ? "hna_certificate": tstr
9
+ }
10
+
11
+ hna-acl = tstr
12
+ hna-auth-method /= "certificate"
@@ -0,0 +1,12 @@
1
+ hna-configuration = {
2
+ "registered_domain" : tstr,
3
+ "dm" : tstr,
4
+ ? "dm_transport" : "53" / "DoT" / "DoH" / "DoQ"
5
+ ? "dm_port" : uint,
6
+ ? "dm_acl" : hna-acl / [ +hna-acl ]
7
+ ? "hna_auth_method": hna-auth-method
8
+ ? "hna_certificate": tstr
9
+ }
10
+
11
+ hna-acl = tstr
12
+ hna-auth-method /= "certificate"
@@ -0,0 +1,11 @@
1
+
2
+ map-example = {
3
+ ? optional-key : int,
4
+ * map-example-extension,
5
+ * tstr => any
6
+ }
7
+
8
+ map-example-extension = ()
9
+
10
+ map-example-extension //= (another-optional-key : tstr,)
11
+ map-example-extension //= ("and a third" : bstr,)
@@ -0,0 +1,12 @@
1
+ map-example = {
2
+ ? "optional-key" : int,
3
+ map-example-extensions,
4
+ * tstr => any
5
+ }
6
+
7
+ map-example-extensions = ()
8
+
9
+ map-example-extensions //= (
10
+ "another-optional-key" : tstr,
11
+ "and a third": bstr
12
+ )
@@ -0,0 +1 @@
1
+ a = text .join (["a", "b", "c"])
@@ -0,0 +1 @@
1
+ a = text .join (["a", "b", 3])
@@ -0,0 +1 @@
1
+ a = text .join (["a", "b", text])
@@ -0,0 +1 @@
1
+ a = text .json ([4, uint .size 1, {"a": "b"}])
@@ -0,0 +1,15 @@
1
+ ; JWT-JWS = text .join ([
2
+ ; b64u<jwt-headers>, ".",
3
+ ; b64u<jwt-payload>, ".",
4
+ ; b64u<jwt-signature>])
5
+ ; ; a = jwt-headers
6
+ ; ; a = b64u<"abc"> ; fails
7
+ ; ; a = b64u<'abc'> ; succeeds
8
+ ; b64u<B> = text .b64u B
9
+ jwt-headers = '' .cat jwt-headers1
10
+ jwt-headers1 = text .json jwt-headermap
11
+ jwt-headermap = { * text => any } ; simplified
12
+ jwt-payload = bytes
13
+ jwt-signature = bytes
14
+
15
+ ;;gp 10
@@ -0,0 +1 @@
1
+ a = text .json ([4, uint .size 2, {"a": "b"}])
@@ -0,0 +1,15 @@
1
+ JWT-JWS = text .join ([
2
+ b64u<jwt-headers>, ".",
3
+ b64u<jwt-payload>, ".",
4
+ b64u<jwt-signature>])
5
+ ; a = jwt-headers
6
+ ; a = b64u<"abc"> ; fails
7
+ ; a = b64u<'abc'> ; succeeds
8
+ b64u<B> = text .b64u B
9
+ jwt-headers = '' .cat jwt-headers1
10
+ jwt-headers1 = text .json jwt-headermap
11
+ jwt-headermap = { * text => any } ; simplified
12
+ jwt-payload = bytes
13
+ jwt-signature = bytes
14
+
15
+ ;;gp 10
@@ -0,0 +1,9 @@
1
+ $instance-value-choice = (
2
+ comid.mac-addr => mac-addr-type //
3
+ comid.ip-addr => ip-addr-type //
4
+ comid.serial-number => serial-number-type //
5
+ comid.ueid => ueid //
6
+ comid.uuid => uuid
7
+ )
8
+
9
+ ; this populates a type socket with a group choice
@@ -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,11 @@
1
+ driving_privileges = [
2
+ * driving_privilege
3
+ ]
4
+ driving_privilege = {
5
+ vehicle_category_code: tstr
6
+ ?issue_date: #6.0(tstr)
7
+ ?expiry_date: #6.0(tstr)
8
+ ?code: tstr
9
+ ?sign: tstr
10
+ ?value: int
11
+ }
@@ -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"