cddlc 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cddlc.gemspec +1 -1
- data/data/rfc9393-concise-swid-tag.cddl +279 -0
- data/data/rfc9393-sign.cddl +26 -0
- data/data/rfc9393-sign1.cddl +19 -0
- data/data/rfc9393-tags.cddl +9 -0
- data/data/rfc9393.cddl +1 -0
- data/lib/writer/cddl-writer.rb +2 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2ac8a4458103e760994cda656a70d934555d3b3a5f86416c53b6c3be353fd38
|
4
|
+
data.tar.gz: 7f8d5cd6a43fb98f3d201fb218d30b865f47cc0b8b0714db6ce68e2770b130bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ef745cc5ccae3bfb100227f9713bc923b535d9f7c6087c7b091a0570be012236f2756280319163574d145745370f8193467c0824e2a66b3e48cf67621c69c6
|
7
|
+
data.tar.gz: 369473fb2b9ed8b88c6f42f627af9fa41a5a0fe3c0600a0574bd7a2815284b4c68fc9d33cfcd8a1f8fad107c7aba0282063d8a2e34be6677fc2b1d9bc9f78885
|
data/cddlc.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cddlc"
|
3
|
-
s.version = "0.2.
|
3
|
+
s.version = "0.2.2"
|
4
4
|
s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
|
5
5
|
s.description = %q{cddlc implements converters and miscellaneous tools for CDDL, RFC 8610}
|
6
6
|
s.author = "Carsten Bormann"
|
@@ -0,0 +1,279 @@
|
|
1
|
+
concise-swid-tag = {
|
2
|
+
tag-id => text / bstr .size 16,
|
3
|
+
tag-version => integer,
|
4
|
+
? corpus => bool,
|
5
|
+
? patch => bool,
|
6
|
+
? supplemental => bool,
|
7
|
+
software-name => text,
|
8
|
+
? software-version => text,
|
9
|
+
? version-scheme => $version-scheme,
|
10
|
+
? media => text,
|
11
|
+
? software-meta => one-or-more<software-meta-entry>,
|
12
|
+
entity => one-or-more<entity-entry>,
|
13
|
+
? link => one-or-more<link-entry>,
|
14
|
+
? payload-or-evidence,
|
15
|
+
* $$coswid-extension,
|
16
|
+
global-attributes,
|
17
|
+
}
|
18
|
+
|
19
|
+
payload-or-evidence //= ( payload => payload-entry )
|
20
|
+
payload-or-evidence //= ( evidence => evidence-entry )
|
21
|
+
|
22
|
+
any-uri = uri
|
23
|
+
label = text / int
|
24
|
+
|
25
|
+
$version-scheme /= multipartnumeric
|
26
|
+
$version-scheme /= multipartnumeric-suffix
|
27
|
+
$version-scheme /= alphanumeric
|
28
|
+
$version-scheme /= decimal
|
29
|
+
$version-scheme /= semver
|
30
|
+
$version-scheme /= int / text
|
31
|
+
|
32
|
+
any-attribute = (
|
33
|
+
label => one-or-more<text> / one-or-more<int>
|
34
|
+
)
|
35
|
+
|
36
|
+
one-or-more<T> = T / [ 2* T ]
|
37
|
+
|
38
|
+
global-attributes = (
|
39
|
+
? lang => text,
|
40
|
+
* any-attribute,
|
41
|
+
)
|
42
|
+
|
43
|
+
hash-entry = [
|
44
|
+
hash-alg-id: int,
|
45
|
+
hash-value: bytes,
|
46
|
+
]
|
47
|
+
|
48
|
+
entity-entry = {
|
49
|
+
entity-name => text,
|
50
|
+
? reg-id => any-uri,
|
51
|
+
role => one-or-more<$role>,
|
52
|
+
? thumbprint => hash-entry,
|
53
|
+
* $$entity-extension,
|
54
|
+
global-attributes,
|
55
|
+
}
|
56
|
+
|
57
|
+
$role /= tag-creator
|
58
|
+
$role /= software-creator
|
59
|
+
$role /= aggregator
|
60
|
+
$role /= distributor
|
61
|
+
$role /= licensor
|
62
|
+
$role /= maintainer
|
63
|
+
$role /= int / text
|
64
|
+
|
65
|
+
link-entry = {
|
66
|
+
? artifact => text,
|
67
|
+
href => any-uri,
|
68
|
+
? media => text,
|
69
|
+
? ownership => $ownership,
|
70
|
+
rel => $rel,
|
71
|
+
? media-type => text,
|
72
|
+
? use => $use,
|
73
|
+
* $$link-extension,
|
74
|
+
global-attributes,
|
75
|
+
}
|
76
|
+
|
77
|
+
$ownership /= shared
|
78
|
+
$ownership /= private
|
79
|
+
$ownership /= abandon
|
80
|
+
$ownership /= int / text
|
81
|
+
|
82
|
+
$rel /= ancestor
|
83
|
+
$rel /= component
|
84
|
+
$rel /= feature
|
85
|
+
$rel /= installationmedia
|
86
|
+
$rel /= packageinstaller
|
87
|
+
$rel /= parent
|
88
|
+
$rel /= patches
|
89
|
+
$rel /= requires
|
90
|
+
$rel /= see-also
|
91
|
+
$rel /= supersedes
|
92
|
+
$rel /= supplemental
|
93
|
+
$rel /= -256..65536 / text
|
94
|
+
|
95
|
+
$use /= optional
|
96
|
+
$use /= required
|
97
|
+
$use /= recommended
|
98
|
+
$use /= int / text
|
99
|
+
|
100
|
+
software-meta-entry = {
|
101
|
+
? activation-status => text,
|
102
|
+
? channel-type => text,
|
103
|
+
? colloquial-version => text,
|
104
|
+
? description => text,
|
105
|
+
? edition => text,
|
106
|
+
? entitlement-data-required => bool,
|
107
|
+
? entitlement-key => text,
|
108
|
+
? generator => text / bstr .size 16,
|
109
|
+
? persistent-id => text,
|
110
|
+
? product => text,
|
111
|
+
? product-family => text,
|
112
|
+
? revision => text,
|
113
|
+
? summary => text,
|
114
|
+
? unspsc-code => text,
|
115
|
+
? unspsc-version => text,
|
116
|
+
* $$software-meta-extension,
|
117
|
+
global-attributes,
|
118
|
+
}
|
119
|
+
|
120
|
+
path-elements-group = ( ? directory => one-or-more<directory-entry>,
|
121
|
+
? file => one-or-more<file-entry>,
|
122
|
+
)
|
123
|
+
|
124
|
+
resource-collection = (
|
125
|
+
path-elements-group,
|
126
|
+
? process => one-or-more<process-entry>,
|
127
|
+
? resource => one-or-more<resource-entry>,
|
128
|
+
* $$resource-collection-extension,
|
129
|
+
)
|
130
|
+
|
131
|
+
file-entry = {
|
132
|
+
filesystem-item,
|
133
|
+
? size => uint,
|
134
|
+
? file-version => text,
|
135
|
+
? hash => hash-entry,
|
136
|
+
* $$file-extension,
|
137
|
+
global-attributes,
|
138
|
+
}
|
139
|
+
|
140
|
+
directory-entry = {
|
141
|
+
filesystem-item,
|
142
|
+
? path-elements => { path-elements-group },
|
143
|
+
* $$directory-extension,
|
144
|
+
global-attributes,
|
145
|
+
}
|
146
|
+
|
147
|
+
process-entry = {
|
148
|
+
process-name => text,
|
149
|
+
? pid => integer,
|
150
|
+
* $$process-extension,
|
151
|
+
global-attributes,
|
152
|
+
}
|
153
|
+
|
154
|
+
resource-entry = {
|
155
|
+
type => text,
|
156
|
+
* $$resource-extension,
|
157
|
+
global-attributes,
|
158
|
+
}
|
159
|
+
|
160
|
+
filesystem-item = (
|
161
|
+
? key => bool,
|
162
|
+
? location => text,
|
163
|
+
fs-name => text,
|
164
|
+
? root => text,
|
165
|
+
)
|
166
|
+
|
167
|
+
payload-entry = {
|
168
|
+
resource-collection,
|
169
|
+
* $$payload-extension,
|
170
|
+
global-attributes,
|
171
|
+
}
|
172
|
+
|
173
|
+
evidence-entry = {
|
174
|
+
resource-collection,
|
175
|
+
? date => integer-time,
|
176
|
+
? device-id => text,
|
177
|
+
? location => text,
|
178
|
+
* $$evidence-extension,
|
179
|
+
global-attributes,
|
180
|
+
}
|
181
|
+
|
182
|
+
integer-time = #6.1(int)
|
183
|
+
|
184
|
+
; "global map member" integer indices
|
185
|
+
tag-id = 0
|
186
|
+
software-name = 1
|
187
|
+
entity = 2
|
188
|
+
evidence = 3
|
189
|
+
link = 4
|
190
|
+
software-meta = 5
|
191
|
+
payload = 6
|
192
|
+
hash = 7
|
193
|
+
corpus = 8
|
194
|
+
patch = 9
|
195
|
+
media = 10
|
196
|
+
supplemental = 11
|
197
|
+
tag-version = 12
|
198
|
+
software-version = 13
|
199
|
+
version-scheme = 14
|
200
|
+
lang = 15
|
201
|
+
directory = 16
|
202
|
+
file = 17
|
203
|
+
process = 18
|
204
|
+
resource = 19
|
205
|
+
size = 20
|
206
|
+
file-version = 21
|
207
|
+
key = 22
|
208
|
+
location = 23
|
209
|
+
fs-name = 24
|
210
|
+
root = 25
|
211
|
+
path-elements = 26
|
212
|
+
process-name = 27
|
213
|
+
pid = 28
|
214
|
+
type = 29
|
215
|
+
entity-name = 31
|
216
|
+
reg-id = 32
|
217
|
+
role = 33
|
218
|
+
thumbprint = 34
|
219
|
+
date = 35
|
220
|
+
device-id = 36
|
221
|
+
artifact = 37
|
222
|
+
href = 38
|
223
|
+
ownership = 39
|
224
|
+
rel = 40
|
225
|
+
media-type = 41
|
226
|
+
use = 42
|
227
|
+
activation-status = 43
|
228
|
+
channel-type = 44
|
229
|
+
colloquial-version = 45
|
230
|
+
description = 46
|
231
|
+
edition = 47
|
232
|
+
entitlement-data-required = 48
|
233
|
+
entitlement-key = 49
|
234
|
+
generator = 50
|
235
|
+
persistent-id = 51
|
236
|
+
product = 52
|
237
|
+
product-family = 53
|
238
|
+
revision = 54
|
239
|
+
summary = 55
|
240
|
+
unspsc-code = 56
|
241
|
+
unspsc-version = 57
|
242
|
+
|
243
|
+
; "version-scheme" integer indices
|
244
|
+
multipartnumeric = 1
|
245
|
+
multipartnumeric-suffix = 2
|
246
|
+
alphanumeric = 3
|
247
|
+
decimal = 4
|
248
|
+
semver = 16384
|
249
|
+
|
250
|
+
; "role" integer indices
|
251
|
+
tag-creator=1
|
252
|
+
software-creator=2
|
253
|
+
aggregator=3
|
254
|
+
distributor=4
|
255
|
+
licensor=5
|
256
|
+
maintainer=6
|
257
|
+
|
258
|
+
; "ownership" integer indices
|
259
|
+
abandon=1
|
260
|
+
private=2
|
261
|
+
shared=3
|
262
|
+
|
263
|
+
; "rel" integer indices
|
264
|
+
ancestor=1
|
265
|
+
component=2
|
266
|
+
feature=3
|
267
|
+
installationmedia=4
|
268
|
+
packageinstaller=5
|
269
|
+
parent=6
|
270
|
+
patches=7
|
271
|
+
requires=8
|
272
|
+
see-also=9
|
273
|
+
supersedes=10
|
274
|
+
; supplemental=11 ; already defined
|
275
|
+
|
276
|
+
; "use" integer indices
|
277
|
+
optional=1
|
278
|
+
required=2
|
279
|
+
recommended=3
|
@@ -0,0 +1,26 @@
|
|
1
|
+
COSE_Sign-coswid<payload> = [
|
2
|
+
protected: bstr .cbor protected-signed-coswid-header1,
|
3
|
+
unprotected: unprotected-signed-coswid-header,
|
4
|
+
payload: bstr .cbor payload,
|
5
|
+
signature: [ * COSE_Signature ],
|
6
|
+
]
|
7
|
+
|
8
|
+
protected-signed-coswid-header1 = {
|
9
|
+
3 => "application/swid+cbor",
|
10
|
+
* cose-label => cose-values,
|
11
|
+
}
|
12
|
+
|
13
|
+
protected-signature-coswid-header = {
|
14
|
+
1 => int, ; algorithm identifier
|
15
|
+
* cose-label => cose-values,
|
16
|
+
}
|
17
|
+
|
18
|
+
unprotected-signed-coswid-header = {
|
19
|
+
* cose-label => cose-values,
|
20
|
+
}
|
21
|
+
|
22
|
+
COSE_Signature = [
|
23
|
+
protected: bstr .cbor protected-signature-coswid-header,
|
24
|
+
unprotected: unprotected-signed-coswid-header,
|
25
|
+
signature: bstr
|
26
|
+
]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
COSE_Sign1-coswid<payload> = [
|
2
|
+
protected: bstr .cbor protected-signed-coswid-header,
|
3
|
+
unprotected: unprotected-signed-coswid-header,
|
4
|
+
payload: bstr .cbor payload,
|
5
|
+
signature: bstr,
|
6
|
+
]
|
7
|
+
|
8
|
+
cose-label = int / tstr
|
9
|
+
cose-values = any
|
10
|
+
|
11
|
+
protected-signed-coswid-header = {
|
12
|
+
1 => int, ; algorithm identifier
|
13
|
+
3 => "application/swid+cbor",
|
14
|
+
* cose-label => cose-values,
|
15
|
+
}
|
16
|
+
|
17
|
+
unprotected-signed-coswid-header = {
|
18
|
+
* cose-label => cose-values,
|
19
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
coswid = unsigned-coswid / signed-coswid
|
2
|
+
unsigned-coswid = concise-swid-tag / tagged-coswid<concise-swid-tag>
|
3
|
+
signed-coswid1 = signed-coswid-for<unsigned-coswid>
|
4
|
+
signed-coswid = signed-coswid1 / tagged-coswid<signed-coswid1>
|
5
|
+
|
6
|
+
tagged-coswid<T> = #6.1398229316(T)
|
7
|
+
|
8
|
+
signed-coswid-for<payload> = #6.18(COSE_Sign1-coswid<payload>)
|
9
|
+
/ #6.98(COSE_Sign-coswid<payload>)
|
data/data/rfc9393.cddl
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rfc9393-concise-swid-tag.cddl
|
data/lib/writer/cddl-writer.rb
CHANGED
@@ -42,7 +42,7 @@ class CDDL
|
|
42
42
|
in ["gen", id, *parms] # oops -- namep vs. namea; ouch
|
43
43
|
[4, "#{id}<#{parms.map{write_rhs(_1, 2, indent, pn)}.join(", ")}>"]
|
44
44
|
in ["tcho", *types]
|
45
|
-
[2, types.map{write_rhs(_1, 3, indent, pn)}.join(" / ")]
|
45
|
+
[2.1, types.map{write_rhs(_1, 3, indent, pn)}.join(" / ")]
|
46
46
|
in ["gcho", *groups]
|
47
47
|
[0, groups.map{write_rhs(_1, 2, indent, pn)}.join(" // ")]
|
48
48
|
in ["op", op, l, r]
|
@@ -116,7 +116,7 @@ class CDDL
|
|
116
116
|
in ["parm", parmnames, _type]
|
117
117
|
else
|
118
118
|
end
|
119
|
-
"#{write_lhs(k, parmnames)} = #{write_rhs(v, 2)}" # 2: parenthesize groups
|
119
|
+
"#{write_lhs(k, parmnames)} = #{write_rhs(v, 2.1)}" # 2: parenthesize groups
|
120
120
|
}.join("\n")
|
121
121
|
end
|
122
122
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cddlc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
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: 2024-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,6 +97,11 @@ files:
|
|
97
97
|
- data/rfc9290.cddl
|
98
98
|
- data/rfc9321.cddl
|
99
99
|
- data/rfc9338.cddl
|
100
|
+
- data/rfc9393-concise-swid-tag.cddl
|
101
|
+
- data/rfc9393-sign.cddl
|
102
|
+
- data/rfc9393-sign1.cddl
|
103
|
+
- data/rfc9393-tags.cddl
|
104
|
+
- data/rfc9393.cddl
|
100
105
|
- lib/cddlc.rb
|
101
106
|
- lib/parser/cddl-util.rb
|
102
107
|
- lib/parser/cddlgrammar.rb
|