cddl 0.8.12 → 0.8.26
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/bin/cddl +34 -14
- data/cddl.gemspec +2 -1
- data/lib/cddl.rb +166 -24
- data/test-data/abnf1.cddl +3 -0
- data/test-data/abnf2.cddl +37 -0
- data/test-data/abnf3.cddl +32 -0
- data/test-data/bat.cddl +16 -0
- data/test-data/cat-re.cddl +2 -0
- data/test-data/complex-occ.cddl +11 -0
- data/test-data/det1.cddl +12 -0
- data/test-data/feature-controller.cddl +6 -0
- data/test-data/feature-detail.cddl +5 -0
- data/test-data/homenet-de.cddl +12 -0
- data/test-data/homenet-fe.cddl +12 -0
- data/test-data/lint1.cddl +9 -0
- data/test-data/non-empty.cddl +5 -0
- data/test-data/oid.cddl +8 -0
- data/test-data/oidbat.cddl +8 -0
- data/test-data/plus.cddl +3 -0
- data/test-data/sasl.cddl +24 -0
- data/test-data/sequence.cddl +1 -0
- data/test-data/sipos.cddl +8 -0
- data/test-data/star-edited.cddl +98 -0
- data/test-data/star.cddl +95 -0
- data/test-data/time.cddl +11 -0
- data/test-data/yangid.cddl +1 -0
- data/test-data/yaron1.cddl +95 -0
- metadata +41 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47f3304378cd8f42807f0b96551a9b8cd5c609741d9a1e508c7c68913bf591d0
|
|
4
|
+
data.tar.gz: 312535858550c20a3415238c8f26b5c96f2036707e305bd6665b12bb73e4addc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36ef0f6662d44814da072251405894b4b70ef20a6a493e8de7b597ece370e774cbf8fe8d2da35c2baa5f8b08adffc1a98dffaf1535907aca11a1a3936b11286a
|
|
7
|
+
data.tar.gz: a6a731d5d348156deb0b2e3415bf6c944198bcfc7ca33632ee7f4d40e07ce832bbcadcc1b4bab4d8f75653932b9f82cba2c4ccbef662af49c81554edb2e77480
|
data/bin/cddl
CHANGED
|
@@ -14,22 +14,24 @@ def usage
|
|
|
14
14
|
warn "Usage:"
|
|
15
15
|
warn "#$0 spec.cddl generate [n]"
|
|
16
16
|
warn "#$0 spec.cddl json-generate [n]"
|
|
17
|
-
warn "#$0 spec.cddl validate instance.cbor"
|
|
18
|
-
warn "#$0 spec.cddl validate instance.json"
|
|
17
|
+
warn "#$0 spec.cddl validate instance.cbor..."
|
|
18
|
+
warn "#$0 spec.cddl validate instance.json..."
|
|
19
19
|
exit EX_USAGE
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def read_arg(arg)
|
|
22
|
+
def read_arg(arg, remember_fn = true)
|
|
23
23
|
if arg == "-"
|
|
24
|
+
$fn = "(stdin)" if remember_fn
|
|
24
25
|
STDIN.read
|
|
25
26
|
else
|
|
26
27
|
usage unless arg
|
|
28
|
+
$fn = arg if remember_fn
|
|
27
29
|
File.read(arg, mode: "rb")
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def parser
|
|
32
|
-
@parser ||= CDDL::Parser.new(read_arg(ARGV[0]))
|
|
34
|
+
@parser ||= CDDL::Parser.new(read_arg(ARGV[0], false))
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def my_pp(v)
|
|
@@ -48,13 +50,19 @@ def my_diag(v)
|
|
|
48
50
|
end
|
|
49
51
|
end
|
|
50
52
|
|
|
53
|
+
retcode = 0
|
|
54
|
+
|
|
51
55
|
begin
|
|
52
56
|
case ARGV[1]
|
|
53
|
-
when /\A
|
|
57
|
+
when /\A..*p/
|
|
54
58
|
$annotate = true
|
|
55
59
|
require_relative '../lib/cbor-pp'
|
|
56
60
|
end
|
|
57
61
|
case ARGV[1]
|
|
62
|
+
when /\A..*s/
|
|
63
|
+
$sequence = true
|
|
64
|
+
end
|
|
65
|
+
case ARGV[1]
|
|
58
66
|
when /\Ar/ # secret
|
|
59
67
|
$advanced = true
|
|
60
68
|
my_pp parser.rules
|
|
@@ -81,15 +89,25 @@ begin
|
|
|
81
89
|
g = parser.generate
|
|
82
90
|
puts JSON.pretty_generate(g)
|
|
83
91
|
end
|
|
84
|
-
when /\Av
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
when /\Av(v)?/
|
|
93
|
+
verbose = $1
|
|
94
|
+
ARGV[2..-1].each do |fn|
|
|
95
|
+
instance = read_arg(fn)
|
|
96
|
+
instance = if $sequence
|
|
97
|
+
CBOR.decode("\x9f".b << instance.b << "\xff".b)
|
|
98
|
+
else
|
|
99
|
+
CBOR.decode(instance.b) rescue JSON.load(instance)
|
|
100
|
+
end
|
|
101
|
+
instance = instance.cbor_clone if $annotate && ENV["EXPERIMENTAL_ANNOTATE"]
|
|
102
|
+
warn "#{fn}:" if verbose
|
|
103
|
+
ann = parser.validate(instance)
|
|
104
|
+
# my_pp ann
|
|
105
|
+
instance.cbor_add_annotations_from(ann) rescue nil
|
|
106
|
+
my_diag(instance) if $annotate
|
|
107
|
+
unless ann
|
|
108
|
+
retcode = 1
|
|
109
|
+
end
|
|
110
|
+
end
|
|
93
111
|
else
|
|
94
112
|
usage
|
|
95
113
|
end
|
|
@@ -97,3 +115,5 @@ rescue CDDL::ParseError => e
|
|
|
97
115
|
warn e.message
|
|
98
116
|
exit EX_DATAERR
|
|
99
117
|
end
|
|
118
|
+
|
|
119
|
+
exit retcode
|
data/cddl.gemspec
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'cddl'
|
|
3
|
-
s.version = '0.8.
|
|
3
|
+
s.version = '0.8.26'
|
|
4
4
|
s.summary = "CDDL generator and validator."
|
|
5
5
|
s.description = %{A parser, generator, and validator for CDDL}
|
|
6
6
|
s.add_dependency('cbor-diag')
|
|
7
7
|
s.add_dependency('abnc')
|
|
8
8
|
s.add_dependency('json')
|
|
9
|
+
s.add_dependency('abnftt')
|
|
9
10
|
s.add_dependency('regexp-examples') # , '1.1.0')
|
|
10
11
|
s.add_dependency('colorize')
|
|
11
12
|
s.files = `git ls-files`.split("\n").grep(/^[a-z]/)
|
data/lib/cddl.rb
CHANGED
|
@@ -3,6 +3,7 @@ require 'pp'
|
|
|
3
3
|
require 'pathname'
|
|
4
4
|
require 'cbor-pure' unless defined?(CBOR::Tagged)
|
|
5
5
|
require 'regexp-examples'
|
|
6
|
+
require 'abnftt'
|
|
6
7
|
require 'colorize'
|
|
7
8
|
require 'base64'
|
|
8
9
|
|
|
@@ -55,6 +56,8 @@ module CDDL
|
|
|
55
56
|
@ast = @abnf.ast?
|
|
56
57
|
# our little argument stack for rule processing
|
|
57
58
|
@insides = []
|
|
59
|
+
# collect error information
|
|
60
|
+
@last_message = ""
|
|
58
61
|
end
|
|
59
62
|
|
|
60
63
|
def apr # for debugging
|
|
@@ -243,12 +246,28 @@ module CDDL
|
|
|
243
246
|
[rule[0], *rule[1]]
|
|
244
247
|
end
|
|
245
248
|
|
|
249
|
+
def remove_indentation(s)
|
|
250
|
+
l = s.lines
|
|
251
|
+
indent = l.grep(/\S/).map {|l| l[/^\s*/].size}.min
|
|
252
|
+
l.map {|l| l.sub(/^ {0,#{indent}}/, "")}.join
|
|
253
|
+
end
|
|
254
|
+
|
|
246
255
|
# Memoize a bit here
|
|
247
256
|
|
|
248
257
|
REGEXP_FOR_STRING = Hash.new {|h, k|
|
|
249
258
|
h[k] = Regexp.new("\\A#{k}\\z")
|
|
250
259
|
}
|
|
251
260
|
|
|
261
|
+
ABNF_PARSER_FOR_STRING = Hash.new {|h, k|
|
|
262
|
+
grammar = "cddl-t0p--1eve1-f0r--abnf = " << k # XXX
|
|
263
|
+
h[k] = ABNF.from_abnf(grammar)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
ABNF_ENCODING_FOR_CONOP = {
|
|
267
|
+
abnf: Encoding::UTF_8,
|
|
268
|
+
abnfb: Encoding::BINARY
|
|
269
|
+
}
|
|
270
|
+
|
|
252
271
|
def generate
|
|
253
272
|
@recursion = 0
|
|
254
273
|
generate1(rules)
|
|
@@ -393,7 +412,7 @@ module CDDL
|
|
|
393
412
|
when :anno
|
|
394
413
|
target = where[2]
|
|
395
414
|
control = where[3]
|
|
396
|
-
case where[1]
|
|
415
|
+
case conop = where[1]
|
|
397
416
|
when :size
|
|
398
417
|
should_be_int = generate1(control)
|
|
399
418
|
unless (Array === target && target[0] == :prim && [0, 2, 3].include?(target[1])) && Integer === should_be_int && should_be_int >= 0
|
|
@@ -441,6 +460,33 @@ module CDDL
|
|
|
441
460
|
generate1(target, inmap)
|
|
442
461
|
when :feature
|
|
443
462
|
generate1(target, inmap)
|
|
463
|
+
when :cat, :det
|
|
464
|
+
lhs = generate1(target, inmap)
|
|
465
|
+
rhs = generate1(control)
|
|
466
|
+
if conop == :det
|
|
467
|
+
lhs = remove_indentation(lhs)
|
|
468
|
+
rhs = remove_indentation(rhs)
|
|
469
|
+
end
|
|
470
|
+
begin
|
|
471
|
+
lhs + rhs
|
|
472
|
+
rescue Exception => e
|
|
473
|
+
fail "Can't #{lhs.inspect} .cat #{rhs.inspect}: #{e.message}"
|
|
474
|
+
end
|
|
475
|
+
when :plus
|
|
476
|
+
lhs = generate1(target, inmap)
|
|
477
|
+
rhs = generate1(control)
|
|
478
|
+
begin
|
|
479
|
+
case lhs
|
|
480
|
+
when Integer
|
|
481
|
+
lhs + Integer(rhs)
|
|
482
|
+
when Numeric
|
|
483
|
+
lhs + rhs
|
|
484
|
+
else
|
|
485
|
+
fail "#{lhs.inspect}: Not a number"
|
|
486
|
+
end
|
|
487
|
+
rescue Exception => e
|
|
488
|
+
fail "Can't #{lhs.inspect} .plus #{rhs.inspect}: #{e.message}"
|
|
489
|
+
end
|
|
444
490
|
when :eq
|
|
445
491
|
content = generate1(control)
|
|
446
492
|
if validate1(content, where)
|
|
@@ -454,7 +500,7 @@ module CDDL
|
|
|
454
500
|
content = Integer(content)
|
|
455
501
|
case target[1]
|
|
456
502
|
when 0
|
|
457
|
-
case
|
|
503
|
+
case conop
|
|
458
504
|
when :lt
|
|
459
505
|
rand(0...content)
|
|
460
506
|
when :le
|
|
@@ -481,12 +527,25 @@ module CDDL
|
|
|
481
527
|
fail "Don't know yet how to generate #{where}"
|
|
482
528
|
end
|
|
483
529
|
REGEXP_FOR_STRING[regexp].random_example(max_repeater_variance: 5)
|
|
530
|
+
when :abnf, :abnfb
|
|
531
|
+
grammar = generate1(control)
|
|
532
|
+
bytes = true if target == [:prim, 2]
|
|
533
|
+
bytes = false if target == [:prim, 3]
|
|
534
|
+
unless !bytes.nil? && String === grammar
|
|
535
|
+
fail "Don't know yet how to generate #{where}"
|
|
536
|
+
end
|
|
537
|
+
out = ABNF_PARSER_FOR_STRING[grammar].generate
|
|
538
|
+
if conop == :abnfb
|
|
539
|
+
out = out.codepoints.pack("C*")
|
|
540
|
+
end
|
|
541
|
+
enc = bytes ? Encoding::BINARY : Encoding::UTF_8
|
|
542
|
+
out.force_encoding(enc)
|
|
484
543
|
when :cbor, :cborseq
|
|
485
544
|
unless target == [:prim, 2]
|
|
486
545
|
fail "Don't know yet how to generate #{where}"
|
|
487
546
|
end
|
|
488
547
|
content = CBOR::encode(generate1(control))
|
|
489
|
-
if
|
|
548
|
+
if conop == :cborseq
|
|
490
549
|
# remove the first head
|
|
491
550
|
n = case content.getbyte(0) - (4 << 5)
|
|
492
551
|
when 0..23; 1
|
|
@@ -504,7 +563,7 @@ module CDDL
|
|
|
504
563
|
content = generate1(target)
|
|
505
564
|
if validate1(content, control)
|
|
506
565
|
return content
|
|
507
|
-
elsif
|
|
566
|
+
elsif conop == :within
|
|
508
567
|
warn "*** #{content.inspect} meets #{target.inspect} but not #{control.inspect}"
|
|
509
568
|
end
|
|
510
569
|
end
|
|
@@ -542,9 +601,38 @@ module CDDL
|
|
|
542
601
|
[true, t[1], vt]
|
|
543
602
|
elsif v = SIMPLE_VALUE[t]
|
|
544
603
|
v
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
604
|
+
elsif t[0] == :anno
|
|
605
|
+
_, conop, target, control = t
|
|
606
|
+
# warn ["EXV0", conop, target, control].inspect
|
|
607
|
+
if conop == :cat || conop == :plus || conop == :det
|
|
608
|
+
ok1, v1, vt1 = extract_value(target)
|
|
609
|
+
ok2, v2, vt2 = extract_value(control)
|
|
610
|
+
# warn ["EXV", ok1, v1, vt1, ok2, v2, vt2].inspect
|
|
611
|
+
if ok1 && ok2
|
|
612
|
+
if vt1 == Integer
|
|
613
|
+
[true, v1 + Integer(v2), Integer] if vt2 == Integer || vt2 == Float
|
|
614
|
+
elsif vt1 == Float
|
|
615
|
+
[true, v1 + v2, vt1] if vt2 == Integer || vt2 == Float
|
|
616
|
+
else
|
|
617
|
+
if conop == :det
|
|
618
|
+
v1 = remove_indentation(v1)
|
|
619
|
+
v2 = remove_indentation(v2)
|
|
620
|
+
end
|
|
621
|
+
[true, v1 + v2, vt1] if vt1 == vt2
|
|
622
|
+
end
|
|
623
|
+
end rescue nil
|
|
624
|
+
end
|
|
625
|
+
end || [false]
|
|
626
|
+
end
|
|
627
|
+
|
|
628
|
+
def extract_array(t)
|
|
629
|
+
return [false] unless t[0] == :array
|
|
630
|
+
[true, *t[1..-1].map { |el|
|
|
631
|
+
return [false] unless el[0..3] == [:member, 1, 1, nil]
|
|
632
|
+
ok, v, vt = extract_value(el[4])
|
|
633
|
+
return [false] unless ok
|
|
634
|
+
[v, vt]
|
|
635
|
+
}]
|
|
548
636
|
end
|
|
549
637
|
|
|
550
638
|
def validate_diag
|
|
@@ -558,7 +646,10 @@ module CDDL
|
|
|
558
646
|
if warn
|
|
559
647
|
if result
|
|
560
648
|
if $features != {}
|
|
561
|
-
|
|
649
|
+
ok = ENV["CDDL_FEATURE_OK"] and ok = ok.split(/,\s*/) or ok = []
|
|
650
|
+
# warn([:OK, ok, $features].inspect)
|
|
651
|
+
features = $features.reject {|k, v| ok.include? k.to_s }
|
|
652
|
+
warn "** Features potentially used (#$fn): #{features.map {|k, v| "#{k}: #{v.keys}"}.join(", ")}" if features != {}
|
|
562
653
|
end
|
|
563
654
|
else
|
|
564
655
|
warn "CDDL validation failure (#{result.inspect} for #{d.inspect}):"
|
|
@@ -571,7 +662,7 @@ module CDDL
|
|
|
571
662
|
|
|
572
663
|
def validate_result(check)
|
|
573
664
|
check || (
|
|
574
|
-
@last_message
|
|
665
|
+
@last_message << yield
|
|
575
666
|
false
|
|
576
667
|
)
|
|
577
668
|
end
|
|
@@ -604,7 +695,9 @@ module CDDL
|
|
|
604
695
|
ann.concat(ann2)
|
|
605
696
|
end
|
|
606
697
|
if occ < s
|
|
607
|
-
|
|
698
|
+
# warn "*** lme #{@last_message.encoding} #{@last_message}"
|
|
699
|
+
# warn "*** #{"\noccur #{occ} < #{s}, not reached at #{i} in array #{d} for #{where}".encoding}"
|
|
700
|
+
@last_message << "\noccur #{occ} < #{s}, not reached at #{i} in array #{d} for #{where}"
|
|
608
701
|
return [false, ann]
|
|
609
702
|
end
|
|
610
703
|
end
|
|
@@ -693,13 +786,17 @@ module CDDL
|
|
|
693
786
|
puts "COMPLEX: #{k.inspect} #{simple.inspect} #{simpleval.inspect}" if ENV["CDDL_TRACE"]
|
|
694
787
|
keys = d_check.keys
|
|
695
788
|
ta, keys = keys.partition{ |key| validate1(key, k)}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
789
|
+
count = 0
|
|
790
|
+
catch :enough do
|
|
791
|
+
ta.all? { |val|
|
|
792
|
+
if (ann2 = validate1a(d[val], v)) && # XXX check cut or not!
|
|
793
|
+
d_check.delete(val) {:not_found} != :not_found
|
|
794
|
+
anno.concat(ann2)
|
|
795
|
+
throw :enough, true if (count += 1) == e
|
|
796
|
+
true
|
|
797
|
+
end
|
|
798
|
+
}
|
|
799
|
+
end and validate_result(count >= s) { "not enough #{ta.inspect} for #{r.inspect}" }
|
|
703
800
|
end
|
|
704
801
|
end
|
|
705
802
|
else
|
|
@@ -762,10 +859,22 @@ module CDDL
|
|
|
762
859
|
when :range
|
|
763
860
|
[] if where[2] === d && where[1].include?(d)
|
|
764
861
|
when :anno
|
|
765
|
-
target = where
|
|
766
|
-
if
|
|
767
|
-
|
|
768
|
-
|
|
862
|
+
_, conop, target, control = where
|
|
863
|
+
if conop == :cat || conop == :plus || conop == :det
|
|
864
|
+
ok1, v1, vt1 = extract_value(target)
|
|
865
|
+
ok2, v2, vt2 = extract_value(control)
|
|
866
|
+
# warn ["ANNO0", ok1, v1, vt1, ok2, v2, vt2, d].inspect
|
|
867
|
+
if ok1 && ok2
|
|
868
|
+
v2 = Integer(v2) if vt1 == Integer
|
|
869
|
+
if conop == :det
|
|
870
|
+
v1 = remove_indentation(v1)
|
|
871
|
+
v2 = remove_indentation(v2)
|
|
872
|
+
end
|
|
873
|
+
# warn ["ANNO", ok1, v1, vt1, ok2, v2, vt2, d].inspect
|
|
874
|
+
[] if d == v1 + v2 # XXX Focus ArgumentError
|
|
875
|
+
end
|
|
876
|
+
elsif ann = validate1a(d, target)
|
|
877
|
+
case conop
|
|
769
878
|
when :size
|
|
770
879
|
case d
|
|
771
880
|
when Integer
|
|
@@ -806,10 +915,24 @@ module CDDL
|
|
|
806
915
|
ann
|
|
807
916
|
when :feature
|
|
808
917
|
ok, v, vt = extract_value(control)
|
|
809
|
-
|
|
918
|
+
if ok
|
|
919
|
+
nm = v
|
|
920
|
+
det = d
|
|
921
|
+
warn "*** feature controller should be a string: #{control.inspect}" unless String == vt
|
|
922
|
+
else
|
|
923
|
+
ok, *v = extract_array(control)
|
|
924
|
+
if ok && v.size == 2
|
|
925
|
+
nm = v[0][0]
|
|
926
|
+
det = v[1][0]
|
|
927
|
+
warn "*** first element of feature controller should be a string: #{control.inspect}" unless String === nm
|
|
928
|
+
else
|
|
929
|
+
warn "*** feature controller not implemented: #{control.inspect}"
|
|
930
|
+
end
|
|
931
|
+
end
|
|
932
|
+
$features[nm][det] = true
|
|
810
933
|
ann
|
|
811
934
|
when :lt, :le, :gt, :ge, :eq, :ne
|
|
812
|
-
op = OPERATORS[
|
|
935
|
+
op = OPERATORS[conop]
|
|
813
936
|
ok, v, _vt = extract_value(control)
|
|
814
937
|
if ok
|
|
815
938
|
ann if d.send(op, v) rescue nil # XXX Focus ArgumentError
|
|
@@ -825,6 +948,24 @@ module CDDL
|
|
|
825
948
|
end
|
|
826
949
|
end
|
|
827
950
|
)
|
|
951
|
+
when :abnf, :abnfb
|
|
952
|
+
ann if (
|
|
953
|
+
if String === d
|
|
954
|
+
ok, v, vt = extract_value(control)
|
|
955
|
+
if ok && vt == String
|
|
956
|
+
begin
|
|
957
|
+
ABNF_PARSER_FOR_STRING[v].validate(
|
|
958
|
+
d.dup.force_encoding(ABNF_ENCODING_FOR_CONOP[conop]).codepoints.pack("U*")
|
|
959
|
+
)
|
|
960
|
+
true
|
|
961
|
+
rescue => e
|
|
962
|
+
# warn "*** #{e}" # XXX
|
|
963
|
+
@last_message = e.to_s.force_encoding(Encoding::UTF_8)
|
|
964
|
+
nil
|
|
965
|
+
end
|
|
966
|
+
end
|
|
967
|
+
end
|
|
968
|
+
)
|
|
828
969
|
when :cbor
|
|
829
970
|
ann if validate1((CBOR::decode(d) rescue :BAD_CBOR), control)
|
|
830
971
|
when :cborseq
|
|
@@ -1179,7 +1320,8 @@ module CDDL
|
|
|
1179
1320
|
BRACE = {"{" => :map, "[" => :array}
|
|
1180
1321
|
RANGE_EXCLUDE_END = {".." => false, "..." => true}
|
|
1181
1322
|
SUPPORTED_ANNOTATIONS = [:bits, :size, :regexp, :cbor, :cborseq, :within, :and,
|
|
1182
|
-
:default, :lt, :le, :gt, :ge, :eq, :ne,
|
|
1323
|
+
:default, :lt, :le, :gt, :ge, :eq, :ne,
|
|
1324
|
+
:feature, :abnf, :abnfb, :det, :cat, :plus]
|
|
1183
1325
|
|
|
1184
1326
|
def type1(n, canbegroup = false)
|
|
1185
1327
|
# puts "NVALUE #{n.value.inspect}"
|
|
@@ -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']
|
data/test-data/bat.cddl
ADDED
|
@@ -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 -
|
data/test-data/det1.cddl
ADDED
|
@@ -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"
|
data/test-data/oid.cddl
ADDED
data/test-data/plus.cddl
ADDED
data/test-data/sasl.cddl
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
message = text .abnfb ("message" .cat rfc4505)
|
|
2
|
+
|
|
3
|
+
rfc4505 = '
|
|
4
|
+
message = [ email / token ]
|
|
5
|
+
;; to be prepared in accordance with Section 3
|
|
6
|
+
|
|
7
|
+
UTF1 = %x00-3F / %x41-7F ;; less "@" (U+0040)
|
|
8
|
+
UTF2 = %xC2-DF UTF0
|
|
9
|
+
UTF3 = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) /
|
|
10
|
+
%xED %x80-9F UTF0 / %xEE-EF 2(UTF0)
|
|
11
|
+
UTF4 = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) /
|
|
12
|
+
%xF4 %x80-8F 2(UTF0)
|
|
13
|
+
UTF0 = %x80-BF
|
|
14
|
+
|
|
15
|
+
TCHAR = UTF1 / UTF2 / UTF3 / UTF4
|
|
16
|
+
;; any UTF-8 encoded Unicode character
|
|
17
|
+
;; except "@" (U+0040)
|
|
18
|
+
|
|
19
|
+
email = "too@much.work"; for this example
|
|
20
|
+
;email = addr-spec
|
|
21
|
+
;; as defined in [IMAIL]
|
|
22
|
+
|
|
23
|
+
token = 1*255TCHAR
|
|
24
|
+
'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = [tstr, tstr, tstr]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
csr-template-schema = {
|
|
2
|
+
keyTypes: [ 1* $keyType ]
|
|
3
|
+
? subject: distinguishedName
|
|
4
|
+
extensions: extensions
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
mandatory-wildcard = "**"
|
|
8
|
+
optional-wildcard = "*"
|
|
9
|
+
wildcard = mandatory-wildcard / optional-wildcard
|
|
10
|
+
|
|
11
|
+
; non-empty = { + any => any }
|
|
12
|
+
non-empty<M> = (M) .and ({ + any => any })
|
|
13
|
+
|
|
14
|
+
; regtext matches all text strings but "*" and "**"
|
|
15
|
+
regtext = text .regexp "([^\*].*)|([\*][^\*].*)|([\*][\*].+)"
|
|
16
|
+
|
|
17
|
+
regtext-or-wildcard = regtext / wildcard
|
|
18
|
+
|
|
19
|
+
distinguishedName = non-empty<{
|
|
20
|
+
? country: regtext-or-wildcard
|
|
21
|
+
? stateOrProvince: regtext-or-wildcard
|
|
22
|
+
? locality: regtext-or-wildcard
|
|
23
|
+
? organization: regtext-or-wildcard
|
|
24
|
+
? organizationalUnit: regtext-or-wildcard
|
|
25
|
+
? emailAddress: regtext-or-wildcard
|
|
26
|
+
? commonName: regtext-or-wildcard
|
|
27
|
+
}>
|
|
28
|
+
|
|
29
|
+
$keyType /= rsaKeyType
|
|
30
|
+
$keyType /= ecdsaKeyType
|
|
31
|
+
|
|
32
|
+
rsaKeyType = {
|
|
33
|
+
PublicKeyType: "rsaEncryption" ; OID: 1.2.840.113549.1.1.1
|
|
34
|
+
PublicKeyLength: rsaKeySize
|
|
35
|
+
SignatureType: $rsaSignatureType
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
rsaKeySize = int .ge 2048
|
|
39
|
+
|
|
40
|
+
; RSASSA-PKCS1-v1_5 with SHA-256
|
|
41
|
+
$rsaSignatureType /= "sha256WithRSAEncryption"
|
|
42
|
+
; RSASSA-PCKS1-v1_5 with SHA-384
|
|
43
|
+
$rsaSignatureType /= "sha384WithRSAEncryption"
|
|
44
|
+
; RSASSA-PCKS1-v1_5 with SHA-512
|
|
45
|
+
$rsaSignatureType /= "sha512WithRSAEncryption"
|
|
46
|
+
; RSASSA-PSS with SHA-256, MGF-1 with SHA-256, and a 32 byte salt
|
|
47
|
+
$rsaSignatureType /= "sha256WithRSAandMGF1"
|
|
48
|
+
; RSASSA-PSS with SHA-384, MGF-1 with SHA-384, and a 48 byte salt
|
|
49
|
+
$rsaSignatureType /= "sha384WithRSAandMGF1"
|
|
50
|
+
; RSASSA-PSS with SHA-512, MGF-1 with SHA-512, and a 64 byte salt
|
|
51
|
+
$rsaSignatureType /= "sha512WithRSAandMGF1"
|
|
52
|
+
|
|
53
|
+
ecdsaKeyType = {
|
|
54
|
+
PublicKeyType: "id-ecPublicKey" ; OID: 1.2.840.10045.2.1
|
|
55
|
+
namedCurve: $ecdsaCurve
|
|
56
|
+
SignatureType: $ecdsaSignatureType
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
$ecdsaCurve /= "secp256r1" ; OID: 1.2.840.10045.3.1.7
|
|
60
|
+
$ecdsaCurve /= "secp384r1" ; OID: 1.3.132.0.34
|
|
61
|
+
$ecdsaCurve /= "secp521r1" ; OID: 1.3.132.0.3
|
|
62
|
+
|
|
63
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA256" ; paired with secp256r1
|
|
64
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA384" ; paired with secp384r1
|
|
65
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA512" ; paired with secp521r1
|
|
66
|
+
|
|
67
|
+
subjectaltname = {
|
|
68
|
+
? DNS: [ 1* regtext-or-wildcard ]
|
|
69
|
+
? Email: [ 1* regtext ]
|
|
70
|
+
? URI: [ 1* regtext ]
|
|
71
|
+
* $$subjectaltname-extension
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
extensions = {
|
|
75
|
+
? keyUsage: [ 1* keyUsageType ]
|
|
76
|
+
? extendedKeyUsage: [ 1* extendedKeyUsageType ]
|
|
77
|
+
subjectAltName: subjectaltname
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
keyUsageType /= "digitalSignature"
|
|
81
|
+
keyUsageType /= "nonRepudiation"
|
|
82
|
+
keyUsageType /= "keyEncipherment"
|
|
83
|
+
keyUsageType /= "dataEncipherment"
|
|
84
|
+
keyUsageType /= "keyAgreement"
|
|
85
|
+
keyUsageType /= "keyCertSign"
|
|
86
|
+
keyUsageType /= "cRLSign"
|
|
87
|
+
keyUsageType /= "encipherOnly"
|
|
88
|
+
keyUsageType /= "decipherOnly"
|
|
89
|
+
|
|
90
|
+
extendedKeyUsageType /= "serverAuth"
|
|
91
|
+
extendedKeyUsageType /= "clientAuth"
|
|
92
|
+
extendedKeyUsageType /= "codeSigning"
|
|
93
|
+
extendedKeyUsageType /= "emailProtection"
|
|
94
|
+
extendedKeyUsageType /= "timeStamping"
|
|
95
|
+
extendedKeyUsageType /= "OCSPSigning"
|
|
96
|
+
extendedKeyUsageType /= oid
|
|
97
|
+
|
|
98
|
+
oid = text .regexp "[0-9]+(\\.[0-9]+)*"
|
data/test-data/star.cddl
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
csr-template-schema = {
|
|
2
|
+
keyTypes: [ 1* $keyType ]
|
|
3
|
+
? subject: distinguishedName
|
|
4
|
+
extensions: extensions
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
mandatory-wildcard = "**"
|
|
8
|
+
optional-wildcard = "*"
|
|
9
|
+
wildcard = mandatory-wildcard / optional-wildcard
|
|
10
|
+
|
|
11
|
+
; regtext matches all text strings but "*" and "**"
|
|
12
|
+
regtext = text .regexp "([^\*].*)|([\*][^\*].*)|([\*][\*].+)"
|
|
13
|
+
|
|
14
|
+
regtext-or-wildcard = regtext / wildcard
|
|
15
|
+
|
|
16
|
+
distinguishedName = {
|
|
17
|
+
? country: regtext-or-wildcard
|
|
18
|
+
? stateOrProvince: regtext-or-wildcard
|
|
19
|
+
? locality: regtext-or-wildcard
|
|
20
|
+
? organization: regtext-or-wildcard
|
|
21
|
+
? organizationalUnit: regtext-or-wildcard
|
|
22
|
+
? emailAddress: regtext-or-wildcard
|
|
23
|
+
? commonName: regtext-or-wildcard
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
$keyType /= rsaKeyType
|
|
27
|
+
$keyType /= ecdsaKeyType
|
|
28
|
+
|
|
29
|
+
rsaKeyType = {
|
|
30
|
+
PublicKeyType: "rsaEncryption" ; OID: 1.2.840.113549.1.1.1
|
|
31
|
+
PublicKeyLength: rsaKeySize
|
|
32
|
+
SignatureType: $rsaSignatureType
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
rsaKeySize = int .ge 2048
|
|
36
|
+
|
|
37
|
+
; RSASSA-PKCS1-v1_5 with SHA-256
|
|
38
|
+
$rsaSignatureType /= "sha256WithRSAEncryption"
|
|
39
|
+
; RSASSA-PCKS1-v1_5 with SHA-384
|
|
40
|
+
$rsaSignatureType /= "sha384WithRSAEncryption"
|
|
41
|
+
; RSASSA-PCKS1-v1_5 with SHA-512
|
|
42
|
+
$rsaSignatureType /= "sha512WithRSAEncryption"
|
|
43
|
+
; RSASSA-PSS with SHA-256, MGF-1 with SHA-256, and a 32 byte salt
|
|
44
|
+
$rsaSignatureType /= "sha256WithRSAandMGF1"
|
|
45
|
+
; RSASSA-PSS with SHA-384, MGF-1 with SHA-384, and a 48 byte salt
|
|
46
|
+
$rsaSignatureType /= "sha384WithRSAandMGF1"
|
|
47
|
+
; RSASSA-PSS with SHA-512, MGF-1 with SHA-512, and a 64 byte salt
|
|
48
|
+
$rsaSignatureType /= "sha512WithRSAandMGF1"
|
|
49
|
+
|
|
50
|
+
ecdsaKeyType = {
|
|
51
|
+
PublicKeyType: "id-ecPublicKey" ; OID: 1.2.840.10045.2.1
|
|
52
|
+
namedCurve: $ecdsaCurve
|
|
53
|
+
SignatureType: $ecdsaSignatureType
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
$ecdsaCurve /= "secp256r1" ; OID: 1.2.840.10045.3.1.7
|
|
57
|
+
$ecdsaCurve /= "secp384r1" ; OID: 1.3.132.0.34
|
|
58
|
+
$ecdsaCurve /= "secp521r1" ; OID: 1.3.132.0.3
|
|
59
|
+
|
|
60
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA256" ; paired with secp256r1
|
|
61
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA384" ; paired with secp384r1
|
|
62
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA512" ; paired with secp521r1
|
|
63
|
+
|
|
64
|
+
subjectaltname = {
|
|
65
|
+
? DNS: [ 1* regtext-or-wildcard ]
|
|
66
|
+
? Email: [ 1* regtext ]
|
|
67
|
+
? URI: [ 1* regtext ]
|
|
68
|
+
* $$subjectaltname-extension
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
extensions = {
|
|
72
|
+
? keyUsage: [ 1* keyUsageType ]
|
|
73
|
+
? extendedKeyUsage: [ 1* extendedKeyUsageType ]
|
|
74
|
+
subjectAltName: subjectaltname
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
keyUsageType /= "digitalSignature"
|
|
78
|
+
keyUsageType /= "nonRepudiation"
|
|
79
|
+
keyUsageType /= "keyEncipherment"
|
|
80
|
+
keyUsageType /= "dataEncipherment"
|
|
81
|
+
keyUsageType /= "keyAgreement"
|
|
82
|
+
keyUsageType /= "keyCertSign"
|
|
83
|
+
keyUsageType /= "cRLSign"
|
|
84
|
+
keyUsageType /= "encipherOnly"
|
|
85
|
+
keyUsageType /= "decipherOnly"
|
|
86
|
+
|
|
87
|
+
extendedKeyUsageType /= "serverAuth"
|
|
88
|
+
extendedKeyUsageType /= "clientAuth"
|
|
89
|
+
extendedKeyUsageType /= "codeSigning"
|
|
90
|
+
extendedKeyUsageType /= "emailProtection"
|
|
91
|
+
extendedKeyUsageType /= "timeStamping"
|
|
92
|
+
extendedKeyUsageType /= "OCSPSigning"
|
|
93
|
+
extendedKeyUsageType /= oid
|
|
94
|
+
|
|
95
|
+
oid = text .regexp "[0-9]+(\\.[0-9]+)*"
|
data/test-data/time.cddl
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a = text .regexp "[a-z][a-z0-9]*(-[a-z0-9]+)*"
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
csr-template-schema = {
|
|
2
|
+
keyTypes: [ 1* $keyType ]
|
|
3
|
+
? subject: distinguishedName
|
|
4
|
+
extensions: extensions
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
mandatory-wildcard = "**"
|
|
8
|
+
optional-wildcard = "*"
|
|
9
|
+
wildcard = mandatory-wildcard / optional-wildcard
|
|
10
|
+
|
|
11
|
+
; regtext matches all text strings but "*" and "**"
|
|
12
|
+
regtext = text .regexp "([^\*].*)|([\*][^\*].*)|([\*][\*].+)"
|
|
13
|
+
|
|
14
|
+
regtext-or-wildcard = regtext / wildcard
|
|
15
|
+
|
|
16
|
+
distinguishedName = {
|
|
17
|
+
? country: regtext-or-wildcard
|
|
18
|
+
? stateOrProvince: regtext-or-wildcard
|
|
19
|
+
? locality: regtext-or-wildcard
|
|
20
|
+
? organization: regtext-or-wildcard
|
|
21
|
+
? organizationalUnit: regtext-or-wildcard
|
|
22
|
+
? emailAddress: regtext-or-wildcard
|
|
23
|
+
? commonName: regtext-or-wildcard
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
$keyType /= rsaKeyType
|
|
27
|
+
$keyType /= ecdsaKeyType
|
|
28
|
+
|
|
29
|
+
rsaKeyType = {
|
|
30
|
+
PublicKeyType: "rsaEncryption" ; OID: 1.2.840.113549.1.1.1
|
|
31
|
+
PublicKeyLength: rsaKeySize
|
|
32
|
+
SignatureType: $rsaSignatureType
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
rsaKeySize = int .ge 2048
|
|
36
|
+
|
|
37
|
+
; RSASSA-PKCS1-v1_5 with SHA-256
|
|
38
|
+
$rsaSignatureType /= "sha256WithRSAEncryption"
|
|
39
|
+
; RSASSA-PCKS1-v1_5 with SHA-384
|
|
40
|
+
$rsaSignatureType /= "sha384WithRSAEncryption"
|
|
41
|
+
; RSASSA-PCKS1-v1_5 with SHA-512
|
|
42
|
+
$rsaSignatureType /= "sha512WithRSAEncryption"
|
|
43
|
+
; RSASSA-PSS with SHA-256, MGF-1 with SHA-256, and a 32 byte salt
|
|
44
|
+
$rsaSignatureType /= "sha256WithRSAandMGF1"
|
|
45
|
+
; RSASSA-PSS with SHA-384, MGF-1 with SHA-384, and a 48 byte salt
|
|
46
|
+
$rsaSignatureType /= "sha384WithRSAandMGF1"
|
|
47
|
+
; RSASSA-PSS with SHA-512, MGF-1 with SHA-512, and a 64 byte salt
|
|
48
|
+
$rsaSignatureType /= "sha512WithRSAandMGF1"
|
|
49
|
+
|
|
50
|
+
ecdsaKeyType = {
|
|
51
|
+
PublicKeyType: "id-ecPublicKey" ; OID: 1.2.840.10045.2.1
|
|
52
|
+
namedCurve: $ecdsaCurve
|
|
53
|
+
SignatureType: $ecdsaSignatureType
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
$ecdsaCurve /= "secp256r1" ; OID: 1.2.840.10045.3.1.7
|
|
57
|
+
$ecdsaCurve /= "secp384r1" ; OID: 1.3.132.0.34
|
|
58
|
+
$ecdsaCurve /= "secp521r1" ; OID: 1.3.132.0.3
|
|
59
|
+
|
|
60
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA256" ; paired with secp256r1
|
|
61
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA384" ; paired with secp384r1
|
|
62
|
+
$ecdsaSignatureType /= "ecdsa-with-SHA512" ; paired with secp521r1
|
|
63
|
+
|
|
64
|
+
subjectaltname = {
|
|
65
|
+
? DNS: [ 1* regtext-or-wildcard ]
|
|
66
|
+
? Email: [ 1* regtext ]
|
|
67
|
+
? URI: [ 1* regtext ]
|
|
68
|
+
* $$subjectaltname-extension
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
extensions = {
|
|
72
|
+
? keyUsage: [ 1* keyUsageType ]
|
|
73
|
+
? extendedKeyUsage: [ 1* extendedKeyUsageType ]
|
|
74
|
+
subjectAltName: subjectaltname
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
keyUsageType /= "digitalSignature"
|
|
78
|
+
keyUsageType /= "nonRepudiation"
|
|
79
|
+
keyUsageType /= "keyEncipherment"
|
|
80
|
+
keyUsageType /= "dataEncipherment"
|
|
81
|
+
keyUsageType /= "keyAgreement"
|
|
82
|
+
keyUsageType /= "keyCertSign"
|
|
83
|
+
keyUsageType /= "cRLSign"
|
|
84
|
+
keyUsageType /= "encipherOnly"
|
|
85
|
+
keyUsageType /= "decipherOnly"
|
|
86
|
+
|
|
87
|
+
extendedKeyUsageType /= "serverAuth"
|
|
88
|
+
extendedKeyUsageType /= "clientAuth"
|
|
89
|
+
extendedKeyUsageType /= "codeSigning"
|
|
90
|
+
extendedKeyUsageType /= "emailProtection"
|
|
91
|
+
extendedKeyUsageType /= "timeStamping"
|
|
92
|
+
extendedKeyUsageType /= "OCSPSigning"
|
|
93
|
+
extendedKeyUsageType /= oid
|
|
94
|
+
|
|
95
|
+
oid = text .regexp "[0-9]+(\\.[0-9]+)*"
|
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.26
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carsten Bormann
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-07-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cbor-diag
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: abnftt
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: regexp-examples
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,14 +114,20 @@ files:
|
|
|
100
114
|
- test-data/7807.cddl
|
|
101
115
|
- test-data/a.cddl
|
|
102
116
|
- test-data/abignum.cddl
|
|
117
|
+
- test-data/abnf1.cddl
|
|
118
|
+
- test-data/abnf2.cddl
|
|
119
|
+
- test-data/abnf3.cddl
|
|
103
120
|
- test-data/ambig.cddl
|
|
104
121
|
- test-data/b.cddl
|
|
105
122
|
- test-data/badaddr.cddl
|
|
106
123
|
- test-data/basic_syntax_example.cddl
|
|
124
|
+
- test-data/bat.cddl
|
|
107
125
|
- test-data/bpv7.cddl
|
|
108
126
|
- test-data/bpv7a.cddl
|
|
109
127
|
- test-data/bpv7b.cddl
|
|
128
|
+
- test-data/cat-re.cddl
|
|
110
129
|
- test-data/cdni-ct.cddl
|
|
130
|
+
- test-data/complex-occ.cddl
|
|
111
131
|
- test-data/coral.cddl
|
|
112
132
|
- test-data/coral1.cddl
|
|
113
133
|
- test-data/coral2.cddl
|
|
@@ -115,9 +135,12 @@ files:
|
|
|
115
135
|
- test-data/cose.cddl
|
|
116
136
|
- test-data/dcaf.cddl
|
|
117
137
|
- test-data/dcaf1.cddl
|
|
138
|
+
- test-data/det1.cddl
|
|
118
139
|
- test-data/dotsize.cddl
|
|
119
140
|
- test-data/extractor-demo.cddl
|
|
120
141
|
- test-data/feat1.cddl
|
|
142
|
+
- test-data/feature-controller.cddl
|
|
143
|
+
- test-data/feature-detail.cddl
|
|
121
144
|
- test-data/foo.cddl
|
|
122
145
|
- test-data/grasp-01-extract.cddl
|
|
123
146
|
- test-data/grasp-01-test.cddl
|
|
@@ -125,6 +148,8 @@ files:
|
|
|
125
148
|
- test-data/grasp-09.cddl
|
|
126
149
|
- test-data/grasp-v1.cddl
|
|
127
150
|
- test-data/grasp-v2X.cddl
|
|
151
|
+
- test-data/homenet-de.cddl
|
|
152
|
+
- test-data/homenet-fe.cddl
|
|
128
153
|
- test-data/ifmap-base-2.0v17.cddl
|
|
129
154
|
- test-data/ifmap-base-2.2v9_fh-cabo.cddl
|
|
130
155
|
- test-data/ifmap-metadata-2.2v9_fh-cabo.cddl
|
|
@@ -134,6 +159,7 @@ files:
|
|
|
134
159
|
- test-data/jim-cut.cddl
|
|
135
160
|
- test-data/jsoniodef.cddl
|
|
136
161
|
- test-data/kevin5.cddl
|
|
162
|
+
- test-data/lint1.cddl
|
|
137
163
|
- test-data/map-group.cddl
|
|
138
164
|
- test-data/mapkey.cddl
|
|
139
165
|
- test-data/mdl-ble.cddl
|
|
@@ -147,10 +173,20 @@ files:
|
|
|
147
173
|
- test-data/mon-val.cddl
|
|
148
174
|
- test-data/multipart-ct.cddl
|
|
149
175
|
- test-data/named-group.cddl
|
|
176
|
+
- test-data/non-empty.cddl
|
|
177
|
+
- test-data/oid.cddl
|
|
178
|
+
- test-data/oidbat.cddl
|
|
150
179
|
- test-data/patch1.cddl
|
|
180
|
+
- test-data/plus.cddl
|
|
151
181
|
- test-data/reused_named_group.cddl
|
|
182
|
+
- test-data/sasl.cddl
|
|
183
|
+
- test-data/sequence.cddl
|
|
184
|
+
- test-data/sipos.cddl
|
|
185
|
+
- test-data/star-edited.cddl
|
|
186
|
+
- test-data/star.cddl
|
|
152
187
|
- test-data/structure.cddl
|
|
153
188
|
- test-data/test-gen.cddl
|
|
189
|
+
- test-data/time.cddl
|
|
154
190
|
- test-data/toerless0.cddl
|
|
155
191
|
- test-data/toerless1.cddl
|
|
156
192
|
- test-data/two_anonymous_groups.cddl
|
|
@@ -159,6 +195,8 @@ files:
|
|
|
159
195
|
- test-data/wrong2.cddl
|
|
160
196
|
- test-data/wrong2a.cddl
|
|
161
197
|
- test-data/xmlmig.cddl
|
|
198
|
+
- test-data/yangid.cddl
|
|
199
|
+
- test-data/yaron1.cddl
|
|
162
200
|
- test/test-cddl.rb
|
|
163
201
|
homepage: http://github.com/cabo/cddl
|
|
164
202
|
licenses:
|
|
@@ -179,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
217
|
- !ruby/object:Gem::Version
|
|
180
218
|
version: '0'
|
|
181
219
|
requirements: []
|
|
182
|
-
rubygems_version: 3.
|
|
220
|
+
rubygems_version: 3.2.22
|
|
183
221
|
signing_key:
|
|
184
222
|
specification_version: 4
|
|
185
223
|
summary: CDDL generator and validator.
|