summaryrefslogtreecommitdiff
path: root/asn1/PKCS7.asn
blob: ac449b59c722aa974e42ee704fcafe8a641f5f12 (plain)
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
-- Module PKCS7 (X.420:06/1999)
-- The ASN.1 in version 1.5 of the PKCS#7 document is not defined in an ASN.1 module. This prevents an IMPORT of it into other ASN.1 modules.
-- This Annex contains a module of PKCS#7 ASN.1 definitions conforming to current ASN.1 standards rather than the obsolescent (and now deprecated) 1988/90 version of ASN.1 used in version 1.5 of PKCS#7.
-- Extensions to PKCS#7 defined in RFC 2630 are included.
-- If differences are found between the ASN.1 in the following module and that in PKCS#7, the latter is definitive.
PKCS7 {iso member-body usa(840) rsadsi(113549) pkcs(1) 7
  module(0) -- module not currently defined in PKCS#7 --} DEFINITIONS IMPLICIT
TAGS ::=
BEGIN

IMPORTS
  -- Directory Information Framework
  Attribute, Name
    --==
    FROM InformationFramework {joint-iso-itu-t ds(5) module(1)
      informationFramework(1) 3}
  -- Directory Authentication Framework
  AlgorithmIdentifier, AttributeCertificate, Certificate, CertificateList,
    CertificateSerialNumber, HASH{}, SIGNED{}
    --==
    FROM AuthenticationFramework {joint-iso-itu-t ds(5) module(1)
      authenticationFramework(7) 3};

-- In PKCS#7 the HASHED parameterised type applies the hash function to the 
-- contents octets component of a DER encoding of a value of the parameter.
-- The ENCRYPTED parameterised type is redefined here because PKCS#7 encrypted values are 
-- defined as OCTET STRING, instead of BIT STRING as in the Directory Authentication Framework
ENCRYPTED{ToBeEnciphered} ::=
  OCTET STRING
    (CONSTRAINED BY {
       -- must be the result of applying an encipherment procedure to the contents octets component 
       -- of a definite-length BER-encoding of a value of --ToBeEnciphered})

ContentInfo ::= SEQUENCE {
  content-type   PKCS7-CONTENT-TYPE.&id({PKCS7ContentTable}),
  pkcs7-content  [0]  PKCS7-CONTENT-TYPE.&Type({PKCS7ContentTable})
}

PKCS7-CONTENT-TYPE ::= TYPE-IDENTIFIER

PKCS7ContentTable PKCS7-CONTENT-TYPE ::=
  {data | signed-data | enveloped-data | signed-and-enveloped-data |
   digested-data | encrypted-data | authenticated-data, ...}

-- Data
data PKCS7-CONTENT-TYPE ::= {Data
                             IDENTIFIED BY  id-data
}

Data ::= OCTET STRING

-- Signed Data
signed-data PKCS7-CONTENT-TYPE ::= {SignedData
                                    IDENTIFIED BY  id-signed-data
}

SignedData ::= SEQUENCE {
  version           Version,
  digestAlgorithms  DigestAlgorithmIdentifiers,
  contentInfo       ContentInfo,
  certificates      [0]  CertificateSet OPTIONAL,
  crls              [1]  CertificateRevocationLists OPTIONAL,
  signerInfos       SignerInfos
}

Version ::= INTEGER

DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier

DigestAlgorithmIdentifier ::= AlgorithmIdentifier

CertificateSet ::= SET OF CertificateChoice

CertificateChoice ::= CHOICE {
  certificate           Certificate,
  extendedCertificate   [0]  ExtendedCertificate, -- Obsolete
  attributeCertificate  [1]  AttributeCertificate
}

CertificateRevocationLists ::= SET OF CertificateList

SignerInfos ::= SET OF SignerInfo

SignerInfo ::= SEQUENCE {
  version                    Version,
  signerIdentifier           SignerIdentifier,
  digestAlgorithm            DigestAlgorithmIdentifier,
  authenticatedAttributes    [0]  Attributes OPTIONAL,
  digestEncryptionAlgorithm  DigestEncryptionAlgorithmIdentifier,
  encryptedDigest            EncryptedDigest,
  unauthenticatedAttributes  [1]  Attributes OPTIONAL
}

SignerIdentifier ::= CHOICE {
  issuerAndSerialNumber  IssuerAndSerialNumber,
  subjectKeyIdentifier   [2]  SubjectKeyIdentifier
}

IssuerAndSerialNumber ::= SEQUENCE {
  issuer        Name,
  serialNumber  CertificateSerialNumber
}

SubjectKeyIdentifier ::= OCTET STRING

DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier

EncryptedDigest ::= ENCRYPTED{DigestInfo}

DigestInfo ::= SEQUENCE {
  digestAlgorithm  DigestAlgorithmIdentifier,
  digest           Digest
}

Digest ::=
  HASH
    {CHOICE {content
               [1]  PKCS7-CONTENT-TYPE.&Type({PKCS7ContentTable}),
             authenticated-attributes  [0] EXPLICIT Attributes}}

-- Enveloped Data
enveloped-data PKCS7-CONTENT-TYPE ::= {
  EnvelopedData
  IDENTIFIED BY  id-enveloped-data
}

EnvelopedData ::= SEQUENCE {
  version                Version,
  originatorInfo         [0]  OriginatorInfo OPTIONAL,
  recipientInfos         RecipientInfos,
  encryptedContentInfo   EncryptedContentInfo,
  unprotectedAttributes  [1]  Attributes OPTIONAL
}

OriginatorInfo ::= SEQUENCE {
  certificates  [0]  CertificateSet OPTIONAL,
  crls          [1]  CertificateRevocationLists OPTIONAL
}

RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo

RecipientInfo ::= CHOICE {
  keyTransportRecipientInfo      KeyTransportRecipientInfo,
  keyAgreementRecipientInfo      [1]  KeyAgreementRecipientInfo,
  keyEncryptionKeyRecipientInfo  [2]  KeyEncryptionKeyRecipientInfo
}

KeyTransportRecipientInfo ::= SEQUENCE {
  version                 Version,
  recipientIdentifier     RecipientIdentifier,
  keyEncryptionAlgorithm  KeyEncryptionAlgorithmIdentifier,
  encryptedKey            EncryptedKey
}

RecipientIdentifier ::= CHOICE {
  issuerAndSerialNumber  IssuerAndSerialNumber,
  subjectKeyIdentifier   [0]  SubjectKeyIdentifier
}

KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier

EncryptedKey ::= OCTET STRING

KeyAgreementRecipientInfo ::= SEQUENCE {
  version                 Version,
  originator              [0]  OriginatorIdentifierOrKey,
  userKeyingMaterial      [1] EXPLICIT OCTET STRING OPTIONAL,
  keyEncryptionAlgorithm  KeyEncryptionAlgorithmIdentifier,
  recipientEncryptedKeys  RecipientEncryptedKeys
}

OriginatorIdentifierOrKey ::= CHOICE {
  issuerAndSerialNumber  IssuerAndSerialNumber,
  subjectKeyIdentifier   [0]  SubjectKeyIdentifier,
  originatorPublicKey    [1]  OriginatorPublicKey
}

OriginatorPublicKey ::= SEQUENCE {
  algorithm  AlgorithmIdentifier,
  publicKey  BIT STRING
}

RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey

RecipientEncryptedKey ::= SEQUENCE {
  recipientIdentifier  KeyAgreementRecipientIdentifier,
  encryptedKey         EncryptedKey
}

KeyAgreementRecipientIdentifier ::= CHOICE {
  issuerAndSerialNumber   IssuerAndSerialNumber,
  recipientKeyIdentifier  [0]  RecipientKeyIdentifier
}

RecipientKeyIdentifier ::= SEQUENCE {
  subjectKeyIdentifier  SubjectKeyIdentifier,
  date                  GeneralizedTime OPTIONAL,
  otherKeyAttribute     OtherKeyAttribute OPTIONAL
}

OtherKeyAttribute ::= SEQUENCE {
  keyAttributeIdentifier  OTHER-KEY-ATTRIBUTE.&id({OtherKeyAttributeTable}),
  keyAttribute
    OTHER-KEY-ATTRIBUTE.&Type
      ({OtherKeyAttributeTable}{@keyAttributeIdentifier}) OPTIONAL
}

OTHER-KEY-ATTRIBUTE ::= TYPE-IDENTIFIER

OtherKeyAttributeTable OTHER-KEY-ATTRIBUTE ::=
  {...}

KeyEncryptionKeyRecipientInfo ::= SEQUENCE {
  version                     Version,
  keyEncryptionKeyIdentifier  KeyEncryptionKeyIdentifier,
  keyEncryptionAlgorithm      KeyEncryptionAlgorithmIdentifier,
  encryptedKey                EncryptedKey
}

KeyEncryptionKeyIdentifier ::= SEQUENCE {
  keyIdentifier      OCTET STRING,
  date               GeneralizedTime OPTIONAL,
  otherKeyAttribute  OtherKeyAttribute OPTIONAL
}

EncryptedContentInfo ::= SEQUENCE {
  contentType                 PKCS7-CONTENT-TYPE.&id({PKCS7ContentTable}),
  contentEncryptionAlgorithm  ContentEncryptionAlgorithmIdentifier,
  encryptedContent
    [0]  ENCRYPTED{PKCS7-CONTENT-TYPE.&Type({PKCS7ContentTable}{@.contentType})}
      OPTIONAL
}

ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier

-- Signed and Enveloped Data
signed-and-enveloped-data PKCS7-CONTENT-TYPE ::= {
  SignedAndEnvelopedData
  IDENTIFIED BY  id-signed-and-enveloped-data
}

SignedAndEnvelopedData ::= SEQUENCE {
  version               Version,
  recipientInfos        SET SIZE (1..MAX) OF KeyTransportRecipientInfo,
  digestAlgorithms      DigestAlgorithmIdentifiers,
  encryptedContentInfo  EncryptedContentInfo,
  certificates          [0]  CertificateSet OPTIONAL,
  crls                  [1]  CertificateRevocationLists OPTIONAL,
  signerInfos
    SET SIZE (1..MAX) OF
      SignerInfo
        (WITH COMPONENTS {
           ...,
           signerIdentifier           (WITH COMPONENTS {
                                         issuerAndSerialNumber  PRESENT
                                       }),
           authenticatedAttributes    ABSENT,
           unauthenticatedAttributes  ABSENT
         })
}

-- Digested Data
digested-data PKCS7-CONTENT-TYPE ::= {
  DigestedData
  IDENTIFIED BY  id-digested-data
}

DigestedData ::= SEQUENCE {
  version          Version,
  digestAlgorithm  DigestAlgorithmIdentifier,
  contentInfo      ContentInfo,
  digest           HASH{PKCS7-CONTENT-TYPE.&Type({PKCS7ContentTable})}
}

-- Encrypted Data
encrypted-data PKCS7-CONTENT-TYPE ::= {
  EncryptedData
  IDENTIFIED BY  id-encrypted-data
}

EncryptedData ::= SEQUENCE {
  version                Version,
  encryptedContentInfo   EncryptedContentInfo,
  unprotectedAttributes  [1]  Attributes OPTIONAL
}

-- Authenticated Data
authenticated-data PKCS7-CONTENT-TYPE ::= {
  AuthenticatedData
  IDENTIFIED BY  id-authenticated-data
}

AuthenticatedData ::= SEQUENCE {
  version                    Version,
  originatorInfo             [0]  OriginatorInfo OPTIONAL,
  recipientInfos             RecipientInfos,
  macAlgorithm               MessageAuthenticationCodeAlgorithmIdentifier,
  digestAlgorithm            [1]  DigestAlgorithmIdentifier OPTIONAL,
  contentInfo                ContentInfo,
  authenticatedAttributes    [2]  Attributes OPTIONAL,
  messageAuthenticationCode  MessageAuthenticationCode,
  unauthenticatedAttributes  [3]  Attributes OPTIONAL
}

MessageAuthenticationCodeAlgorithmIdentifier ::= AlgorithmIdentifier

MessageAuthenticationCode ::= OCTET STRING

-- Object Identifiers
id-pkcs OBJECT IDENTIFIER ::=
  {iso member-body usa(840) rsadsi(113549) pkcs(1)}

id-data OBJECT IDENTIFIER ::= {id-pkcs 7 1}

id-signed-data OBJECT IDENTIFIER ::= {id-pkcs 7 2}

id-enveloped-data OBJECT IDENTIFIER ::= {id-pkcs 7 3}

id-signed-and-enveloped-data OBJECT IDENTIFIER ::= {id-pkcs 7 4}

id-digested-data OBJECT IDENTIFIER ::= {id-pkcs 7 5}

id-encrypted-data OBJECT IDENTIFIER ::= {id-pkcs 7 6}

id-authenticated-data OBJECT IDENTIFIER ::= {id-pkcs 9 16 1 2}

-- Definitions from PKCS#6
ExtendedCertificate ::=
  SIGNED{ExtendedCertificateInfo}

ExtendedCertificateInfo ::= SEQUENCE {
  version      Version,
  certificate  Certificate,
  attributes   Attributes
}

Attributes ::= SET OF Attribute

END -- of PKCS#7

-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D