aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/asn1/OTP-PKIX.asn1
blob: ff3250b383b2e777de1a4740dc19b1bc572035d3 (plain) (blame)
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
OTP-PKIX {iso(1) identified-organization(3) dod(6) internet(1)
	private(4) enterprices(1) ericsson(193) otp(19) ssl(10)
	pkix1(1)}

DEFINITIONS EXPLICIT TAGS ::=

BEGIN

-- EXPORTS ALL

IMPORTS
	-- Certificate (parts of)
	Version, 
	CertificateSerialNumber,
	--AlgorithmIdentifier,
	Validity,
	UniqueIdentifier,

	-- AttribyteTypeAndValue
	Name, 
	AttributeType, 	
	id-at-name,
	id-at-surname,
	id-at-givenName,
	id-at-initials,
	id-at-generationQualifier, X520name,
 	id-at-commonName, X520CommonName,
	id-at-localityName, X520LocalityName,
	id-at-stateOrProvinceName, X520StateOrProvinceName,
	id-at-organizationName, X520OrganizationName,
	id-at-organizationalUnitName, X520OrganizationalUnitName,
	id-at-title, X520Title,
	id-at-dnQualifier, X520dnQualifier,
	id-at-countryName, X520countryName,
	id-at-serialNumber, X520SerialNumber,
	id-at-pseudonym, X520Pseudonym,
	id-domainComponent, DomainComponent,
	id-emailAddress, EmailAddress,

	-- Extension Attributes
       common-name, CommonName,
       teletex-common-name, TeletexCommonName,
       teletex-personal-name, TeletexPersonalName,
       pds-name, PDSName,
       physical-delivery-country-name, PhysicalDeliveryCountryName,
       postal-code, PostalCode,
       physical-delivery-office-name, PhysicalDeliveryOfficeName,
       physical-delivery-office-number, PhysicalDeliveryOfficeNumber,
       extension-OR-address-components, ExtensionORAddressComponents,
       physical-delivery-personal-name, PhysicalDeliveryPersonalName,
       physical-delivery-organization-name, PhysicalDeliveryOrganizationName,
       extension-physical-delivery-address-components, 
              ExtensionPhysicalDeliveryAddressComponents,
       unformatted-postal-address, UnformattedPostalAddress,
       street-address, StreetAddress,
       post-office-box-address, PostOfficeBoxAddress,
       poste-restante-address,  PosteRestanteAddress,
       unique-postal-name, UniquePostalName,
       local-postal-attributes, LocalPostalAttributes,
       extended-network-address, ExtendedNetworkAddress,
       terminal-type, TerminalType,
       teletex-domain-defined-attributes, TeletexDomainDefinedAttributes

	FROM PKIX1Explicit88 { iso(1) identified-organization(3) dod(6) 
	     internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) 
	     id-pkix1-explicit(18) }

       -- Extensions
       id-ce-authorityKeyIdentifier, AuthorityKeyIdentifier,
       id-ce-subjectKeyIdentifier, SubjectKeyIdentifier,
       id-ce-keyUsage, KeyUsage,
       id-ce-privateKeyUsagePeriod, PrivateKeyUsagePeriod,
       id-ce-certificatePolicies, CertificatePolicies,
       id-ce-policyMappings, PolicyMappings,
       id-ce-subjectAltName, SubjectAltName,
       id-ce-issuerAltName, IssuerAltName,
       id-ce-subjectDirectoryAttributes, SubjectDirectoryAttributes,
       id-ce-basicConstraints, BasicConstraints,
       id-ce-nameConstraints, NameConstraints,
       id-ce-policyConstraints, PolicyConstraints,
       id-ce-cRLDistributionPoints, CRLDistributionPoints,
       id-ce-extKeyUsage, ExtKeyUsageSyntax,
       id-ce-inhibitAnyPolicy, InhibitAnyPolicy,
       id-ce-freshestCRL, FreshestCRL,
       id-pe-authorityInfoAccess, AuthorityInfoAccessSyntax,
       id-pe-subjectInfoAccess, SubjectInfoAccessSyntax,
       id-ce-cRLNumber, CRLNumber,
       id-ce-issuingDistributionPoint, IssuingDistributionPoint,
       id-ce-deltaCRLIndicator, BaseCRLNumber,
       id-ce-cRLReasons, CRLReason,
       id-ce-certificateIssuer, CertificateIssuer,
       id-ce-holdInstructionCode, HoldInstructionCode,
       id-ce-invalidityDate, InvalidityDate
       
       FROM PKIX1Implicit88 { iso(1) identified-organization(3) dod(6) 
       internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) 
       id-pkix1-implicit(19) }

	--Keys and Signatures
	id-dsa, Dss-Parms, DSAPublicKey,
	id-dsa-with-sha1, id-dsaWithSHA1,
        md2WithRSAEncryption,
	md5WithRSAEncryption,
	sha1WithRSAEncryption,
	rsaEncryption, RSAPublicKey,
	dhpublicnumber, DomainParameters, DHPublicKey, 
	id-keyExchangeAlgorithm, KEA-Parms-Id, --KEA-PublicKey,
	ecdsa-with-SHA1, ecdsa-with-SHA224,
	ecdsa-with-SHA256, ecdsa-with-SHA384, ecdsa-with-SHA512,
	prime-field, Prime-p, 
	characteristic-two-field, --Characteristic-two, 
	gnBasis, 
	tpBasis, Trinomial,
	ppBasis, Pentanomial,
	id-ecPublicKey, EcpkParameters, ECParameters, ECPoint
	FROM PKIX1Algorithms88 { iso(1) identified-organization(3) dod(6)
	     internet(1) security(5) mechanisms(5) pkix(7) id-mod(0)
	     id-mod-pkix1-algorithms(17) }
       md2WithRSAEncryption,
       md5WithRSAEncryption,
       sha1WithRSAEncryption,
       sha224WithRSAEncryption,
       sha256WithRSAEncryption,
       sha384WithRSAEncryption,
       sha512WithRSAEncryption	     
    	     
      FROM PKCS-1 {
       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)
        modules(0) pkcs-1(1)
	};	   
	     
--
-- Certificate
--

OTPCertificate  ::=  SEQUENCE  {
     tbsCertificate       OTPTBSCertificate,
     signatureAlgorithm   SignatureAlgorithm,
     signature            BIT STRING  }

OTPTBSCertificate  ::=  SEQUENCE  {
     version         [0]  Version DEFAULT v1,
     serialNumber         CertificateSerialNumber,
     signature            SignatureAlgorithm,
     issuer               Name,
     validity             Validity,
     subject              Name,
     subjectPublicKeyInfo OTPSubjectPublicKeyInfo,
     issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
                          -- If present, version MUST be v2 or v3
     subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
                          -- If present, version MUST be v2 or v3
     extensions      [3]  Extensions OPTIONAL
                          -- If present, version MUST be v3 --  }


-- Attribute type and values
--

ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= CLASS {
	&id AttributeType UNIQUE,
	&Type }
   WITH SYNTAX {
	ID &id
	TYPE &Type }
	
OTPAttributeTypeAndValue ::=  SEQUENCE {
        type    ATTRIBUTE-TYPE-AND-VALUE-CLASS.&id
		({SupportedAttributeTypeAndValues}),
        value   ATTRIBUTE-TYPE-AND-VALUE-CLASS.&Type
		({SupportedAttributeTypeAndValues}{@type}) }

SupportedAttributeTypeAndValues ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= 
	{ name | surname | givenName | initials | generationQualifier |
	  commonName | localityName | stateOrProvinceName | organizationName |
	  organizationalUnitName | title | dnQualifier | countryName |
	  serialNumber | pseudonym | domainComponent | emailAddress }

name ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-name
	TYPE X520name }

surname ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-surname
	TYPE X520name }

givenName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-givenName
	TYPE X520name }

initials ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-initials
	TYPE X520name }

generationQualifier ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-generationQualifier
	TYPE X520name }

commonName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-commonName
	TYPE X520CommonName }

localityName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-localityName
	TYPE X520LocalityName }

stateOrProvinceName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-stateOrProvinceName
	TYPE X520StateOrProvinceName }

organizationName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-organizationName
	TYPE X520OrganizationName }

organizationalUnitName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-organizationalUnitName
	TYPE X520OrganizationalUnitName }

title ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-title
	TYPE X520Title }

dnQualifier ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-dnQualifier
	TYPE X520dnQualifier }

countryName ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-countryName
        TYPE X520countryName } -- this is currently not used when decoding
 -- The decoding and mapping between ID and Type is done in the code
 -- in module publickey_cert_records via the function attribute_type
 -- To be more forgiving and compatible with other SSL implementations
 -- regarding how to handle and sometimes accept incorrect certificates
 -- we define and use the type below instead of X520countryName

 -- We accept utf8String encoding of the US-ASCII
 -- country name code and the mix up with other country code systems
 -- that uses three characters instead of two.

 OTP-X520countryname ::= CHOICE {
       printableString   PrintableString (SIZE (2..3)),
       utf8String        UTF8String      (SIZE (2..3))
}

serialNumber ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-serialNumber
	TYPE X520SerialNumber }

pseudonym ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-at-pseudonym
	TYPE X520Pseudonym }

domainComponent ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-domainComponent
	TYPE DomainComponent }

emailAddress ATTRIBUTE-TYPE-AND-VALUE-CLASS ::= {
	ID id-emailAddress
	TYPE EmailAddress } -- this is currently not used when decoding
 -- The decoding and mapping between ID and Type is done in the code
 -- in module publickey_cert_records via the function attribute_type
 -- To be more forgiving and compatible with other SSL implementations
 -- regarding how to handle and sometimes accept incorrect certificates
 -- we define and use the type below instead of emailAddress

 OTP-emailAddress ::= CHOICE {
       ia5String         IA5String       (SIZE (1..255)),
       utf8String        UTF8String      (SIZE (1..255))
}

--
-- Signature and Public Key Algorithms
--

OTPOLDSubjectPublicKeyInfo ::=  SEQUENCE  {
     algorithm SEQUENCE {
               algo     PUBLIC-KEY-ALGORITHM-CLASS.&id
			     ({SupportedPublicKeyAlgorithms}), 
	       parameters    PUBLIC-KEY-ALGORITHM-CLASS.&Type
			     ({SupportedPublicKeyAlgorithms}{@.algo}) 
			     OPTIONAL
               }, 
     subjectPublicKey  PUBLIC-KEY-ALGORITHM-CLASS.&PublicKeyType
		       ({SupportedPublicKeyAlgorithms}{@algorithm.algo}) }

OTPSubjectPublicKeyInfo ::=  SEQUENCE  {
      algorithm PublicKeyAlgorithm,
      subjectPublicKey  BIT STRING }


-- The following is needed for conversion of SubjectPublicKeyInfo.

OTPSubjectPublicKeyInfo-Any  ::=  SEQUENCE  {
     algorithm            PublicKeyAlgorithm,
     subjectPublicKey     ANY }


SIGNATURE-ALGORITHM-CLASS ::= CLASS {
	&id OBJECT IDENTIFIER UNIQUE,
	&Type OPTIONAL }
   WITH SYNTAX {
	ID &id
	[TYPE &Type] }

PUBLIC-KEY-ALGORITHM-CLASS ::= CLASS {
	&id OBJECT IDENTIFIER UNIQUE,
	&Type OPTIONAL,
	&PublicKeyType OPTIONAL }
   WITH SYNTAX {
	ID &id
	[TYPE &Type] 
	[PUBLIC-KEY-TYPE &PublicKeyType] }
	
SignatureAlgorithm ::=  SEQUENCE  {
     algorithm     SIGNATURE-ALGORITHM-CLASS.&id
				({SupportedSignatureAlgorithms}), 
     parameters    SIGNATURE-ALGORITHM-CLASS.&Type
				({SupportedSignatureAlgorithms}{@algorithm}) 
		   OPTIONAL } 

SignatureAlgorithm-Any ::=  SEQUENCE  {
     algorithm     OBJECT IDENTIFIER, 
     parameters    ANY OPTIONAL } 

PublicKeyAlgorithm ::=  SEQUENCE  {
     algorithm     PUBLIC-KEY-ALGORITHM-CLASS.&id
			({SupportedPublicKeyAlgorithms}), 
     parameters    PUBLIC-KEY-ALGORITHM-CLASS.&Type
			({SupportedPublicKeyAlgorithms}{@algorithm}) 
		   OPTIONAL } 

SupportedSignatureAlgorithms SIGNATURE-ALGORITHM-CLASS ::= { 
		    dsa-with-sha1 | dsaWithSHA1 |
		    dsa-with-sha224 |
		    dsa-with-sha256 |
		    md2-with-rsa-encryption |
		    md5-with-rsa-encryption |
		    sha1-with-rsa-encryption |
		    sha-1with-rsa-encryption |
		    sha224-with-rsa-encryption |
		    sha256-with-rsa-encryption |
		    sha384-with-rsa-encryption |
		    sha512-with-rsa-encryption |
		    ecdsa-with-sha1 |
		    ecdsa-with-sha224 |
		    ecdsa-with-sha256 |
		    ecdsa-with-sha384 |
		    ecdsa-with-sha512 }

SupportedPublicKeyAlgorithms PUBLIC-KEY-ALGORITHM-CLASS ::= { 
		    dsa | rsa-encryption | dh  | kea  | ec-public-key }

   --   DSA Keys and Signatures


      DSAParams  ::=  CHOICE
       {
        params     Dss-Parms,
        null       NULL
       }

   -- SubjectPublicKeyInfo:

   dsa PUBLIC-KEY-ALGORITHM-CLASS ::= {
       ID id-dsa
       TYPE DSAParams -- XXX Must be OPTIONAL
       PUBLIC-KEY-TYPE DSAPublicKey }

   -- Certificate.signatureAlgorithm

   dsa-with-sha1 SIGNATURE-ALGORITHM-CLASS ::= {
		 ID id-dsa-with-sha1
		 TYPE  DSAParams }


   dsaWithSHA1	 SIGNATURE-ALGORITHM-CLASS ::= {
		 ID id-dsaWithSHA1
		 TYPE  DSAParams }

   dsa-with-sha224 SIGNATURE-ALGORITHM-CLASS ::= {
		 ID id-dsa-with-sha224
		 TYPE  DSAParams }
	 
   dsa-with-sha256 SIGNATURE-ALGORITHM-CLASS ::= {
		 ID id-dsa-with-sha256
		 TYPE  DSAParams }

   id-dsa-with-sha224 OBJECT IDENTIFIER ::=  {
        joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101)
        csor(3) algorithms(4) id-dsa-with-sha2(3) 1 }

    id-dsa-with-sha256 OBJECT IDENTIFIER ::=  {
        joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101)
        csor(3) algorithms(4) id-dsa-with-sha2(3) 2 }
				  --
   --   RSA Keys and Signatures
   --

   -- Certificate.signatureAlgorithm

   md2-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			   ID md2WithRSAEncryption 
			   TYPE NULL }

   md5-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			   ID md5WithRSAEncryption 
			   TYPE NULL }

   sha1-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			    ID sha1WithRSAEncryption 
			    TYPE NULL }

   sha-1with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			    ID sha-1WithRSAEncryption
			    TYPE NULL }

   sha224-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			    ID sha224WithRSAEncryption 
			    TYPE NULL }

   sha256-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			    ID sha256WithRSAEncryption 
			    TYPE NULL }

   sha384-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			    ID sha384WithRSAEncryption 
			    TYPE NULL }
	    
   sha512-with-rsa-encryption SIGNATURE-ALGORITHM-CLASS ::= {
			    ID sha512WithRSAEncryption 
			    TYPE NULL }

   -- Certificate.signature
   -- See PKCS #1 (RFC 2313). XXX

   -- SubjectPublicKeyInfo:

   rsa-encryption PUBLIC-KEY-ALGORITHM-CLASS ::= {
		  ID rsaEncryption
		  TYPE NULL
		  PUBLIC-KEY-TYPE RSAPublicKey }

   --
   --   Diffie-Hellman Keys
   --

   -- SubjectPublicKeyInfo:

   dh PUBLIC-KEY-ALGORITHM-CLASS ::= {
      ID dhpublicnumber
      TYPE DomainParameters
      PUBLIC-KEY-TYPE DHPublicKey }

   -- There are no Diffie-Hellman signature algorithms

   --
   --   KEA Keys
   --

   -- SubjectPublicKeyInfo:

   KEA-PublicKey ::= INTEGER

   kea PUBLIC-KEY-ALGORITHM-CLASS ::= {
       ID id-keyExchangeAlgorithm
       TYPE KEA-Parms-Id
       PUBLIC-KEY-TYPE KEA-PublicKey }

   -- There are no KEA signature algorithms

   --
   --   Elliptic Curve Keys, Signatures, and Curves
   --

   -- Certificate.signatureAlgorithm

   ecdsa-with-sha1 SIGNATURE-ALGORITHM-CLASS ::= {
       ID ecdsa-with-SHA1
       TYPE EcpkParameters }  -- XXX Must be empty and not NULL

   ecdsa-with-sha224 SIGNATURE-ALGORITHM-CLASS ::= {
       ID ecdsa-with-SHA224
       TYPE EcpkParameters }  -- XXX Must be empty and not NULL

   ecdsa-with-sha256 SIGNATURE-ALGORITHM-CLASS ::= {
       ID ecdsa-with-SHA256
       TYPE EcpkParameters }  -- XXX Must be empty and not NULL

   ecdsa-with-sha384 SIGNATURE-ALGORITHM-CLASS ::= {
       ID ecdsa-with-SHA384
       TYPE EcpkParameters }  -- XXX Must be empty and not NULL

   ecdsa-with-sha512 SIGNATURE-ALGORITHM-CLASS ::= {
       ID ecdsa-with-SHA512
       TYPE EcpkParameters }  -- XXX Must be empty and not NULL

   FIELD-ID-CLASS ::= CLASS {
	&id OBJECT IDENTIFIER UNIQUE,
	&Type }
   WITH SYNTAX {
	ID &id
	TYPE &Type }

   OTPFieldID ::= SEQUENCE {                    -- Finite field
      fieldType   FIELD-ID-CLASS.&id({SupportedFieldIds}),
      parameters  FIELD-ID-CLASS.&Type({SupportedFieldIds}{@fieldType}) }

   SupportedFieldIds FIELD-ID-CLASS ::= {
		     field-prime-field | field-characteristic-two }

   field-prime-field FIELD-ID-CLASS ::= {
		     ID prime-field
		     TYPE Prime-p }

   CHARACTERISTIC-TWO-CLASS ::= CLASS {
	&id OBJECT IDENTIFIER UNIQUE,
	&Type }
   WITH SYNTAX {
	ID &id
	TYPE &Type }

   OTPCharacteristic-two ::= SEQUENCE {                    -- Finite field
      m           INTEGER,                   -- Field size 2^m
      basis       CHARACTERISTIC-TWO-CLASS.&id({SupportedCharacteristicTwos}),
      parameters  CHARACTERISTIC-TWO-CLASS.&Type
		  ({SupportedCharacteristicTwos}{@basis}) }

   SupportedCharacteristicTwos CHARACTERISTIC-TWO-CLASS ::= {
			       gn-basis | tp-basis | pp-basis }

   field-characteristic-two FIELD-ID-CLASS ::= {
		     ID characteristic-two-field
		     TYPE Characteristic-two }

   gn-basis CHARACTERISTIC-TWO-CLASS ::= {
	    ID gnBasis
	    TYPE NULL }

   tp-basis CHARACTERISTIC-TWO-CLASS ::= {
	    ID tpBasis
	    TYPE Trinomial }

   pp-basis CHARACTERISTIC-TWO-CLASS ::= {
	    ID ppBasis
	    TYPE Pentanomial }


   -- SubjectPublicKeyInfo.algorithm

   ec-public-key PUBLIC-KEY-ALGORITHM-CLASS ::= {
      ID id-ecPublicKey
      TYPE EcpkParameters
      PUBLIC-KEY-TYPE ECPoint }

--
-- Extension Attributes
--

EXTENSION-ATTRIBUTE-CLASS ::= CLASS {
	&id INTEGER UNIQUE, 
	&Type }
   WITH SYNTAX {
	ID &id
	TYPE &Type }
	
OTPExtensionAttributes ::= SET SIZE (1..MAX) OF ExtensionAttribute

-- XXX Below we should have extension-attribute-type and extension-
-- attribute-value but Erlang ASN1 does not like it. 
OTPExtensionAttribute ::=  SEQUENCE {
   extensionAttributeType [0] IMPLICIT EXTENSION-ATTRIBUTE-CLASS.&id
		({SupportedExtensionAttributes}),
   extensionAttributeValue [1] EXTENSION-ATTRIBUTE-CLASS.&Type
		({SupportedExtensionAttributes}{@extensionAttributeType}) } 

SupportedExtensionAttributes EXTENSION-ATTRIBUTE-CLASS ::= {
	     x400-common-name |
	     x400-teletex-common-name |
	     x400-teletex-personal-name |
	     x400-pds-name |
	     x400-physical-delivery-country-name |
	     x400-postal-code |
	     x400-physical-delivery-office-name |
	     x400-physical-delivery-office-number |
	     x400-extension-OR-address-components |
	     x400-physical-delivery-personal-name |
	     x400-physical-delivery-organization-name |
	     x400-extension-physical-delivery-address-components |
	     x400-unformatted-postal-address |
	     x400-street-address |
	     x400-post-office-box-address |
	     x400-poste-restante-address |
	     x400-unique-postal-name |
	     x400-local-postal-attributes |
	     x400-extended-network-address |
	     x400-terminal-type |
	     x400-teletex-domain-defined-attributes }

-- Extension types and attribute values

x400-common-name  EXTENSION-ATTRIBUTE-CLASS ::= {
       ID common-name
       TYPE CommonName }

x400-teletex-common-name  EXTENSION-ATTRIBUTE-CLASS ::= {
			  ID teletex-common-name
			  TYPE TeletexCommonName }

x400-teletex-personal-name  EXTENSION-ATTRIBUTE-CLASS ::= {
			    ID teletex-personal-name
			    TYPE TeletexPersonalName }

x400-pds-name  EXTENSION-ATTRIBUTE-CLASS ::= {
	       ID pds-name
	       TYPE PDSName }

x400-physical-delivery-country-name EXTENSION-ATTRIBUTE-CLASS ::= {
				    ID physical-delivery-country-name
				    TYPE PhysicalDeliveryCountryName }

x400-postal-code  EXTENSION-ATTRIBUTE-CLASS ::= {
		  ID postal-code
		  TYPE PostalCode }

x400-physical-delivery-office-name EXTENSION-ATTRIBUTE-CLASS ::= { 
				   ID physical-delivery-office-name 
				   TYPE PhysicalDeliveryOfficeName }

x400-physical-delivery-office-number EXTENSION-ATTRIBUTE-CLASS ::= {
				     ID physical-delivery-office-number
				     TYPE PhysicalDeliveryOfficeNumber }

x400-extension-OR-address-components EXTENSION-ATTRIBUTE-CLASS ::= {
				     ID extension-OR-address-components
				     TYPE ExtensionORAddressComponents }

x400-physical-delivery-personal-name EXTENSION-ATTRIBUTE-CLASS ::= {
				     ID physical-delivery-personal-name
				     TYPE PhysicalDeliveryPersonalName }

x400-physical-delivery-organization-name  EXTENSION-ATTRIBUTE-CLASS ::= {
       ID physical-delivery-organization-name
       TYPE PhysicalDeliveryOrganizationName }

x400-extension-physical-delivery-address-components 
    EXTENSION-ATTRIBUTE-CLASS ::= {
       ID extension-physical-delivery-address-components
       TYPE ExtensionPhysicalDeliveryAddressComponents }

x400-unformatted-postal-address  EXTENSION-ATTRIBUTE-CLASS ::= {
				 ID unformatted-postal-address
				 TYPE UnformattedPostalAddress }

x400-street-address  EXTENSION-ATTRIBUTE-CLASS ::= {
		     ID street-address
		     TYPE StreetAddress }

x400-post-office-box-address  EXTENSION-ATTRIBUTE-CLASS ::= {
			      ID post-office-box-address
			      TYPE PostOfficeBoxAddress }

x400-poste-restante-address EXTENSION-ATTRIBUTE-CLASS ::= {
			    ID poste-restante-address
			    TYPE PosteRestanteAddress }

x400-unique-postal-name EXTENSION-ATTRIBUTE-CLASS ::= {
			ID unique-postal-name
			TYPE UniquePostalName }

x400-local-postal-attributes EXTENSION-ATTRIBUTE-CLASS ::= {
			      ID local-postal-attributes
			      TYPE LocalPostalAttributes }

x400-extended-network-address EXTENSION-ATTRIBUTE-CLASS ::= {
       ID extended-network-address
       TYPE ExtendedNetworkAddress }

x400-terminal-type  EXTENSION-ATTRIBUTE-CLASS ::= {
		    ID terminal-type
		    TYPE TerminalType }

x400-teletex-domain-defined-attributes  EXTENSION-ATTRIBUTE-CLASS ::= {
       ID teletex-domain-defined-attributes
       TYPE TeletexDomainDefinedAttributes }

-- Extensions

OTPExtensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension

EXTENSION-CLASS ::= CLASS {
	&id OBJECT IDENTIFIER UNIQUE,
	&Type OPTIONAL}
   WITH SYNTAX {
	ID &id
	[TYPE &Type] }

OTPExtension ::=  SEQUENCE {
        extnID	  EXTENSION-CLASS.&id({SupportedExtensions}),
	critical  BOOLEAN DEFAULT FALSE,
        extnValue EXTENSION-CLASS.&Type({SupportedExtensions}{@extnID}) }

-- The following is needed for conversion between Extension and Extension-Cd

ObjId ::= OBJECT IDENTIFIER
Boolean ::= BOOLEAN
Any ::= ANY

Extension-Any  ::=  SEQUENCE  {
     extnID      OBJECT IDENTIFIER,
     critical    BOOLEAN DEFAULT FALSE,
     extnValue   ANY }

SupportedExtensions EXTENSION-CLASS ::= { authorityKeyIdentifier |
	subjectKeyIdentifier | keyUsage | privateKeyUsagePeriod |
	certificatePolicies | policyMappings | subjectAltName | 
	issuerAltName | subjectDirectoryAttributes | basicConstraints |
	nameConstraints | policyConstraints | cRLDistributionPoints | 
	extKeyUsage | inhibitAnyPolicy | freshestCRL | authorityInfoAccess |
	subjectInfoAccess | cRLNumber | issuingDistributionPoint |
	deltaCRLIndicator | cRLReasons | certificateIssuer |
	holdInstructionCode | invalidityDate }

authorityKeyIdentifier EXTENSION-CLASS ::= {
		ID id-ce-authorityKeyIdentifier
		TYPE AuthorityKeyIdentifier }

subjectKeyIdentifier EXTENSION-CLASS ::= {
	ID id-ce-subjectKeyIdentifier
	TYPE SubjectKeyIdentifier }

keyUsage EXTENSION-CLASS ::= {
	ID id-ce-keyUsage 
	TYPE KeyUsage }

privateKeyUsagePeriod EXTENSION-CLASS ::= {
	ID id-ce-privateKeyUsagePeriod
	TYPE PrivateKeyUsagePeriod }

certificatePolicies EXTENSION-CLASS ::= {
	ID id-ce-certificatePolicies
	TYPE CertificatePolicies }

policyMappings EXTENSION-CLASS ::= {
	ID id-ce-policyMappings
	TYPE PolicyMappings }

subjectAltName EXTENSION-CLASS ::= {
	ID id-ce-subjectAltName 
	TYPE SubjectAltName }

issuerAltName EXTENSION-CLASS ::= {
	ID id-ce-issuerAltName
	TYPE IssuerAltName }

subjectDirectoryAttributes EXTENSION-CLASS ::= {
	ID id-ce-subjectDirectoryAttributes
	TYPE SubjectDirectoryAttributes }

basicConstraints EXTENSION-CLASS ::= {
	ID id-ce-basicConstraints
	TYPE BasicConstraints }

nameConstraints EXTENSION-CLASS ::= {
	ID id-ce-nameConstraints
	TYPE NameConstraints }

policyConstraints EXTENSION-CLASS ::= {
	ID id-ce-policyConstraints 
	TYPE PolicyConstraints  }

cRLDistributionPoints EXTENSION-CLASS ::= {
	ID id-ce-cRLDistributionPoints
	TYPE CRLDistributionPoints }

extKeyUsage EXTENSION-CLASS ::= {
	ID id-ce-extKeyUsage
	TYPE ExtKeyUsageSyntax }

inhibitAnyPolicy EXTENSION-CLASS ::= {
	ID id-ce-inhibitAnyPolicy 
	TYPE InhibitAnyPolicy }

freshestCRL EXTENSION-CLASS ::= {
	ID id-ce-freshestCRL
	TYPE FreshestCRL }

authorityInfoAccess EXTENSION-CLASS ::= {
	ID id-pe-authorityInfoAccess
	TYPE AuthorityInfoAccessSyntax }

subjectInfoAccess EXTENSION-CLASS ::= {
	ID id-pe-subjectInfoAccess 
	TYPE SubjectInfoAccessSyntax }

cRLNumber EXTENSION-CLASS ::= {
	ID id-ce-cRLNumber 
	TYPE CRLNumber }

issuingDistributionPoint EXTENSION-CLASS ::= {
	ID id-ce-issuingDistributionPoint
	TYPE IssuingDistributionPoint }

deltaCRLIndicator EXTENSION-CLASS ::= {
	ID id-ce-deltaCRLIndicator
	TYPE BaseCRLNumber }

cRLReasons EXTENSION-CLASS ::= {
	ID id-ce-cRLReasons
	TYPE CRLReason }

certificateIssuer EXTENSION-CLASS ::= {
	ID id-ce-certificateIssuer
	TYPE CertificateIssuer }

holdInstructionCode EXTENSION-CLASS ::= {
	ID id-ce-holdInstructionCode
	TYPE HoldInstructionCode }

invalidityDate EXTENSION-CLASS ::= {
	ID id-ce-invalidityDate 
	TYPE InvalidityDate }

END