1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
PKCS-7 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-7(7)
modules(0) pkcs-7(1)}
DEFINITIONS EXPLICIT TAGS ::=
BEGIN
--
-- 3. Definitions
--
-- EXPORTS All;
IMPORTS
informationFramework, authenticationFramework
FROM UsefulDefinitions {joint-iso-itu-t ds(5) module(1)
usefulDefinitions(0) 3}
ATTRIBUTE
FROM InformationFramework informationFramework
Name, Certificate, CertificateSerialNumber,
CertificateList, Time
FROM PKIX1Explicit88; -- AuthenticationFramework authenticationFramework;
-- contentType, messageDigest, signingTime
-- , counterSignature
-- FROM PKCS-9 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
-- pkcs-9(9) modules(0) pkcs-9(1)};
--
-- 6. Useful types
--
-- inlined from AuthenticationFramework
ALGORITHM ::= CLASS {&Type OPTIONAL,
&id OBJECT IDENTIFIER UNIQUE
}WITH SYNTAX {[&Type]
IDENTIFIED BY &id
}
-- inlined from PKCS-9
pkcs-9 OBJECT IDENTIFIER ::= {iso(1) member-body(2) us(840)
rsadsi(113549) pkcs(1) 9}
contentType ATTRIBUTE ::= {
WITH SYNTAX ContentType
-- EQUALITY MATCHING RULE objectIdentifierMatch
SINGLE VALUE TRUE
ID pkcs-9-at-contentType
}
pkcs-9-at-contentType OBJECT IDENTIFIER ::= {pkcs-9 3}
pkcs-9-at-messageDigest OBJECT IDENTIFIER ::= {pkcs-9 4}
pkcs-9-at-signingTime OBJECT IDENTIFIER ::= {pkcs-9 5}
pkcs-9-at-counterSignature OBJECT IDENTIFIER ::= {pkcs-9 6}
counterSignature ATTRIBUTE ::= {
WITH SYNTAX SignerInfo
ID pkcs-9-at-counterSignature
}
messageDigest ATTRIBUTE ::= {
WITH SYNTAX MessageDigest
-- EQUALITY MATCHING RULE octetStringMatch
SINGLE VALUE TRUE
ID pkcs-9-at-messageDigest
}
MessageDigest ::= OCTET STRING
signingTime ATTRIBUTE ::= {
WITH SYNTAX SigningTime
-- EQUALITY MATCHING RULE signingTimeMatch
SINGLE VALUE TRUE
ID pkcs-9-at-signingTime
}
SigningTime ::= Time -- imported from ISO/IEC 9594-8
-- Also defined in X.509
-- Redeclared here as a parameterized type
AlgorithmIdentifierPKSC-7 {ALGORITHM:IOSet} ::= SEQUENCE {
algorithm ALGORITHM.&id({IOSet}),
parameters ALGORITHM.&Type({IOSet}{@algorithm}) OPTIONAL
}
-- Also defined in X.501
-- Redeclared here as a parameterized type
AttributePKCS-7 { ATTRIBUTE:IOSet } ::= SEQUENCE {
type ATTRIBUTE.&id({IOSet}),
values SET SIZE (1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type})
}
CertificateRevocationLists ::=
SET OF CertificateList
Certificates ::=
SEQUENCE OF Certificate
CRLSequence ::=
SEQUENCE OF CertificateList
ContentEncryptionAlgorithmIdentifier ::=
AlgorithmIdentifierPKSC-7 {{ContentEncryptionAlgorithms}}
ContentEncryptionAlgorithms ALGORITHM ::= {
... -- add any application-specific algorithms here
}
DigestAlgorithmIdentifier ::=
AlgorithmIdentifierPKSC-7 {{DigestAlgorithms}}
DigestAlgorithms ALGORITHM ::= {
... -- add any application-specific algorithms here
}
DigestEncryptionAlgorithmIdentifier ::=
AlgorithmIdentifierPKSC-7 {{DigestEncryptionAlgorithms}}
DigestEncryptionAlgorithms ALGORITHM ::= {
... -- add any application-specific algorithms here
}
ExtendedCertificateOrCertificate ::= CHOICE {
certificate Certificate, -- X.509
extendedCertificate [0] IMPLICIT ExtendedCertificate -- PKCS#6
}
ExtendedCertificate ::= Certificate -- cheating
ExtendedCertificatesAndCertificates ::=
SET OF ExtendedCertificateOrCertificate
IssuerAndSerialNumber ::= SEQUENCE {
issuer Name,
serialNumber CertificateSerialNumber
}
KeyEncryptionAlgorithmIdentifier ::=
AlgorithmIdentifierPKSC-7 {{KeyEncryptionAlgorithms}}
KeyEncryptionAlgorithms ALGORITHM ::= {
... -- add any application-specific algorithms here
}
--
-- 7. General syntax
--
ContentInfo ::= SEQUENCE {
-- contentType ContentType,
contentType CONTENTS.&id({Contents}),
content [0] EXPLICIT CONTENTS.&Type({Contents}{@contentType})
OPTIONAL
}
CONTENTS ::= TYPE-IDENTIFIER
Contents CONTENTS ::= {
{Data IDENTIFIED BY data} |
{SignedData IDENTIFIED BY signedData} |
{EnvelopedData IDENTIFIED BY envelopedData} |
{SignedAndEnvelopedData IDENTIFIED BY signedAndEnvelopedData} |
{DigestedData IDENTIFIED BY digestedData} |
{EncryptedData IDENTIFIED BY encryptedData},
... -- add any application-specific types/contents here
}
ContentType ::= CONTENTS.&id({Contents})
--
-- 8. Data content type
--
Data ::= OCTET STRING
--
-- 9. Signed-data content type
--
SignedData ::= SEQUENCE {
-- version INTEGER {sdVer1(1), sdVer2(2)} (sdVer1 | sdVer2),
version INTEGER {sdVer1(1), sdVer2(2)},
digestAlgorithms
DigestAlgorithmIdentifiers,
contentInfo ContentInfo,
certificates CHOICE {
certSet [0] IMPLICIT ExtendedCertificatesAndCertificates,
certSequence [2] IMPLICIT Certificates
} OPTIONAL,
crls CHOICE {
crlSet [1] IMPLICIT CertificateRevocationLists,
crlSequence [3] IMPLICIT CRLSequence
} OPTIONAL,
signerInfos SignerInfos
} (WITH COMPONENTS { ..., version (sdVer1),
digestAlgorithms (WITH COMPONENTS { ..., daSet PRESENT }),
certificates (WITH COMPONENTS { ..., certSequence ABSENT }),
crls (WITH COMPONENTS { ..., crlSequence ABSENT }),
signerInfos (WITH COMPONENTS { ..., siSet PRESENT })
} |
WITH COMPONENTS { ..., version (sdVer2),
digestAlgorithms (WITH COMPONENTS { ..., daSequence PRESENT }),
certificates (WITH COMPONENTS { ..., certSet ABSENT }),
crls (WITH COMPONENTS { ..., crlSet ABSENT }),
signerInfos (WITH COMPONENTS { ..., siSequence PRESENT })
})
SignerInfos ::= CHOICE {
siSet SET OF SignerInfo,
siSequence SEQUENCE OF SignerInfo
}
DigestAlgorithmIdentifiers ::= CHOICE {
daSet SET OF DigestAlgorithmIdentifier,
daSequence SEQUENCE OF DigestAlgorithmIdentifier
}
SignerInfo ::= SEQUENCE {
-- version INTEGER {siVer1(1), siVer2(2)} (siVer1 | siVer2),
version INTEGER {siVer1(1), siVer2(2)},
issuerAndSerialNumber
IssuerAndSerialNumber,
digestAlgorithm DigestAlgorithmIdentifier,
authenticatedAttributes CHOICE {
aaSet [0] IMPLICIT SET OF AttributePKCS-7 {{Authenticated}},
aaSequence [2] EXPLICIT SEQUENCE OF AttributePKCS-7 {{Authenticated}}
-- Explicit because easier to compute digest on sequence of attributes and then reuse
-- encoded sequence in aaSequence.
} OPTIONAL,
digestEncryptionAlgorithm
DigestEncryptionAlgorithmIdentifier,
encryptedDigest EncryptedDigest,
unauthenticatedAttributes CHOICE {
uaSet [1] IMPLICIT SET OF AttributePKCS-7 {{Unauthenticated}},
uaSequence [3] IMPLICIT SEQUENCE OF AttributePKCS-7 {{Unauthenticated}}
} OPTIONAL
} (WITH COMPONENTS { ..., version (siVer1),
authenticatedAttributes (WITH COMPONENTS { ..., aaSequence ABSENT }),
unauthenticatedAttributes (WITH COMPONENTS { ..., uaSequence ABSENT })
} | WITH COMPONENTS { ..., version (siVer2),
authenticatedAttributes (WITH COMPONENTS { ..., aaSet ABSENT }),
unauthenticatedAttributes (WITH COMPONENTS { ..., uaSet ABSENT })
})
Authenticated ATTRIBUTE ::= {
contentType |
messageDigest,
..., -- add application-specific attributes here
signingTime
}
Unauthenticated ATTRIBUTE ::= {
contentType |
messageDigest,
..., -- add application-specific attributes here
counterSignature
-- ..., add application-specific attributes here
-- counterSignature
}
EncryptedDigest ::= OCTET STRING
DigestInfo ::= SEQUENCE {
digestAlgorithm DigestAlgorithmIdentifier,
digest Digest
}
Digest ::= OCTET STRING
--
-- 10. Enveloped-data content type
--
EnvelopedData ::= SEQUENCE {
-- version INTEGER {edVer0(0), edVer1(1)} (edVer0 | edVer1),
version INTEGER {edVer0(0), edVer1(1)},
recipientInfos RecipientInfos,
encryptedContentInfo
EncryptedContentInfo
} (WITH COMPONENTS { ..., version (edVer0),
recipientInfos (WITH COMPONENTS { ..., riSet PRESENT })
} | WITH COMPONENTS { ..., version (edVer1),
recipientInfos (WITH COMPONENTS { ..., riSequence PRESENT })
})
RecipientInfos ::= CHOICE {
riSet SET OF RecipientInfo,
riSequence SEQUENCE OF RecipientInfo
}
EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm
ContentEncryptionAlgorithmIdentifier,
encryptedContent
[0] IMPLICIT EncryptedContent OPTIONAL
}
EncryptedContent ::= OCTET STRING
RecipientInfo ::= SEQUENCE {
-- version INTEGER {riVer0(0)} (riVer0),
version INTEGER {riVer0(0)},
issuerAndSerialNumber
IssuerAndSerialNumber,
keyEncryptionAlgorithm
KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey
}
EncryptedKey ::= OCTET STRING
--
-- 11. Signed-and-enveloped-data content type
--
SignedAndEnvelopedData ::= SEQUENCE {
-- version INTEGER {seVer1(1), seVer2(2)} (seVer1 | seVer2),
version INTEGER {seVer1(1), seVer2(2)},
recipientInfos RecipientInfos,
digestAlgorithms
DigestAlgorithmIdentifiers,
encryptedContentInfo
EncryptedContentInfo,
certificates CHOICE {
certSet [0] IMPLICIT ExtendedCertificatesAndCertificates,
certSequence [2] IMPLICIT Certificates
} OPTIONAL,
crls CHOICE {
crlSet [1] IMPLICIT CertificateRevocationLists,
crlSequence [3] IMPLICIT CRLSequence
} OPTIONAL,
signerInfos SignerInfos
} (WITH COMPONENTS { ..., version (seVer1),
recipientInfos (WITH COMPONENTS { ..., riSet PRESENT }),
digestAlgorithms (WITH COMPONENTS { ..., daSet PRESENT }),
certificates (WITH COMPONENTS { ..., certSequence ABSENT }),
crls (WITH COMPONENTS { ..., crlSequence ABSENT }),
signerInfos (WITH COMPONENTS { ..., siSet PRESENT })
} |
WITH COMPONENTS { ..., version (seVer2),
recipientInfos (WITH COMPONENTS { ..., riSequence PRESENT }),
digestAlgorithms (WITH COMPONENTS { ..., daSequence PRESENT }),
certificates (WITH COMPONENTS { ..., certSet ABSENT }),
crls (WITH COMPONENTS { ..., crlSet ABSENT }),
signerInfos (WITH COMPONENTS { ..., siSequence PRESENT })
})
--
-- 12. Digested-data content type
--pbeWithSHAAnd3-KeyTripleDES-CBC
DigestedData ::= SEQUENCE {
-- version INTEGER {ddVer0(0)} (ddVer0),
version INTEGER {ddVer0(0)},
digestAlgorithm DigestAlgorithmIdentifier,
contentInfo ContentInfo,
digest Digest
}
--
-- 13. Encrypted-data content type
--
EncryptedData ::= SEQUENCE {
-- version INTEGER {edVer0(0)} (edVer0),
version INTEGER {edVer0(0)},
encryptedContentInfo EncryptedContentInfo
}
--
-- 14. Object Identifiers
--
pkcs-7 OBJECT IDENTIFIER ::=
{ iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 7 }
data OBJECT IDENTIFIER ::= { pkcs-7 1 }
signedData OBJECT IDENTIFIER ::= { pkcs-7 2 }
envelopedData OBJECT IDENTIFIER ::= { pkcs-7 3 }
signedAndEnvelopedData OBJECT IDENTIFIER ::= { pkcs-7 4 }
digestedData OBJECT IDENTIFIER ::= { pkcs-7 5 }
encryptedData OBJECT IDENTIFIER ::= { pkcs-7 6 }
END
|