Tizen 2.0 Release
[external/libgnutls26.git] / lib / pkix.asn
1
2 PKIX1 { }
3
4 DEFINITIONS IMPLICIT TAGS ::=
5
6 BEGIN
7
8 -- This contains both PKIX1Implicit88 and RFC2630 ASN.1 modules.
9
10 id-pkix  OBJECT IDENTIFIER  ::=
11          { iso(1) identified-organization(3) dod(6) internet(1)
12                     security(5) mechanisms(5) pkix(7) }
13
14 -- ISO arc for standard certificate and CRL extensions
15
16 -- authority key identifier OID and syntax
17
18 AuthorityKeyIdentifier ::= SEQUENCE {
19       keyIdentifier             [0] KeyIdentifier            OPTIONAL,
20       authorityCertIssuer       [1] GeneralNames             OPTIONAL,
21       authorityCertSerialNumber [2] CertificateSerialNumber  OPTIONAL }
22     -- authorityCertIssuer and authorityCertSerialNumber shall both
23     -- be present or both be absgent
24
25 KeyIdentifier ::= OCTET STRING
26
27 -- subject key identifier OID and syntax
28
29 SubjectKeyIdentifier ::= KeyIdentifier
30
31 -- key usage extension OID and syntax
32
33 KeyUsage ::= BIT STRING
34
35 -- Directory string type --
36
37 DirectoryString ::= CHOICE {
38       teletexString             TeletexString (SIZE (1..MAX)),
39       printableString           PrintableString (SIZE (1..MAX)),
40       universalString           UniversalString (SIZE (1..MAX)),
41       utf8String              UTF8String (SIZE (1..MAX)),
42       bmpString               BMPString (SIZE(1..MAX)),
43       -- IA5String is added here to handle old UID encoded as ia5String --
44       -- See tests/userid/ for more information.  It shouldn't be here, --
45       -- so if it causes problems, considering dropping it. --
46       ia5String               IA5String (SIZE(1..MAX)) }
47
48 SubjectAltName ::= GeneralNames
49
50 GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
51
52 GeneralName ::= CHOICE {
53      otherName                       [0]     AnotherName,
54      rfc822Name                      [1]     IA5String,
55      dNSName                         [2]     IA5String,
56      x400Address                     [3]     ANY,
57 -- Changed to work with the libtasn1 parser.
58      directoryName                   [4]     EXPLICIT RDNSequence, --Name,
59      ediPartyName                    [5]     ANY, --EDIPartyName replaced by ANY to save memory
60      uniformResourceIdentifier       [6]     IA5String,
61      iPAddress                       [7]     OCTET STRING,
62      registeredID                    [8]     OBJECT IDENTIFIER }
63
64 -- AnotherName replaces OTHER-NAME ::= TYPE-IDENTIFIER, as
65 -- TYPE-IDENTIFIER is not supported in the '88 ASN.1 syntax
66
67 AnotherName ::= SEQUENCE {
68      type-id    OBJECT IDENTIFIER,
69      value      [0] EXPLICIT ANY DEFINED BY type-id }
70
71 -- issuer alternative name extension OID and syntax
72
73 IssuerAltName ::= GeneralNames
74
75 -- basic constraints extension OID and syntax
76
77 BasicConstraints ::= SEQUENCE {
78      cA                      BOOLEAN DEFAULT FALSE,
79      pathLenConstraint       INTEGER (0..MAX) OPTIONAL }
80
81 -- CRL distribution points extension OID and syntax
82
83 CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint
84
85 DistributionPoint ::= SEQUENCE {
86      distributionPoint       [0]     EXPLICIT DistributionPointName OPTIONAL,
87      reasons                 [1]     ReasonFlags OPTIONAL,
88      cRLIssuer               [2]     GeneralNames OPTIONAL
89 }
90
91 DistributionPointName ::= CHOICE {
92     fullName                [0]     GeneralNames,
93     nameRelativeToCRLIssuer [1]     RelativeDistinguishedName 
94 }
95
96 ReasonFlags ::= BIT STRING
97
98 -- extended key usage extension OID and syntax
99
100 ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
101
102 KeyPurposeId ::= OBJECT IDENTIFIER
103
104 -- CRL number extension OID and syntax
105
106 CRLNumber ::= INTEGER (0..MAX)
107
108 -- certificate issuer CRL entry extension OID and syntax
109
110 CertificateIssuer ::= GeneralNames
111
112 -- --------------------------------------
113 --  EXPLICIT
114 -- --------------------------------------
115
116 -- UNIVERSAL Types defined in '93 and '98 ASN.1
117 -- but required by this specification
118
119 NumericString ::= [UNIVERSAL 18] IMPLICIT OCTET STRING
120
121 IA5String ::= [UNIVERSAL 22] IMPLICIT OCTET STRING
122
123 TeletexString ::= [UNIVERSAL 20] IMPLICIT OCTET STRING
124
125 PrintableString ::= [UNIVERSAL 19] IMPLICIT OCTET STRING
126
127 UniversalString ::= [UNIVERSAL 28] IMPLICIT OCTET STRING
128         -- UniversalString is defined in ASN.1:1993
129
130 BMPString ::= [UNIVERSAL 30] IMPLICIT OCTET STRING
131       -- BMPString is the subtype of UniversalString and models
132        -- the Basic Multilingual Plane of ISO/IEC/ITU 10646-1
133
134 UTF8String ::= [UNIVERSAL 12] IMPLICIT OCTET STRING
135         -- The content of this type conforms to RFC 2279.
136
137
138 -- attribute data types --
139
140 Attribute       ::=     SEQUENCE {
141         type            AttributeType,
142         values  SET OF AttributeValue
143                 -- at least one value is required -- 
144 }
145
146 AttributeType           ::=   OBJECT IDENTIFIER
147
148 AttributeValue          ::=   ANY DEFINED BY type
149
150 AttributeTypeAndValue           ::=     SEQUENCE {
151         type    AttributeType,
152         value   AttributeValue }
153
154 -- suggested naming attributes: Definition of the following
155 --  information object set may be augmented to meet local
156 --  requirements.  Note that deleting members of the set may
157 --  prevent interoperability with conforming implementations.
158 --  presented in pairs: the AttributeType followed by the
159 --  type definition for the corresponding AttributeValue
160
161 -- Arc for standard naming attributes
162 id-at           OBJECT IDENTIFIER ::= {joint-iso-ccitt(2) ds(5) 4}
163
164 -- Attributes of type NameDirectoryString
165
166 -- gnutls: Note that the Object ID (id-at*) is being set just before the
167 -- actual definition. This is done in order for asn1_find_structure_from_oid
168 -- to work (locate structure from OID).
169 -- Maybe this is inefficient and memory consuming. Should we replace with
170 -- a table that maps OIDs to structures?
171
172 PostalAddress ::= SEQUENCE OF DirectoryString
173
174  -- Legacy attributes
175
176 emailAddress AttributeType      ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 1 }
177
178 Pkcs9email ::= IA5String (SIZE (1..ub-emailaddress-length))
179
180 -- naming data types --
181
182 Name            ::=   CHOICE { -- only one possibility for now --
183                                  rdnSequence  RDNSequence }
184
185 RDNSequence     ::=   SEQUENCE OF RelativeDistinguishedName
186
187 DistinguishedName       ::=   RDNSequence
188
189 RelativeDistinguishedName  ::=
190                     SET SIZE (1 .. MAX) OF AttributeTypeAndValue
191
192
193
194 -- --------------------------------------------------------
195 -- certificate and CRL specific structures begin here
196 -- --------------------------------------------------------
197
198 Certificate  ::=  SEQUENCE  {
199      tbsCertificate       TBSCertificate,
200      signatureAlgorithm   AlgorithmIdentifier,
201      signature            BIT STRING  }
202
203 TBSCertificate  ::=  SEQUENCE  {
204      version         [0]  EXPLICIT Version DEFAULT v1,
205      serialNumber         CertificateSerialNumber,
206      signature            AlgorithmIdentifier,
207      issuer               Name,
208      validity             Validity,
209      subject              Name,
210      subjectPublicKeyInfo SubjectPublicKeyInfo,
211      issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
212                           -- If present, version shall be v2 or v3
213      subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
214                           -- If present, version shall be v2 or v3
215      extensions      [3]  EXPLICIT Extensions OPTIONAL
216                           -- If present, version shall be v3 --  
217 }
218
219 Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
220
221 CertificateSerialNumber  ::=  INTEGER
222
223 Validity ::= SEQUENCE {
224      notBefore      Time,
225      notAfter       Time }
226
227 Time ::= CHOICE {
228      utcTime        UTCTime,
229      generalTime    GeneralizedTime }
230
231 UniqueIdentifier  ::=  BIT STRING
232
233 SubjectPublicKeyInfo  ::=  SEQUENCE  {
234      algorithm            AlgorithmIdentifier,
235      subjectPublicKey     BIT STRING  }
236
237 Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
238
239 Extension  ::=  SEQUENCE  {
240      extnID      OBJECT IDENTIFIER,
241      critical    BOOLEAN DEFAULT FALSE,
242      extnValue   OCTET STRING  }
243
244
245 -- ------------------------------------------
246 -- CRL structures
247 -- ------------------------------------------
248
249 CertificateList  ::=  SEQUENCE  {
250      tbsCertList          TBSCertList,
251      signatureAlgorithm   AlgorithmIdentifier,
252      signature            BIT STRING  }
253
254 TBSCertList  ::=  SEQUENCE  {
255      version                 Version OPTIONAL,
256                                   -- if present, shall be v2
257      signature               AlgorithmIdentifier,
258      issuer                  Name,
259      thisUpdate              Time,
260      nextUpdate              Time OPTIONAL,
261      revokedCertificates     SEQUENCE OF SEQUENCE  {
262           userCertificate         CertificateSerialNumber,
263           revocationDate          Time,
264           crlEntryExtensions      Extensions OPTIONAL
265                                          -- if present, shall be v2
266                                }  OPTIONAL,
267      crlExtensions           [0] EXPLICIT Extensions OPTIONAL
268                                          -- if present, shall be v2 -- 
269 }
270
271 -- Version, Time, CertificateSerialNumber, and Extensions were
272 -- defined earlier for use in the certificate structure
273
274 AlgorithmIdentifier  ::=  SEQUENCE  {
275      algorithm               OBJECT IDENTIFIER,
276      parameters              ANY DEFINED BY algorithm OPTIONAL  }
277                                 -- contains a value of the type
278                                 -- registered for use with the
279                                 -- algorithm object identifier value
280
281 -- Algorithm OIDs and parameter structures
282
283 Dss-Sig-Value ::= SEQUENCE {
284      r       INTEGER,
285      s       INTEGER  
286 }
287
288 DomainParameters ::= SEQUENCE {
289      p       INTEGER, -- odd prime, p=jq +1
290      g       INTEGER, -- generator, g
291      q       INTEGER, -- factor of p-1
292      j       INTEGER OPTIONAL, -- subgroup factor, j>= 2
293      validationParms  ValidationParms OPTIONAL }
294
295 ValidationParms ::= SEQUENCE {
296      seed             BIT STRING,
297      pgenCounter      INTEGER }
298
299 Dss-Parms  ::=  SEQUENCE  {
300      p             INTEGER,
301      q             INTEGER,
302      g             INTEGER  }
303
304 -- x400 address syntax starts here
305 --      OR Names
306
307 CountryName ::= [APPLICATION 1] CHOICE {
308    x121-dcc-code NumericString
309                 (SIZE (ub-country-name-numeric-length)),
310    iso-3166-alpha2-code PrintableString
311                 (SIZE (ub-country-name-alpha-length)) }
312
313 OrganizationName ::= PrintableString
314                             (SIZE (1..ub-organization-name-length))
315 -- see also teletex-organization-name
316
317 NumericUserIdentifier ::= NumericString
318                             (SIZE (1..ub-numeric-user-id-length))
319
320 -- see also teletex-personal-name
321
322 OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units)
323                                         OF OrganizationalUnitName
324 -- see also teletex-organizational-unit-names
325
326 OrganizationalUnitName ::= PrintableString (SIZE
327                         (1..ub-organizational-unit-name-length))
328
329 -- Extension types and attribute values
330 --
331
332 CommonName ::= PrintableString
333
334 -- END of PKIX1Implicit88
335
336
337 -- BEGIN of RFC2630
338
339 -- Cryptographic Message Syntax
340
341 pkcs-7-ContentInfo ::= SEQUENCE {
342   contentType pkcs-7-ContentType,
343   content [0] EXPLICIT ANY DEFINED BY contentType }
344
345 pkcs-7-DigestInfo ::= SEQUENCE {
346   digestAlgorithm pkcs-7-DigestAlgorithmIdentifier,
347   digest pkcs-7-Digest 
348 }
349
350 pkcs-7-Digest ::= OCTET STRING
351
352 pkcs-7-ContentType ::= OBJECT IDENTIFIER
353
354 pkcs-7-SignedData ::= SEQUENCE {
355   version pkcs-7-CMSVersion,
356   digestAlgorithms pkcs-7-DigestAlgorithmIdentifiers,
357   encapContentInfo pkcs-7-EncapsulatedContentInfo,
358   certificates [0] IMPLICIT pkcs-7-CertificateSet OPTIONAL,
359   crls [1] IMPLICIT pkcs-7-CertificateRevocationLists OPTIONAL,
360   signerInfos pkcs-7-SignerInfos 
361 }
362
363 pkcs-7-CMSVersion ::= INTEGER  { v0(0), v1(1), v2(2), v3(3), v4(4) }
364
365 pkcs-7-DigestAlgorithmIdentifiers ::= SET OF pkcs-7-DigestAlgorithmIdentifier
366
367 pkcs-7-DigestAlgorithmIdentifier ::= AlgorithmIdentifier
368
369 pkcs-7-EncapsulatedContentInfo ::= SEQUENCE {
370   eContentType pkcs-7-ContentType,
371   eContent [0] EXPLICIT OCTET STRING OPTIONAL }
372
373 -- We don't use CertificateList here since we only want
374 -- to read the raw data.
375 pkcs-7-CertificateRevocationLists ::= SET OF ANY
376
377 pkcs-7-CertificateChoices ::= CHOICE {
378 -- Although the paper uses Certificate type, we
379 -- don't use it since, we don't need to parse it.
380 -- We only need to read and store it.
381   certificate ANY
382 }
383
384 pkcs-7-CertificateSet ::= SET OF pkcs-7-CertificateChoices
385
386 pkcs-7-SignerInfos ::= SET OF ANY -- this is not correct but we don't use it
387  -- anyway
388
389
390 -- BEGIN of RFC2986
391
392 -- Certificate requests
393 pkcs-10-CertificationRequestInfo ::= SEQUENCE {
394      version       INTEGER { v1(0) },
395      subject       Name,
396      subjectPKInfo SubjectPublicKeyInfo,
397      attributes    [0] Attributes
398 }
399
400 Attributes ::= SET OF Attribute
401
402 pkcs-10-CertificationRequest ::= SEQUENCE {
403      certificationRequestInfo pkcs-10-CertificationRequestInfo,
404      signatureAlgorithm AlgorithmIdentifier,
405      signature          BIT STRING
406 }
407
408 -- stuff from PKCS#9
409
410 pkcs-9-at-challengePassword OBJECT IDENTIFIER   ::= {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 7}
411
412 pkcs-9-challengePassword        ::= CHOICE {
413       printableString       PrintableString,
414       utf8String            UTF8String }
415
416 pkcs-9-localKeyId ::= OCTET STRING
417
418 -- PKCS #8 stuff
419
420 -- Private-key information syntax
421
422 pkcs-8-PrivateKeyInfo ::= SEQUENCE {
423   version pkcs-8-Version,
424   privateKeyAlgorithm AlgorithmIdentifier,
425   privateKey pkcs-8-PrivateKey,
426   attributes [0] Attributes OPTIONAL }
427
428 pkcs-8-Version ::= INTEGER {v1(0)}
429
430 pkcs-8-PrivateKey ::= OCTET STRING
431
432 pkcs-8-Attributes ::= SET OF Attribute
433
434 -- Encrypted private-key information syntax
435
436 pkcs-8-EncryptedPrivateKeyInfo ::= SEQUENCE {
437     encryptionAlgorithm AlgorithmIdentifier,
438     encryptedData pkcs-8-EncryptedData 
439 }
440
441 pkcs-8-EncryptedData ::= OCTET STRING
442
443 -- PKCS #5 stuff
444
445 pkcs-5-des-EDE3-CBC-params ::= OCTET STRING (SIZE(8))
446 pkcs-5-aes128-CBC-params ::= OCTET STRING (SIZE(16))
447 pkcs-5-aes192-CBC-params ::= OCTET STRING (SIZE(16))
448 pkcs-5-aes256-CBC-params ::= OCTET STRING (SIZE(16))
449
450 pkcs-5-PBES2-params ::= SEQUENCE {
451   keyDerivationFunc AlgorithmIdentifier,
452   encryptionScheme AlgorithmIdentifier }
453
454 -- PBKDF2
455
456 -- pkcs-5-algid-hmacWithSHA1 AlgorithmIdentifier ::=
457 --   {algorithm pkcs-5-id-hmacWithSHA1, parameters NULL : NULL}
458
459 pkcs-5-PBKDF2-params ::= SEQUENCE {
460   salt CHOICE {
461     specified OCTET STRING,
462     otherSource AlgorithmIdentifier
463   },
464   iterationCount INTEGER (1..MAX),
465   keyLength INTEGER (1..MAX) OPTIONAL,
466   prf AlgorithmIdentifier OPTIONAL -- DEFAULT pkcs-5-id-hmacWithSHA1 
467 }
468
469 -- PKCS #12 stuff
470
471 pkcs-12-PFX ::= SEQUENCE {
472   version   INTEGER {v3(3)},
473   authSafe  pkcs-7-ContentInfo,
474   macData   pkcs-12-MacData OPTIONAL
475 }
476
477 pkcs-12-PbeParams ::= SEQUENCE {
478   salt        OCTET STRING,
479   iterations  INTEGER
480 }
481
482 pkcs-12-MacData ::= SEQUENCE {
483   mac         pkcs-7-DigestInfo,
484   macSalt     OCTET STRING,
485   iterations  INTEGER DEFAULT 1
486 -- Note: The default is for historical reasons and its use is
487 -- deprecated. A higher value, like 1024 is recommended.
488 }
489
490 pkcs-12-AuthenticatedSafe ::= SEQUENCE OF pkcs-7-ContentInfo
491   -- Data if unencrypted
492   -- EncryptedData if password-encrypted
493   -- EnvelopedData if public key-encrypted
494
495 pkcs-12-SafeContents ::= SEQUENCE OF pkcs-12-SafeBag
496
497 pkcs-12-SafeBag ::= SEQUENCE {
498   bagId          OBJECT IDENTIFIER,
499   bagValue       [0] EXPLICIT ANY DEFINED BY badId,
500   bagAttributes  SET OF pkcs-12-PKCS12Attribute OPTIONAL
501 }
502
503 -- Bag types
504
505 pkcs-12-KeyBag ::= pkcs-8-PrivateKeyInfo
506
507 -- Shrouded KeyBag
508
509 pkcs-12-PKCS8ShroudedKeyBag ::= pkcs-8-EncryptedPrivateKeyInfo
510
511 -- CertBag
512
513 pkcs-12-CertBag ::= SEQUENCE {
514   certId    OBJECT IDENTIFIER,
515   certValue [0] EXPLICIT ANY DEFINED BY certId
516 }
517
518 -- x509Certificate BAG-TYPE ::= {OCTET STRING IDENTIFIED BY {pkcs-9-certTypes 1}}
519 -- DER-encoded X.509 certificate stored in OCTET STRING
520
521 pkcs-12-CRLBag ::= SEQUENCE {
522   crlId     OBJECT IDENTIFIER,
523   crlValue  [0] EXPLICIT ANY DEFINED BY crlId
524 }
525
526 pkcs-12-SecretBag ::= SEQUENCE {
527   secretTypeId     OBJECT IDENTIFIER,
528   secretValue  [0] EXPLICIT ANY DEFINED BY secretTypeId
529 }
530
531 -- x509CRL BAG-TYPE ::= {OCTET STRING IDENTIFIED BY {pkcs-9-crlTypes 1}}
532 -- DER-encoded X.509 CRL stored in OCTET STRING
533
534 pkcs-12-PKCS12Attribute ::= Attribute
535
536 -- PKCS #7 stuff (needed in PKCS 12)
537
538 pkcs-7-Data ::= OCTET STRING
539
540 pkcs-7-EncryptedData ::= SEQUENCE {
541     version pkcs-7-CMSVersion,
542     encryptedContentInfo pkcs-7-EncryptedContentInfo,
543     unprotectedAttrs [1] IMPLICIT pkcs-7-UnprotectedAttributes OPTIONAL }
544
545 pkcs-7-EncryptedContentInfo ::= SEQUENCE {
546     contentType pkcs-7-ContentType,
547     contentEncryptionAlgorithm pkcs-7-ContentEncryptionAlgorithmIdentifier,
548     encryptedContent [0] IMPLICIT pkcs-7-EncryptedContent OPTIONAL }
549
550 pkcs-7-ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
551
552 pkcs-7-EncryptedContent ::= OCTET STRING
553
554 pkcs-7-UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
555
556 -- rfc3820
557
558 ProxyCertInfo ::= SEQUENCE {
559    pCPathLenConstraint  INTEGER (0..MAX) OPTIONAL,
560    proxyPolicy          ProxyPolicy }
561
562 ProxyPolicy ::= SEQUENCE {
563   policyLanguage   OBJECT IDENTIFIER,
564   policy           OCTET STRING OPTIONAL }
565
566 END