cddl 0.8.20 → 0.8.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 400024278cc4fce962a5e51e60ba6025ec371cd5768685c0ce10534a06393fa2
4
- data.tar.gz: cbac2ff6008501c65984cb816cc95b79a8adc361609c4858ba518c073e317937
3
+ metadata.gz: f2e513842da8f3086dcdfa5e6cafdade09e3e098ca20b68855fcfff7d8ee52ec
4
+ data.tar.gz: e78425bd7a93c1da2ae319a332fca9a90cab0e42deaa09e20af7a3fc330a369a
5
5
  SHA512:
6
- metadata.gz: 71babdced5f362b46a1877fdb8676faf2efec9594069b9b95c80daecdfb9aad5bf13ca73577437089fb1dd4819506b00311c003699831110fbba464c06d86fad
7
- data.tar.gz: 2a29deef318b1c31a830e8937618d776fc439bc6a5b792b7daa79545ed29aedb028f6e78ce3f3b04f36767f21cf38ff349f6251ff3d83103f02c94a124132f34
6
+ metadata.gz: 7e3dda08f71e21cff6ddebf1d67a6252145f560203d4ec411b5aad4473e11c5635c36a518e58915ae5a6ced00c0cbb6a55d1a50c6687fdb6000c3113ed1cd311
7
+ data.tar.gz: eed4acc73dac34d3a7715bfa853c8c9638d146c75a6742af420aadef39e7ad5b75fde2f297164d3818d4d4737844e9d8e779d48ed4899fa2b9f79927c8ca3cc3
data/bin/cddl CHANGED
@@ -19,17 +19,19 @@ def usage
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)
data/cddl.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'cddl'
3
- s.version = '0.8.20'
3
+ s.version = '0.8.25'
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')
data/lib/cddl.rb CHANGED
@@ -56,6 +56,8 @@ module CDDL
56
56
  @ast = @abnf.ast?
57
57
  # our little argument stack for rule processing
58
58
  @insides = []
59
+ # collect error information
60
+ @last_message = ""
59
61
  end
60
62
 
61
63
  def apr # for debugging
@@ -458,10 +460,10 @@ module CDDL
458
460
  generate1(target, inmap)
459
461
  when :feature
460
462
  generate1(target, inmap)
461
- when :cat, :bat
463
+ when :cat, :det
462
464
  lhs = generate1(target, inmap)
463
465
  rhs = generate1(control)
464
- rhs = remove_indentation(rhs) if conop == :bat
466
+ rhs = remove_indentation(rhs) if conop == :det
465
467
  begin
466
468
  lhs + rhs
467
469
  rescue Exception => e
@@ -599,7 +601,7 @@ module CDDL
599
601
  elsif t[0] == :anno
600
602
  _, conop, target, control = t
601
603
  # warn ["EXV0", conop, target, control].inspect
602
- if conop == :cat || conop == :plus || conop == :bat
604
+ if conop == :cat || conop == :plus || conop == :det
603
605
  ok1, v1, vt1 = extract_value(target)
604
606
  ok2, v2, vt2 = extract_value(control)
605
607
  # warn ["EXV", ok1, v1, vt1, ok2, v2, vt2].inspect
@@ -609,7 +611,7 @@ module CDDL
609
611
  elsif vt1 == Float
610
612
  [true, v1 + v2, vt1] if vt2 == Integer || vt2 == Float
611
613
  else
612
- v2 = remove_indentation(v2) if conop == :bat
614
+ v2 = remove_indentation(v2) if conop == :det
613
615
  [true, v1 + v2, vt1] if vt1 == vt2
614
616
  end
615
617
  end rescue nil
@@ -641,7 +643,7 @@ module CDDL
641
643
  ok = ENV["CDDL_FEATURE_OK"] and ok = ok.split(/,\s*/) or ok = []
642
644
  # warn([:OK, ok, $features].inspect)
643
645
  features = $features.reject {|k, v| ok.include? k.to_s }
644
- warn "** Features potentially used: #{features.map {|k, v| "#{k}: #{v.keys}"}.join(", ")}" if features != {}
646
+ warn "** Features potentially used (#$fn): #{features.map {|k, v| "#{k}: #{v.keys}"}.join(", ")}" if features != {}
645
647
  end
646
648
  else
647
649
  warn "CDDL validation failure (#{result.inspect} for #{d.inspect}):"
@@ -778,13 +780,17 @@ module CDDL
778
780
  puts "COMPLEX: #{k.inspect} #{simple.inspect} #{simpleval.inspect}" if ENV["CDDL_TRACE"]
779
781
  keys = d_check.keys
780
782
  ta, keys = keys.partition{ |key| validate1(key, k)}
781
- # XXX check ta.size against s/e
782
- ta.all? { |val|
783
- if (ann2 = validate1a(d[val], v)) &&
784
- d_check.delete(val) {:not_found} != :not_found
785
- anno.concat(ann2)
786
- end
787
- }
783
+ count = 0
784
+ catch :enough do
785
+ ta.all? { |val|
786
+ if (ann2 = validate1a(d[val], v)) && # XXX check cut or not!
787
+ d_check.delete(val) {:not_found} != :not_found
788
+ anno.concat(ann2)
789
+ throw :enough, true if (count += 1) == e
790
+ true
791
+ end
792
+ }
793
+ end and validate_result(count >= s) { "not enough #{ta.inspect} for #{r.inspect}" }
788
794
  end
789
795
  end
790
796
  else
@@ -854,7 +860,7 @@ module CDDL
854
860
  # warn ["ANNO0", ok1, v1, vt1, ok2, v2, vt2, d].inspect
855
861
  if ok1 && ok2
856
862
  v2 = Integer(v2) if vt1 == Integer
857
- v2 = remove_indentation(v2) if conop == :bat
863
+ v2 = remove_indentation(v2) if conop == :det
858
864
  # warn ["ANNO", ok1, v1, vt1, ok2, v2, vt2, d].inspect
859
865
  [] if d == v1 + v2 # XXX Focus ArgumentError
860
866
  end
@@ -903,11 +909,13 @@ module CDDL
903
909
  if ok
904
910
  nm = v
905
911
  det = d
912
+ warn "*** feature controller should be a string: #{control.inspect}" unless String == vt
906
913
  else
907
914
  ok, *v = extract_array(control)
908
915
  if ok && v.size == 2
909
916
  nm = v[0][0]
910
917
  det = v[1][0]
918
+ warn "*** first element of feature controller should be a string: #{control.inspect}" unless String === nm
911
919
  else
912
920
  warn "*** feature controller not implemented: #{control.inspect}"
913
921
  end
@@ -1304,7 +1312,7 @@ module CDDL
1304
1312
  RANGE_EXCLUDE_END = {".." => false, "..." => true}
1305
1313
  SUPPORTED_ANNOTATIONS = [:bits, :size, :regexp, :cbor, :cborseq, :within, :and,
1306
1314
  :default, :lt, :le, :gt, :ge, :eq, :ne,
1307
- :feature, :abnf, :abnfb, :bat, :cat, :plus]
1315
+ :feature, :abnf, :abnfb, :det, :cat, :plus]
1308
1316
 
1309
1317
  def type1(n, canbegroup = false)
1310
1318
  # puts "NVALUE #{n.value.inspect}"
@@ -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,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,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,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,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,5 @@
1
+ distinguishedName = non-empty<{
2
+ ? country: text
3
+ }>
4
+
5
+ non-empty<M> = (M) .and ({ + any => any })
@@ -0,0 +1,8 @@
1
+ oid = bytes .abnfb ("oid" .bat cbor-tags-oid)
2
+
3
+ cbor-tags-oid = '
4
+ oid = 1*arc
5
+ roid = *arc
6
+ arc = [nlsb] %x00-7f
7
+ nlsb = %x81-ff *%x80-ff
8
+ '
@@ -0,0 +1,3 @@
1
+ a = {
2
+ + any => any
3
+ }
@@ -0,0 +1,8 @@
1
+ ; start = {*$$socket}
2
+ ; $$socket //= (4: bstr)
3
+ ; $ cddl works.cddl generate
4
+ ; {4: h'6F7267616E69736D'}
5
+ ; $ cat fails.cddl
6
+ start = {*$$socket}
7
+ $$socket //= (some,)
8
+ some = (4: bstr)
@@ -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]+)*"
@@ -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]+)*"
@@ -0,0 +1,11 @@
1
+ etime = #6.1001({
2
+ 1: int,
3
+ ? (
4
+ -3: uint .lt 1000 //
5
+ -6: uint .lt 1000000 //
6
+ -9: uint .lt 1000000000 //
7
+ -12: uint .lt 1000000000000 //
8
+ -15: uint .lt 1000000000000000 //
9
+ -18: uint .lt 1000000000000000000
10
+ )
11
+ })
@@ -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.20
4
+ version: 0.8.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cbor-diag
@@ -121,11 +121,13 @@ files:
121
121
  - test-data/b.cddl
122
122
  - test-data/badaddr.cddl
123
123
  - test-data/basic_syntax_example.cddl
124
+ - test-data/bat.cddl
124
125
  - test-data/bpv7.cddl
125
126
  - test-data/bpv7a.cddl
126
127
  - test-data/bpv7b.cddl
127
128
  - test-data/cat-re.cddl
128
129
  - test-data/cdni-ct.cddl
130
+ - test-data/complex-occ.cddl
129
131
  - test-data/coral.cddl
130
132
  - test-data/coral1.cddl
131
133
  - test-data/coral2.cddl
@@ -136,6 +138,7 @@ files:
136
138
  - test-data/dotsize.cddl
137
139
  - test-data/extractor-demo.cddl
138
140
  - test-data/feat1.cddl
141
+ - test-data/feature-controller.cddl
139
142
  - test-data/feature-detail.cddl
140
143
  - test-data/foo.cddl
141
144
  - test-data/grasp-01-extract.cddl
@@ -144,6 +147,8 @@ files:
144
147
  - test-data/grasp-09.cddl
145
148
  - test-data/grasp-v1.cddl
146
149
  - test-data/grasp-v2X.cddl
150
+ - test-data/homenet-de.cddl
151
+ - test-data/homenet-fe.cddl
147
152
  - test-data/ifmap-base-2.0v17.cddl
148
153
  - test-data/ifmap-base-2.2v9_fh-cabo.cddl
149
154
  - test-data/ifmap-metadata-2.2v9_fh-cabo.cddl
@@ -153,6 +158,7 @@ files:
153
158
  - test-data/jim-cut.cddl
154
159
  - test-data/jsoniodef.cddl
155
160
  - test-data/kevin5.cddl
161
+ - test-data/lint1.cddl
156
162
  - test-data/map-group.cddl
157
163
  - test-data/mapkey.cddl
158
164
  - test-data/mdl-ble.cddl
@@ -166,13 +172,20 @@ files:
166
172
  - test-data/mon-val.cddl
167
173
  - test-data/multipart-ct.cddl
168
174
  - test-data/named-group.cddl
175
+ - test-data/non-empty.cddl
169
176
  - test-data/oid.cddl
177
+ - test-data/oidbat.cddl
170
178
  - test-data/patch1.cddl
179
+ - test-data/plus.cddl
171
180
  - test-data/reused_named_group.cddl
172
181
  - test-data/sasl.cddl
173
182
  - test-data/sequence.cddl
183
+ - test-data/sipos.cddl
184
+ - test-data/star-edited.cddl
185
+ - test-data/star.cddl
174
186
  - test-data/structure.cddl
175
187
  - test-data/test-gen.cddl
188
+ - test-data/time.cddl
176
189
  - test-data/toerless0.cddl
177
190
  - test-data/toerless1.cddl
178
191
  - test-data/two_anonymous_groups.cddl
@@ -181,6 +194,7 @@ files:
181
194
  - test-data/wrong2.cddl
182
195
  - test-data/wrong2a.cddl
183
196
  - test-data/xmlmig.cddl
197
+ - test-data/yaron1.cddl
184
198
  - test/test-cddl.rb
185
199
  homepage: http://github.com/cabo/cddl
186
200
  licenses:
@@ -201,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
215
  - !ruby/object:Gem::Version
202
216
  version: '0'
203
217
  requirements: []
204
- rubygems_version: 3.2.3
218
+ rubygems_version: 3.2.15
205
219
  signing_key:
206
220
  specification_version: 4
207
221
  summary: CDDL generator and validator.