@small-tech/auto-encrypt 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
+ 'use strict';
2
+
1
3
  // Require @panva’s fork of ASN1 that’s already included as part of the Jose library.
2
4
  // https://github.com/panva/asn1.js/
3
- import asn1 from '@panva/asn1.js';
5
+ const asn1 = require('@panva/asn1.js');
4
6
 
5
7
  /**
6
8
  * RFC5280 X509 and Extension Definitions
@@ -11,6 +13,8 @@ import asn1 from '@panva/asn1.js';
11
13
  * stripped. There’s no reason to include the whole library again.)
12
14
  */
13
15
 
16
+ const rfc5280 = exports;
17
+
14
18
  // OIDs
15
19
  const x509OIDs = {
16
20
  '2 5 29 9': 'subjectDirectoryAttributes',
@@ -42,35 +46,38 @@ const x509OIDs = {
42
46
  // tbsCertList TBSCertList,
43
47
  // signatureAlgorithm AlgorithmIdentifier,
44
48
  // signature BIT STRING }
45
- export const CertificateList = asn1.define('CertificateList', function() {
49
+ const CertificateList = asn1.define('CertificateList', function() {
46
50
  this.seq().obj(
47
51
  this.key('tbsCertList').use(TBSCertList),
48
52
  this.key('signatureAlgorithm').use(AlgorithmIdentifier),
49
53
  this.key('signature').bitstr()
50
54
  );
51
55
  });
56
+ rfc5280.CertificateList = CertificateList;
52
57
 
53
58
  // AlgorithmIdentifier ::= SEQUENCE {
54
59
  // algorithm OBJECT IDENTIFIER,
55
60
  // parameters ANY DEFINED BY algorithm OPTIONAL }
56
- export const AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {
61
+ const AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {
57
62
  this.seq().obj(
58
63
  this.key('algorithm').objid(),
59
64
  this.key('parameters').optional().any()
60
65
  );
61
66
  });
67
+ rfc5280.AlgorithmIdentifier = AlgorithmIdentifier;
62
68
 
63
69
  // Certificate ::= SEQUENCE {
64
70
  // tbsCertificate TBSCertificate,
65
71
  // signatureAlgorithm AlgorithmIdentifier,
66
72
  // signature BIT STRING }
67
- export const Certificate = asn1.define('Certificate', function() {
73
+ const Certificate = asn1.define('Certificate', function() {
68
74
  this.seq().obj(
69
75
  this.key('tbsCertificate').use(TBSCertificate),
70
76
  this.key('signatureAlgorithm').use(AlgorithmIdentifier),
71
77
  this.key('signature').bitstr()
72
78
  );
73
79
  });
80
+ rfc5280.Certificate = Certificate;
74
81
 
75
82
  // TBSCertificate ::= SEQUENCE {
76
83
  // version [0] Version DEFAULT v1,
@@ -83,7 +90,7 @@ export const Certificate = asn1.define('Certificate', function() {
83
90
  // issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
84
91
  // subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
85
92
  // extensions [3] Extensions OPTIONAL
86
- export const TBSCertificate = asn1.define('TBSCertificate', function() {
93
+ const TBSCertificate = asn1.define('TBSCertificate', function() {
87
94
  this.seq().obj(
88
95
  this.key('version').def('v1').explicit(0).use(Version),
89
96
  this.key('serialNumber').int(),
@@ -97,45 +104,50 @@ export const TBSCertificate = asn1.define('TBSCertificate', function() {
97
104
  this.key('extensions').optional().explicit(3).seqof(Extension)
98
105
  );
99
106
  });
107
+ rfc5280.TBSCertificate = TBSCertificate;
100
108
 
101
109
  // Version ::= INTEGER { v1(0), v2(1), v3(2) }
102
- export const Version = asn1.define('Version', function() {
110
+ const Version = asn1.define('Version', function() {
103
111
  this.int({
104
112
  0: 'v1',
105
113
  1: 'v2',
106
114
  2: 'v3'
107
115
  });
108
116
  });
117
+ rfc5280.Version = Version;
109
118
 
110
119
  // Validity ::= SEQUENCE {
111
120
  // notBefore Time,
112
121
  // notAfter Time }
113
- export const Validity = asn1.define('Validity', function() {
122
+ const Validity = asn1.define('Validity', function() {
114
123
  this.seq().obj(
115
124
  this.key('notBefore').use(Time),
116
125
  this.key('notAfter').use(Time)
117
126
  );
118
127
  });
128
+ rfc5280.Validity = Validity;
119
129
 
120
130
  // Time ::= CHOICE {
121
131
  // utcTime UTCTime,
122
132
  // generalTime GeneralizedTime }
123
- export const Time = asn1.define('Time', function() {
133
+ const Time = asn1.define('Time', function() {
124
134
  this.choice({
125
135
  utcTime: this.utctime(),
126
136
  genTime: this.gentime()
127
137
  });
128
138
  });
139
+ rfc5280.Time = Time;
129
140
 
130
141
  // SubjectPublicKeyInfo ::= SEQUENCE {
131
142
  // algorithm AlgorithmIdentifier,
132
143
  // subjectPublicKey BIT STRING }
133
- export const SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() {
144
+ const SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() {
134
145
  this.seq().obj(
135
146
  this.key('algorithm').use(AlgorithmIdentifier),
136
147
  this.key('subjectPublicKey').bitstr()
137
148
  );
138
149
  });
150
+ rfc5280.SubjectPublicKeyInfo = SubjectPublicKeyInfo;
139
151
 
140
152
  // TBSCertList ::= SEQUENCE {
141
153
  // version Version OPTIONAL,
@@ -149,7 +161,7 @@ export const SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function
149
161
  // crlEntryExtensions Extensions OPTIONAL
150
162
  // } OPTIONAL,
151
163
  // crlExtensions [0] Extensions OPTIONAL }
152
- export const TBSCertList = asn1.define('TBSCertList', function() {
164
+ const TBSCertList = asn1.define('TBSCertList', function() {
153
165
  this.seq().obj(
154
166
  this.key('version').optional().int(),
155
167
  this.key('signature').use(AlgorithmIdentifier),
@@ -160,6 +172,7 @@ export const TBSCertList = asn1.define('TBSCertList', function() {
160
172
  this.key('crlExtensions').explicit(0).optional().seqof(Extension)
161
173
  );
162
174
  });
175
+ rfc5280.TBSCertList = TBSCertList;
163
176
 
164
177
  const RevokedCertificate = asn1.define('RevokedCertificate', function() {
165
178
  this.seq().obj(
@@ -173,7 +186,7 @@ const RevokedCertificate = asn1.define('RevokedCertificate', function() {
173
186
  // extnID OBJECT IDENTIFIER,
174
187
  // critical BOOLEAN DEFAULT FALSE,
175
188
  // extnValue OCTET STRING }
176
- export const Extension = asn1.define('Extension', function() {
189
+ const Extension = asn1.define('Extension', function() {
177
190
  this.seq().obj(
178
191
  this.key('extnID').objid(x509OIDs),
179
192
  this.key('critical').bool().def(false),
@@ -184,14 +197,16 @@ export const Extension = asn1.define('Extension', function() {
184
197
  })
185
198
  );
186
199
  });
200
+ rfc5280.Extension = Extension;
187
201
 
188
202
  // Name ::= CHOICE { -- only one possibility for now --
189
203
  // rdnSequence RDNSequence }
190
- export const Name = asn1.define('Name', function() {
204
+ const Name = asn1.define('Name', function() {
191
205
  this.choice({
192
206
  rdnSequence: this.use(RDNSequence)
193
207
  });
194
208
  });
209
+ rfc5280.Name = Name;
195
210
 
196
211
  // GeneralName ::= CHOICE {
197
212
  // otherName [0] AnotherName,
@@ -203,7 +218,7 @@ export const Name = asn1.define('Name', function() {
203
218
  // uniformResourceIdentifier [6] IA5String,
204
219
  // iPAddress [7] OCTET STRING,
205
220
  // registeredID [8] OBJECT IDENTIFIER }
206
- export const GeneralName = asn1.define('GeneralName', function() {
221
+ const GeneralName = asn1.define('GeneralName', function() {
207
222
  this.choice({
208
223
  otherName: this.implicit(0).use(AnotherName),
209
224
  rfc822Name: this.implicit(1).ia5str(),
@@ -215,73 +230,83 @@ export const GeneralName = asn1.define('GeneralName', function() {
215
230
  registeredID: this.implicit(8).objid()
216
231
  });
217
232
  });
233
+ rfc5280.GeneralName = GeneralName;
218
234
 
219
235
  // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
220
- export const GeneralNames = asn1.define('GeneralNames', function() {
236
+ const GeneralNames = asn1.define('GeneralNames', function() {
221
237
  this.seqof(GeneralName);
222
238
  });
239
+ rfc5280.GeneralNames = GeneralNames;
223
240
 
224
241
  // AnotherName ::= SEQUENCE {
225
242
  // type-id OBJECT IDENTIFIER,
226
243
  // value [0] EXPLICIT ANY DEFINED BY type-id }
227
- export const AnotherName = asn1.define('AnotherName', function() {
244
+ const AnotherName = asn1.define('AnotherName', function() {
228
245
  this.seq().obj(
229
246
  this.key('type-id').objid(),
230
247
  this.key('value').explicit(0).any()
231
248
  );
232
249
  });
250
+ rfc5280.AnotherName = AnotherName;
233
251
 
234
252
  // EDIPartyName ::= SEQUENCE {
235
253
  // nameAssigner [0] DirectoryString OPTIONAL,
236
254
  // partyName [1] DirectoryString }
237
- export const EDIPartyName = asn1.define('EDIPartyName', function() {
255
+ const EDIPartyName = asn1.define('EDIPartyName', function() {
238
256
  this.seq().obj(
239
257
  this.key('nameAssigner').implicit(0).optional().use(DirectoryString),
240
258
  this.key('partyName').implicit(1).use(DirectoryString)
241
259
  );
242
260
  });
261
+ rfc5280.EDIPartyName = EDIPartyName;
243
262
 
244
263
  // RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
245
- export const RDNSequence = asn1.define('RDNSequence', function() {
264
+ const RDNSequence = asn1.define('RDNSequence', function() {
246
265
  this.seqof(RelativeDistinguishedName);
247
266
  });
267
+ rfc5280.RDNSequence = RDNSequence;
248
268
 
249
269
  // RelativeDistinguishedName ::=
250
270
  // SET SIZE (1..MAX) OF AttributeTypeAndValue
251
- export const RelativeDistinguishedName = asn1.define('RelativeDistinguishedName',
271
+ const RelativeDistinguishedName = asn1.define('RelativeDistinguishedName',
252
272
  function() {
253
273
  this.setof(AttributeTypeAndValue);
254
274
  });
275
+ rfc5280.RelativeDistinguishedName = RelativeDistinguishedName;
255
276
 
256
277
  // AttributeTypeAndValue ::= SEQUENCE {
257
278
  // type AttributeType,
258
279
  // value AttributeValue }
259
- export const AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() {
280
+ const AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() {
260
281
  this.seq().obj(
261
282
  this.key('type').use(AttributeType),
262
283
  this.key('value').use(AttributeValue)
263
284
  );
264
285
  });
286
+ rfc5280.AttributeTypeAndValue = AttributeTypeAndValue;
265
287
 
266
288
  // Attribute ::= SEQUENCE {
267
289
  // type AttributeType,
268
290
  // values SET OF AttributeValue }
269
- export const Attribute = asn1.define('Attribute', function() {
291
+ const Attribute = asn1.define('Attribute', function() {
270
292
  this.seq().obj(
271
293
  this.key('type').use(AttributeType),
272
294
  this.key('values').setof(AttributeValue)
273
295
  );
274
296
  });
297
+ rfc5280.Attribute = Attribute;
275
298
 
276
299
  // AttributeType ::= OBJECT IDENTIFIER
277
- export const AttributeType = asn1.define('AttributeType', function() {
300
+ const AttributeType = asn1.define('AttributeType', function() {
278
301
  this.objid();
279
302
  });
303
+ rfc5280.AttributeType = AttributeType;
280
304
 
281
305
  // AttributeValue ::= ANY -- DEFINED BY AttributeType
282
- export const AttributeValue = asn1.define('AttributeValue', function() {
306
+ const AttributeValue = asn1.define('AttributeValue', function() {
283
307
  this.any();
284
308
  });
309
+ rfc5280.AttributeValue = AttributeValue;
285
310
 
286
311
  // DirectoryString ::= CHOICE {
287
312
  // teletexString TeletexString (SIZE (1..MAX)),
@@ -289,7 +314,7 @@ export const AttributeValue = asn1.define('AttributeValue', function() {
289
314
  // universalString UniversalString (SIZE (1..MAX)),
290
315
  // utf8String UTF8String (SIZE (1..MAX)),
291
316
  // bmpString BMPString (SIZE (1..MAX)) }
292
- export const DirectoryString = asn1.define('DirectoryString', function() {
317
+ const DirectoryString = asn1.define('DirectoryString', function() {
293
318
  this.choice({
294
319
  teletexString: this.t61str(),
295
320
  printableString: this.printstr(),
@@ -298,12 +323,13 @@ export const DirectoryString = asn1.define('DirectoryString', function() {
298
323
  bmpString: this.bmpstr()
299
324
  });
300
325
  });
326
+ rfc5280.DirectoryString = DirectoryString;
301
327
 
302
328
  // AuthorityKeyIdentifier ::= SEQUENCE {
303
329
  // keyIdentifier [0] KeyIdentifier OPTIONAL,
304
330
  // authorityCertIssuer [1] GeneralNames OPTIONAL,
305
331
  // authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL }
306
- export const AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() {
332
+ const AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() {
307
333
  this.seq().obj(
308
334
  this.key('keyIdentifier').implicit(0).optional().use(KeyIdentifier),
309
335
  this.key('authorityCertIssuer').implicit(1).optional().use(GeneralNames),
@@ -311,24 +337,27 @@ export const AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', func
311
337
  .use(CertificateSerialNumber)
312
338
  );
313
339
  });
340
+ rfc5280.AuthorityKeyIdentifier = AuthorityKeyIdentifier;
314
341
 
315
342
  // KeyIdentifier ::= OCTET STRING
316
- export const KeyIdentifier = asn1.define('KeyIdentifier', function() {
343
+ const KeyIdentifier = asn1.define('KeyIdentifier', function() {
317
344
  this.octstr();
318
345
  });
346
+ rfc5280.KeyIdentifier = KeyIdentifier;
319
347
 
320
348
  // CertificateSerialNumber ::= INTEGER
321
- export const CertificateSerialNumber = asn1.define('CertificateSerialNumber',
349
+ const CertificateSerialNumber = asn1.define('CertificateSerialNumber',
322
350
  function() {
323
351
  this.int();
324
352
  });
353
+ rfc5280.CertificateSerialNumber = CertificateSerialNumber;
325
354
 
326
355
  // ORAddress ::= SEQUENCE {
327
356
  // built-in-standard-attributes BuiltInStandardAttributes,
328
357
  // built-in-domain-defined-attributes BuiltInDomainDefinedAttributes
329
358
  // OPTIONAL,
330
359
  // extension-attributes ExtensionAttributes OPTIONAL }
331
- export const ORAddress = asn1.define('ORAddress', function() {
360
+ const ORAddress = asn1.define('ORAddress', function() {
332
361
  this.seq().obj(
333
362
  this.key('builtInStandardAttributes').use(BuiltInStandardAttributes),
334
363
  this.key('builtInDomainDefinedAttributes').optional()
@@ -336,6 +365,7 @@ export const ORAddress = asn1.define('ORAddress', function() {
336
365
  this.key('extensionAttributes').optional().use(ExtensionAttributes)
337
366
  );
338
367
  });
368
+ rfc5280.ORAddress = ORAddress;
339
369
 
340
370
  // BuiltInStandardAttributes ::= SEQUENCE {
341
371
  // country-name CountryName OPTIONAL,
@@ -347,7 +377,7 @@ export const ORAddress = asn1.define('ORAddress', function() {
347
377
  // numeric-user-identifier [4] IMPLICIT NumericUserIdentifier OPTIONAL,
348
378
  // personal-name [5] IMPLICIT PersonalName OPTIONAL,
349
379
  // organizational-unit-names [6] IMPLICIT OrganizationalUnitNames OPTIONAL }
350
- export const BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes',
380
+ const BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes',
351
381
  function() {
352
382
  this.seq().obj(
353
383
  this.key('countryName').optional().use(CountryName),
@@ -365,69 +395,79 @@ export const BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes'
365
395
  .use(OrganizationalUnitNames)
366
396
  );
367
397
  });
398
+ rfc5280.BuiltInStandardAttributes = BuiltInStandardAttributes;
368
399
 
369
400
  // CountryName ::= CHOICE {
370
401
  // x121-dcc-code NumericString,
371
402
  // iso-3166-alpha2-code PrintableString }
372
- export const CountryName = asn1.define('CountryName', function() {
403
+ const CountryName = asn1.define('CountryName', function() {
373
404
  this.choice({
374
405
  x121DccCode: this.numstr(),
375
406
  iso3166Alpha2Code: this.printstr()
376
407
  });
377
408
  });
409
+ rfc5280.CountryName = CountryName;
410
+
378
411
 
379
412
  // AdministrationDomainName ::= CHOICE {
380
413
  // numeric NumericString,
381
414
  // printable PrintableString }
382
- export const AdministrationDomainName = asn1.define('AdministrationDomainName',
415
+ const AdministrationDomainName = asn1.define('AdministrationDomainName',
383
416
  function() {
384
417
  this.choice({
385
418
  numeric: this.numstr(),
386
419
  printable: this.printstr()
387
420
  });
388
421
  });
422
+ rfc5280.AdministrationDomainName = AdministrationDomainName;
389
423
 
390
424
  // NetworkAddress ::= X121Address
391
- export const NetworkAddress = asn1.define('NetworkAddress', function() {
425
+ const NetworkAddress = asn1.define('NetworkAddress', function() {
392
426
  this.use(X121Address);
393
427
  });
428
+ rfc5280.NetworkAddress = NetworkAddress;
394
429
 
395
430
  // X121Address ::= NumericString
396
- export const X121Address = asn1.define('X121Address', function() {
431
+ const X121Address = asn1.define('X121Address', function() {
397
432
  this.numstr();
398
433
  });
434
+ rfc5280.X121Address = X121Address;
399
435
 
400
436
  // TerminalIdentifier ::= PrintableString
401
- export const TerminalIdentifier = asn1.define('TerminalIdentifier', function() {
437
+ const TerminalIdentifier = asn1.define('TerminalIdentifier', function() {
402
438
  this.printstr();
403
439
  });
440
+ rfc5280.TerminalIdentifier = TerminalIdentifier;
404
441
 
405
442
  // PrivateDomainName ::= CHOICE {
406
443
  // numeric NumericString,
407
444
  // printable PrintableString }
408
- export const PrivateDomainName = asn1.define('PrivateDomainName', function() {
445
+ const PrivateDomainName = asn1.define('PrivateDomainName', function() {
409
446
  this.choice({
410
447
  numeric: this.numstr(),
411
448
  printable: this.printstr()
412
449
  });
413
450
  });
451
+ rfc5280.PrivateDomainName = PrivateDomainName;
414
452
 
415
453
  // OrganizationName ::= PrintableString
416
- export const OrganizationName = asn1.define('OrganizationName', function() {
454
+ const OrganizationName = asn1.define('OrganizationName', function() {
417
455
  this.printstr();
418
456
  });
457
+ rfc5280.OrganizationName = OrganizationName;
419
458
 
420
459
  // NumericUserIdentifier ::= NumericString
421
- export const NumericUserIdentifier = asn1.define('NumericUserIdentifier', function() {
460
+ const NumericUserIdentifier = asn1.define('NumericUserIdentifier', function() {
422
461
  this.numstr();
423
462
  });
463
+ rfc5280.NumericUserIdentifier = NumericUserIdentifier;
424
464
 
425
465
  // PersonalName ::= SET {
426
466
  // surname [0] IMPLICIT PrintableString,
427
467
  // given-name [1] IMPLICIT PrintableString OPTIONAL,
428
468
  // initials [2] IMPLICIT PrintableString OPTIONAL,
429
469
  // generation-qualifier [3] IMPLICIT PrintableString OPTIONAL }
430
- export const PersonalName = asn1.define('PersonalName', function() {
470
+ const PersonalName = asn1.define('PersonalName', function() {
431
471
  this.set().obj(
432
472
  this.key('surname').implicit(0).printstr(),
433
473
  this.key('givenName').implicit(1).printstr(),
@@ -435,60 +475,69 @@ export const PersonalName = asn1.define('PersonalName', function() {
435
475
  this.key('generationQualifier').implicit(3).printstr()
436
476
  );
437
477
  });
478
+ rfc5280.PersonalName = PersonalName;
438
479
 
439
480
  // OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units)
440
481
  // OF OrganizationalUnitName
441
- export const OrganizationalUnitNames = asn1.define('OrganizationalUnitNames',
482
+ const OrganizationalUnitNames = asn1.define('OrganizationalUnitNames',
442
483
  function() {
443
484
  this.seqof(OrganizationalUnitName);
444
485
  });
486
+ rfc5280.OrganizationalUnitNames = OrganizationalUnitNames;
445
487
 
446
488
  // OrganizationalUnitName ::= PrintableString (SIZE
447
489
  // (1..ub-organizational-unit-name-length))
448
- export const OrganizationalUnitName = asn1.define('OrganizationalUnitName', function() {
490
+ const OrganizationalUnitName = asn1.define('OrganizationalUnitName', function() {
449
491
  this.printstr();
450
492
  });
493
+ rfc5280.OrganizationalUnitName = OrganizationalUnitName;
451
494
 
452
495
  // uiltInDomainDefinedAttributes ::= SEQUENCE SIZE
453
496
  // (1..ub-domain-defined-attributes)
454
497
  // OF BuiltInDomainDefinedAttribute
455
- export const BuiltInDomainDefinedAttributes = asn1.define(
498
+ const BuiltInDomainDefinedAttributes = asn1.define(
456
499
  'BuiltInDomainDefinedAttributes', function() {
457
500
  this.seqof(BuiltInDomainDefinedAttribute);
458
501
  });
502
+ rfc5280.BuiltInDomainDefinedAttributes = BuiltInDomainDefinedAttributes;
459
503
 
460
504
  // BuiltInDomainDefinedAttribute ::= SEQUENCE {
461
505
  // type PrintableString (SIZE (1..ub-domain-defined-attribute-type-length)),
462
506
  // value PrintableString (SIZE (1..ub-domain-defined-attribute-value-length))
463
507
  //}
464
- export const BuiltInDomainDefinedAttribute = asn1.define('BuiltInDomainDefinedAttribute',
508
+ const BuiltInDomainDefinedAttribute = asn1.define('BuiltInDomainDefinedAttribute',
465
509
  function() {
466
510
  this.seq().obj(
467
511
  this.key('type').printstr(),
468
512
  this.key('value').printstr()
469
513
  );
470
514
  });
515
+ rfc5280.BuiltInDomainDefinedAttribute = BuiltInDomainDefinedAttribute;
516
+
471
517
 
472
518
  // ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF
473
519
  // ExtensionAttribute
474
- export const ExtensionAttributes = asn1.define('ExtensionAttributes', function() {
520
+ const ExtensionAttributes = asn1.define('ExtensionAttributes', function() {
475
521
  this.seqof(ExtensionAttribute);
476
522
  });
523
+ rfc5280.ExtensionAttributes = ExtensionAttributes;
477
524
 
478
525
  // ExtensionAttribute ::= SEQUENCE {
479
526
  // extension-attribute-type [0] IMPLICIT INTEGER,
480
527
  // extension-attribute-value [1] ANY DEFINED BY extension-attribute-type }
481
- export const ExtensionAttribute = asn1.define('ExtensionAttribute', function() {
528
+ const ExtensionAttribute = asn1.define('ExtensionAttribute', function() {
482
529
  this.seq().obj(
483
530
  this.key('extensionAttributeType').implicit(0).int(),
484
531
  this.key('extensionAttributeValue').any().explicit(1).int()
485
532
  );
486
533
  });
534
+ rfc5280.ExtensionAttribute = ExtensionAttribute;
487
535
 
488
536
  // SubjectKeyIdentifier ::= KeyIdentifier
489
- export const SubjectKeyIdentifier = asn1.define('SubjectKeyIdentifier', function() {
537
+ const SubjectKeyIdentifier = asn1.define('SubjectKeyIdentifier', function() {
490
538
  this.use(KeyIdentifier);
491
539
  });
540
+ rfc5280.SubjectKeyIdentifier = SubjectKeyIdentifier;
492
541
 
493
542
  // KeyUsage ::= BIT STRING {
494
543
  // digitalSignature (0),
@@ -501,157 +550,179 @@ export const SubjectKeyIdentifier = asn1.define('SubjectKeyIdentifier', function
501
550
  // cRLSign (6),
502
551
  // encipherOnly (7),
503
552
  // decipherOnly (8) }
504
- export const KeyUsage = asn1.define('KeyUsage', function() {
553
+ const KeyUsage = asn1.define('KeyUsage', function() {
505
554
  this.bitstr();
506
555
  });
556
+ rfc5280.KeyUsage = KeyUsage;
507
557
 
508
558
  // CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
509
- export const CertificatePolicies = asn1.define('CertificatePolicies', function() {
559
+ const CertificatePolicies = asn1.define('CertificatePolicies', function() {
510
560
  this.seqof(PolicyInformation);
511
561
  });
562
+ rfc5280.CertificatePolicies = CertificatePolicies;
512
563
 
513
564
  // PolicyInformation ::= SEQUENCE {
514
565
  // policyIdentifier CertPolicyId,
515
566
  // policyQualifiers SEQUENCE SIZE (1..MAX) OF PolicyQualifierInfo
516
567
  // OPTIONAL }
517
- export const PolicyInformation = asn1.define('PolicyInformation', function() {
568
+ const PolicyInformation = asn1.define('PolicyInformation', function() {
518
569
  this.seq().obj(
519
570
  this.key('policyIdentifier').use(CertPolicyId),
520
571
  this.key('policyQualifiers').optional().use(PolicyQualifiers)
521
572
  );
522
573
  });
574
+ rfc5280.PolicyInformation = PolicyInformation;
523
575
 
524
576
  // CertPolicyId ::= OBJECT IDENTIFIER
525
- export const CertPolicyId = asn1.define('CertPolicyId', function() {
577
+ const CertPolicyId = asn1.define('CertPolicyId', function() {
526
578
  this.objid();
527
579
  });
580
+ rfc5280.CertPolicyId = CertPolicyId;
528
581
 
529
- export const PolicyQualifiers = asn1.define('PolicyQualifiers', function() {
582
+ const PolicyQualifiers = asn1.define('PolicyQualifiers', function() {
530
583
  this.seqof(PolicyQualifierInfo);
531
584
  });
585
+ rfc5280.PolicyQualifiers = PolicyQualifiers;
532
586
 
533
587
  // PolicyQualifierInfo ::= SEQUENCE {
534
588
  // policyQualifierId PolicyQualifierId,
535
589
  // qualifier ANY DEFINED BY policyQualifierId }
536
- export const PolicyQualifierInfo = asn1.define('PolicyQualifierInfo', function() {
590
+ const PolicyQualifierInfo = asn1.define('PolicyQualifierInfo', function() {
537
591
  this.seq().obj(
538
592
  this.key('policyQualifierId').use(PolicyQualifierId),
539
593
  this.key('qualifier').any()
540
594
  );
541
595
  });
596
+ rfc5280.PolicyQualifierInfo = PolicyQualifierInfo;
542
597
 
543
598
  // PolicyQualifierId ::= OBJECT IDENTIFIER
544
- export const PolicyQualifierId = asn1.define('PolicyQualifierId', function() {
599
+ const PolicyQualifierId = asn1.define('PolicyQualifierId', function() {
545
600
  this.objid();
546
601
  });
602
+ rfc5280.PolicyQualifierId = PolicyQualifierId;
547
603
 
548
604
  // PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
549
605
  // issuerDomainPolicy CertPolicyId,
550
606
  // subjectDomainPolicy CertPolicyId }
551
- export const PolicyMappings = asn1.define('PolicyMappings', function() {
607
+ const PolicyMappings = asn1.define('PolicyMappings', function() {
552
608
  this.seqof(PolicyMapping);
553
609
  });
610
+ rfc5280.PolicyMappings = PolicyMappings;
554
611
 
555
- export const PolicyMapping = asn1.define('PolicyMapping', function() {
612
+ const PolicyMapping = asn1.define('PolicyMapping', function() {
556
613
  this.seq().obj(
557
614
  this.key('issuerDomainPolicy').use(CertPolicyId),
558
615
  this.key('subjectDomainPolicy').use(CertPolicyId)
559
616
  );
560
617
  });
618
+ rfc5280.PolicyMapping = PolicyMapping;
561
619
 
562
620
  // SubjectAltName ::= GeneralNames
563
- export const SubjectAlternativeName = asn1.define('SubjectAlternativeName', function() {
621
+ const SubjectAlternativeName = asn1.define('SubjectAlternativeName', function() {
564
622
  this.use(GeneralNames);
565
623
  });
624
+ rfc5280.SubjectAlternativeName = SubjectAlternativeName;
566
625
 
567
626
  // IssuerAltName ::= GeneralNames
568
- export const IssuerAlternativeName = asn1.define('IssuerAlternativeName', function() {
627
+ const IssuerAlternativeName = asn1.define('IssuerAlternativeName', function() {
569
628
  this.use(GeneralNames);
570
629
  });
630
+ rfc5280.IssuerAlternativeName = IssuerAlternativeName;
571
631
 
572
632
  // SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
573
- export const SubjectDirectoryAttributes = asn1.define('SubjectDirectoryAttributes',
633
+ const SubjectDirectoryAttributes = asn1.define('SubjectDirectoryAttributes',
574
634
  function() {
575
635
  this.seqof(Attribute);
576
636
  });
637
+ rfc5280.SubjectDirectoryAttributes = SubjectDirectoryAttributes;
577
638
 
578
639
  // BasicConstraints ::= SEQUENCE {
579
640
  // cA BOOLEAN DEFAULT FALSE,
580
641
  // pathLenConstraint INTEGER (0..MAX) OPTIONAL }
581
- export const BasicConstraints = asn1.define('BasicConstraints', function() {
642
+ const BasicConstraints = asn1.define('BasicConstraints', function() {
582
643
  this.seq().obj(
583
644
  this.key('cA').bool().def(false),
584
645
  this.key('pathLenConstraint').optional().int()
585
646
  );
586
647
  });
648
+ rfc5280.BasicConstraints = BasicConstraints;
587
649
 
588
650
  // NameConstraints ::= SEQUENCE {
589
651
  // permittedSubtrees [0] GeneralSubtrees OPTIONAL,
590
652
  // excludedSubtrees [1] GeneralSubtrees OPTIONAL }
591
- export const NameConstraints = asn1.define('NameConstraints', function() {
653
+ const NameConstraints = asn1.define('NameConstraints', function() {
592
654
  this.seq().obj(
593
655
  this.key('permittedSubtrees').implicit(0).optional().use(GeneralSubtrees),
594
656
  this.key('excludedSubtrees').implicit(1).optional().use(GeneralSubtrees)
595
657
  );
596
658
  });
659
+ rfc5280.NameConstraints = NameConstraints;
597
660
 
598
661
  // GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
599
- export const GeneralSubtrees = asn1.define('GeneralSubtrees', function() {
662
+ const GeneralSubtrees = asn1.define('GeneralSubtrees', function() {
600
663
  this.seqof(GeneralSubtree);
601
664
  });
665
+ rfc5280.GeneralSubtrees = GeneralSubtrees;
602
666
 
603
667
  // GeneralSubtree ::= SEQUENCE {
604
668
  // base GeneralName,
605
669
  // minimum [0] BaseDistance DEFAULT 0,
606
670
  // maximum [1] BaseDistance OPTIONAL }
607
- export const GeneralSubtree = asn1.define('GeneralSubtree', function() {
671
+ const GeneralSubtree = asn1.define('GeneralSubtree', function() {
608
672
  this.seq().obj(
609
673
  this.key('base').use(GeneralName),
610
674
  this.key('minimum').implicit(0).def(0).use(BaseDistance),
611
675
  this.key('maximum').implicit(0).optional().use(BaseDistance)
612
676
  );
613
677
  });
678
+ rfc5280.GeneralSubtree = GeneralSubtree;
614
679
 
615
680
  // BaseDistance ::= INTEGER
616
- export const BaseDistance = asn1.define('BaseDistance', function() {
681
+ const BaseDistance = asn1.define('BaseDistance', function() {
617
682
  this.int();
618
683
  });
684
+ rfc5280.BaseDistance = BaseDistance;
619
685
 
620
686
  // PolicyConstraints ::= SEQUENCE {
621
687
  // requireExplicitPolicy [0] SkipCerts OPTIONAL,
622
688
  // inhibitPolicyMapping [1] SkipCerts OPTIONAL }
623
- export const PolicyConstraints = asn1.define('PolicyConstraints', function() {
689
+ const PolicyConstraints = asn1.define('PolicyConstraints', function() {
624
690
  this.seq().obj(
625
691
  this.key('requireExplicitPolicy').implicit(0).optional().use(SkipCerts),
626
692
  this.key('inhibitPolicyMapping').implicit(1).optional().use(SkipCerts)
627
693
  );
628
694
  });
695
+ rfc5280.PolicyConstraints = PolicyConstraints;
629
696
 
630
697
  // SkipCerts ::= INTEGER
631
- export const SkipCerts = asn1.define('SkipCerts', function() {
698
+ const SkipCerts = asn1.define('SkipCerts', function() {
632
699
  this.int();
633
700
  });
701
+ rfc5280.SkipCerts = SkipCerts;
634
702
 
635
703
  // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
636
- export const ExtendedKeyUsage = asn1.define('ExtendedKeyUsage', function() {
704
+ const ExtendedKeyUsage = asn1.define('ExtendedKeyUsage', function() {
637
705
  this.seqof(KeyPurposeId);
638
706
  });
707
+ rfc5280.ExtendedKeyUsage = ExtendedKeyUsage;
639
708
 
640
709
  // KeyPurposeId ::= OBJECT IDENTIFIER
641
- export const KeyPurposeId = asn1.define('KeyPurposeId', function() {
710
+ const KeyPurposeId = asn1.define('KeyPurposeId', function() {
642
711
  this.objid();
643
712
  });
713
+ rfc5280.KeyPurposeId = KeyPurposeId;
644
714
 
645
715
  // RLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint
646
- export const CRLDistributionPoints = asn1.define('CRLDistributionPoints', function() {
716
+ const CRLDistributionPoints = asn1.define('CRLDistributionPoints', function() {
647
717
  this.seqof(DistributionPoint);
648
718
  });
719
+ rfc5280.CRLDistributionPoints = CRLDistributionPoints;
649
720
 
650
721
  // DistributionPoint ::= SEQUENCE {
651
722
  // distributionPoint [0] DistributionPointName OPTIONAL,
652
723
  // reasons [1] ReasonFlags OPTIONAL,
653
724
  // cRLIssuer [2] GeneralNames OPTIONAL }
654
- export const DistributionPoint = asn1.define('DistributionPoint', function() {
725
+ const DistributionPoint = asn1.define('DistributionPoint', function() {
655
726
  this.seq().obj(
656
727
  this.key('distributionPoint').optional().explicit(0)
657
728
  .use(DistributionPointName),
@@ -659,16 +730,18 @@ export const DistributionPoint = asn1.define('DistributionPoint', function() {
659
730
  this.key('cRLIssuer').optional().implicit(2).use(GeneralNames)
660
731
  );
661
732
  });
733
+ rfc5280.DistributionPoint = DistributionPoint;
662
734
 
663
735
  // DistributionPointName ::= CHOICE {
664
736
  // fullName [0] GeneralNames,
665
737
  // nameRelativeToCRLIssuer [1] RelativeDistinguishedName }
666
- export const DistributionPointName = asn1.define('DistributionPointName', function() {
738
+ const DistributionPointName = asn1.define('DistributionPointName', function() {
667
739
  this.choice({
668
740
  fullName: this.implicit(0).use(GeneralNames),
669
741
  nameRelativeToCRLIssuer: this.implicit(1).use(RelativeDistinguishedName)
670
742
  });
671
743
  });
744
+ rfc5280.DistributionPointName = DistributionPointName;
672
745
 
673
746
  // ReasonFlags ::= BIT STRING {
674
747
  // unused (0),
@@ -680,54 +753,64 @@ export const DistributionPointName = asn1.define('DistributionPointName', functi
680
753
  // certificateHold (6),
681
754
  // privilegeWithdrawn (7),
682
755
  // aACompromise (8) }
683
- export const ReasonFlags = asn1.define('ReasonFlags', function() {
756
+ const ReasonFlags = asn1.define('ReasonFlags', function() {
684
757
  this.bitstr();
685
758
  });
759
+ rfc5280.ReasonFlags = ReasonFlags;
686
760
 
687
761
  // InhibitAnyPolicy ::= SkipCerts
688
- export const InhibitAnyPolicy = asn1.define('InhibitAnyPolicy', function() {
762
+ const InhibitAnyPolicy = asn1.define('InhibitAnyPolicy', function() {
689
763
  this.use(SkipCerts);
690
764
  });
765
+ rfc5280.InhibitAnyPolicy = InhibitAnyPolicy;
691
766
 
692
767
  // FreshestCRL ::= CRLDistributionPoints
693
- export const FreshestCRL = asn1.define('FreshestCRL', function() {
768
+ const FreshestCRL = asn1.define('FreshestCRL', function() {
694
769
  this.use(CRLDistributionPoints);
695
770
  });
771
+ rfc5280.FreshestCRL = FreshestCRL;
696
772
 
697
773
  // AuthorityInfoAccessSyntax ::=
698
774
  // SEQUENCE SIZE (1..MAX) OF AccessDescription
699
- export const AuthorityInfoAccessSyntax = asn1.define('AuthorityInfoAccessSyntax', function() {
700
- this.seqof(AccessDescription);
701
- });
775
+ const AuthorityInfoAccessSyntax = asn1.define('AuthorityInfoAccessSyntax',
776
+ function() {
777
+ this.seqof(AccessDescription);
778
+ });
779
+ rfc5280.AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax;
702
780
 
703
781
  // AccessDescription ::= SEQUENCE {
704
782
  // accessMethod OBJECT IDENTIFIER,
705
783
  // accessLocation GeneralName }
706
- export const AccessDescription = asn1.define('AccessDescription', function() {
784
+ const AccessDescription = asn1.define('AccessDescription', function() {
707
785
  this.seq().obj(
708
786
  this.key('accessMethod').objid(),
709
787
  this.key('accessLocation').use(GeneralName)
710
788
  );
711
789
  });
790
+ rfc5280.AccessDescription = AccessDescription;
712
791
 
713
792
  // SubjectInfoAccessSyntax ::=
714
793
  // SEQUENCE SIZE (1..MAX) OF AccessDescription
715
- export const SubjectInformationAccess = asn1.define('SubjectInformationAccess', function() {
716
- this.seqof(AccessDescription);
717
- });
794
+ const SubjectInformationAccess = asn1.define('SubjectInformationAccess',
795
+ function() {
796
+ this.seqof(AccessDescription);
797
+ });
798
+ rfc5280.SubjectInformationAccess = SubjectInformationAccess;
718
799
 
719
800
  /**
720
801
  * CRL Extensions
721
802
  */
722
803
 
723
804
  // CRLNumber ::= INTEGER
724
- export const CRLNumber = asn1.define('CRLNumber', function() {
805
+ const CRLNumber = asn1.define('CRLNumber', function() {
725
806
  this.int();
726
807
  });
808
+ rfc5280.CRLNumber = CRLNumber;
727
809
 
728
- export const DeltaCRLIndicator = asn1.define('DeltaCRLIndicator', function() {
810
+ const DeltaCRLIndicator = asn1.define('DeltaCRLIndicator', function() {
729
811
  this.use(CRLNumber);
730
812
  });
813
+ rfc5280.DeltaCRLIndicator = DeltaCRLIndicator;
731
814
 
732
815
  // IssuingDistributionPoint ::= SEQUENCE {
733
816
  // distributionPoint [0] DistributionPointName OPTIONAL,
@@ -736,7 +819,7 @@ export const DeltaCRLIndicator = asn1.define('DeltaCRLIndicator', function() {
736
819
  // onlySomeReasons [3] ReasonFlags OPTIONAL,
737
820
  // indirectCRL [4] BOOLEAN DEFAULT FALSE,
738
821
  // onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
739
- export const IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
822
+ const IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
740
823
  function() {
741
824
  this.seq().obj(
742
825
  this.key('distributionPoint').explicit(0).optional()
@@ -748,6 +831,7 @@ export const IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
748
831
  this.key('onlyContainsAttributeCerts').implicit(5).def(false).bool()
749
832
  );
750
833
  });
834
+ rfc5280.IssuingDistributionPoint = IssuingDistributionPoint;
751
835
 
752
836
  // CRLReason ::= ENUMERATED {
753
837
  // unspecified (0),
@@ -761,7 +845,7 @@ export const IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
761
845
  // removeFromCRL (8),
762
846
  // privilegeWithdrawn (9),
763
847
  // aACompromise (10) }
764
- export const ReasonCode = asn1.define('ReasonCode', function() {
848
+ const ReasonCode = asn1.define('ReasonCode', function() {
765
849
  this.enum({
766
850
  0: 'unspecified',
767
851
  1: 'keyCompromise',
@@ -775,16 +859,19 @@ export const ReasonCode = asn1.define('ReasonCode', function() {
775
859
  10: 'aACompromise'
776
860
  });
777
861
  });
862
+ rfc5280.ReasonCode = ReasonCode;
778
863
 
779
864
  // InvalidityDate ::= GeneralizedTime
780
- export const InvalidityDate = asn1.define('InvalidityDate', function() {
865
+ const InvalidityDate = asn1.define('InvalidityDate', function() {
781
866
  this.gentime();
782
867
  });
868
+ rfc5280.InvalidityDate = InvalidityDate;
783
869
 
784
870
  // CertificateIssuer ::= GeneralNames
785
- export const CertificateIssuer = asn1.define('CertificateIssuer', function() {
871
+ const CertificateIssuer = asn1.define('CertificateIssuer', function() {
786
872
  this.use(GeneralNames);
787
873
  });
874
+ rfc5280.CertificateIssuer = CertificateIssuer;
788
875
 
789
876
  // OID label to extension model mapping
790
877
  const x509Extensions = {