cddl 0.8.21 → 0.8.22

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: 207ea6c166a60cfc705009af0a15b9633e301429cd8958d279f9d710800765bb
4
- data.tar.gz: 6b0e05ce4c0059d2a40a39892784da5e838451772bbad0d301c056a2c83418cb
3
+ metadata.gz: 72490cb2a368cfaec3e71cae79f323665fc64f0049feeb30050a6e8275566cda
4
+ data.tar.gz: 6ad8a0c69b34745dcd41f7c5627c57e9a4292539115f4d63c502d4c0a3cd0218
5
5
  SHA512:
6
- metadata.gz: 8fd0733ddb7c869b89578d92aee41d818ae3a4c85fbb9db0d4377136498195c054c17670c00ae89322578d5f6dfa64e1f10c5ed6c9c1cfcee27e9d135d9ac843
7
- data.tar.gz: 7a64af74fe96ae30fe834c36ca7c59326257f27e2d9a16ac3edb97bd1772c46e6f77c4a8dd715c27996a1b59369b8efe7be8332f82215afd7a0014cb72097f59
6
+ metadata.gz: 1fcbc5a8d49391656566b9f4b7d03392a579b5e999d301b2dab877aa25ff6d31c4575a94a771bdf8df0d0c3b88dd086bafe952359bb297690325204fbf732c11
7
+ data.tar.gz: 15ce2e416c02c834d3853520ca2fc8baa8b26359623dff75f6615a755a6ef4007abc2fb0170248ae5b57783e52fd779bc5c88be9cea70e7534ac9104cbfc67a8
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.21'
3
+ s.version = '0.8.22'
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
@@ -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.21
4
+ version: 0.8.22
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-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cbor-diag
@@ -183,6 +183,7 @@ files:
183
183
  - test-data/wrong2.cddl
184
184
  - test-data/wrong2a.cddl
185
185
  - test-data/xmlmig.cddl
186
+ - test-data/yaron1.cddl
186
187
  - test/test-cddl.rb
187
188
  homepage: http://github.com/cabo/cddl
188
189
  licenses: