@peculiar/certificates-viewer 3.2.1 → 3.3.1

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.
Files changed (108) hide show
  1. package/dist/cjs/{certification_request-cde57123.js → certification_request-50ce61b3.js} +643 -235
  2. package/dist/cjs/crl-0c15e04a.js +312 -0
  3. package/dist/cjs/{index-ff818d4d.js → download-a97f4cb2.js} +106 -2
  4. package/dist/cjs/index.cjs.js +1 -3
  5. package/dist/cjs/l10n-4eaa5263.js +167 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{peculiar-attribute-certificate-viewer_2.cjs.entry.js → peculiar-attribute-certificate-viewer_3.cjs.entry.js} +123 -21
  8. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +25 -15
  9. package/dist/cjs/peculiar-certificate-summary_3.cjs.entry.js +2 -2
  10. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +6 -25
  11. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +6 -8
  12. package/dist/cjs/peculiar.cjs.js +1 -1
  13. package/dist/cjs/{public_key-2f5bd471.js → public_key-2b73778a.js} +80 -40
  14. package/dist/cjs/{x509_certificate-51a97033.js → x509_certificate-c94ce29e.js} +13 -7
  15. package/dist/collection/collection-manifest.json +1 -0
  16. package/dist/collection/components/certificate-decoder/certificate-decoder.js +19 -6
  17. package/dist/collection/components/certificate-viewer/attributes/type_relationship_attribute.js +2 -1
  18. package/dist/collection/components/certificate-viewer/basic_information.js +3 -1
  19. package/dist/collection/components/certificate-viewer/extensions/basic_constraints_extension.js +2 -1
  20. package/dist/collection/components/certificate-viewer/extensions/basic_extension.js +2 -1
  21. package/dist/collection/components/certificate-viewer/extensions/crl_number_extension.js +19 -0
  22. package/dist/collection/components/certificate-viewer/extensions/index.js +9 -1
  23. package/dist/collection/components/certificate-viewer/extensions/issuing_distribution_point_extension.js +27 -0
  24. package/dist/collection/components/certificate-viewer/extensions/timestamp_extension.js +2 -1
  25. package/dist/collection/components/certificate-viewer/miscellaneous.js +2 -20
  26. package/dist/collection/components/certificates-viewer/certificates-viewer.js +2 -3
  27. package/dist/collection/components/crl-viewer/crl-viewer.js +234 -0
  28. package/dist/collection/components/crl-viewer/revoked_certificates.js +27 -0
  29. package/dist/collection/crypto/crl.js +82 -0
  30. package/dist/collection/crypto/csr.js +7 -0
  31. package/dist/collection/crypto/extension.js +10 -1
  32. package/dist/collection/crypto/index.js +1 -0
  33. package/dist/collection/crypto/utils.js +5 -4
  34. package/dist/collection/crypto/x509_attribute_certificate.js +7 -1
  35. package/dist/collection/crypto/x509_certificate.js +7 -1
  36. package/dist/collection/locales/en.json +12 -1
  37. package/dist/collection/utils/download.js +18 -2
  38. package/dist/collection/utils/index.js +1 -0
  39. package/dist/collection/utils/validator.js +2 -0
  40. package/dist/esm/{certification_request-c0674647.js → certification_request-5b5c2fa2.js} +577 -172
  41. package/dist/esm/crl-10d4db54.js +308 -0
  42. package/dist/esm/{index-0ba131b0.js → download-67ac9120.js} +102 -2
  43. package/dist/esm/index.js +1 -3
  44. package/dist/esm/l10n-116c79fa.js +163 -0
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/esm/{peculiar-attribute-certificate-viewer_2.entry.js → peculiar-attribute-certificate-viewer_3.entry.js} +113 -12
  47. package/dist/esm/peculiar-certificate-decoder.entry.js +21 -11
  48. package/dist/esm/peculiar-certificate-summary_3.entry.js +2 -2
  49. package/dist/esm/peculiar-certificate-viewer.entry.js +6 -25
  50. package/dist/esm/peculiar-certificates-viewer.entry.js +6 -8
  51. package/dist/esm/peculiar.js +1 -1
  52. package/dist/esm/{public_key-38c9ddc8.js → public_key-c1e6801e.js} +67 -28
  53. package/dist/esm/{x509_certificate-12f6d344.js → x509_certificate-61126913.js} +9 -3
  54. package/dist/peculiar/index.esm.js +1 -1
  55. package/dist/peculiar/locales/en.json +12 -1
  56. package/dist/peculiar/p-10aa0b03.entry.js +11 -0
  57. package/dist/peculiar/{p-17c4da7b.js → p-309fdd02.js} +2 -2
  58. package/dist/peculiar/p-318a1e9f.entry.js +4 -0
  59. package/dist/peculiar/p-53aac672.js +63 -0
  60. package/dist/peculiar/p-5a898f51.js +32 -0
  61. package/dist/peculiar/{p-38635919.entry.js → p-652f77d0.entry.js} +1 -1
  62. package/dist/peculiar/p-7ef69178.entry.js +4 -0
  63. package/dist/peculiar/{p-464e0943.js → p-bbf0fd6c.js} +9 -9
  64. package/dist/peculiar/p-cff9655c.js +18 -0
  65. package/dist/peculiar/p-ed58acd0.js +12 -0
  66. package/dist/peculiar/p-ff867be1.entry.js +26 -0
  67. package/dist/peculiar/peculiar.esm.js +1 -1
  68. package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +3 -3
  69. package/dist/types/components/certificate-viewer/basic_information.d.ts +2 -0
  70. package/dist/types/components/certificate-viewer/extensions/crl_number_extension.d.ts +15 -0
  71. package/dist/types/components/certificate-viewer/extensions/issuing_distribution_point_extension.d.ts +15 -0
  72. package/dist/types/components/certificate-viewer/miscellaneous.d.ts +2 -2
  73. package/dist/types/components/certificate-viewer/row.d.ts +1 -1
  74. package/dist/types/components/crl-viewer/crl-viewer.d.ts +59 -0
  75. package/dist/types/components/crl-viewer/revoked_certificates.d.ts +14 -0
  76. package/dist/types/components.d.ts +66 -0
  77. package/dist/types/crypto/crl.d.ts +28 -0
  78. package/dist/types/crypto/csr.d.ts +2 -0
  79. package/dist/types/crypto/extension.d.ts +2 -2
  80. package/dist/types/crypto/index.d.ts +1 -0
  81. package/dist/types/crypto/x509_attribute_certificate.d.ts +2 -0
  82. package/dist/types/crypto/x509_certificate.d.ts +2 -0
  83. package/dist/types/utils/download.d.ts +10 -2
  84. package/dist/types/utils/index.d.ts +1 -0
  85. package/dist/types/utils/l10n.d.ts +11 -0
  86. package/dist/types/utils/validator.d.ts +1 -0
  87. package/package.json +19 -19
  88. package/dist/cjs/_commonjsHelpers-cb1f949a.js +0 -23
  89. package/dist/cjs/csr-78378ed0.js +0 -150
  90. package/dist/cjs/download-6724f3a7.js +0 -79
  91. package/dist/cjs/l10n-a048a686.js +0 -145
  92. package/dist/cjs/x509_attribute_certificate-cc325b70.js +0 -87
  93. package/dist/esm/_commonjsHelpers-bfbd2ad8.js +0 -20
  94. package/dist/esm/csr-c1b6a176.js +0 -147
  95. package/dist/esm/download-735fb2eb.js +0 -76
  96. package/dist/esm/l10n-ac28fa92.js +0 -141
  97. package/dist/esm/x509_attribute_certificate-a6d4aa15.js +0 -85
  98. package/dist/peculiar/p-006865d7.js +0 -4
  99. package/dist/peculiar/p-3f8d1008.entry.js +0 -4
  100. package/dist/peculiar/p-42da7f97.js +0 -11
  101. package/dist/peculiar/p-4f4c1d30.js +0 -12
  102. package/dist/peculiar/p-6011646e.entry.js +0 -11
  103. package/dist/peculiar/p-6bfd077c.entry.js +0 -18
  104. package/dist/peculiar/p-6c510523.js +0 -18
  105. package/dist/peculiar/p-986cc770.entry.js +0 -11
  106. package/dist/peculiar/p-b765873e.js +0 -78
  107. package/dist/peculiar/p-d0b55fbb.js +0 -4
  108. package/dist/peculiar/p-d7a13cb4.js +0 -18
@@ -3,9 +3,8 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const index = require('./index-ff818d4d.js');
7
- require('./l10n-a048a686.js');
8
- const _commonjsHelpers = require('./_commonjsHelpers-cb1f949a.js');
6
+ const download = require('./download-a97f4cb2.js');
7
+ require('./l10n-4eaa5263.js');
9
8
 
10
9
  /**
11
10
  * @license
@@ -21,6 +20,8 @@ const isPem = (value) => (/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-
21
20
  .test(value));
22
21
  const isX509Pem = (value) => (/-----BEGIN CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE-----/
23
22
  .test(value));
23
+ const isX509CRLPem = (value) => (/-----BEGIN X509 CRL-----([A-Za-z0-9+\/=\s]+)-----END X509 CRL-----/
24
+ .test(value));
24
25
  const isPkcs10Pem = (value) => (/-----BEGIN CERTIFICATE REQUEST-----([A-Za-z0-9+\/=\s]+)-----END CERTIFICATE REQUEST-----/
25
26
  .test(value));
26
27
  const isX509AttributePem = (value) => (/-----BEGIN ATTRIBUTE CERTIFICATE-----([A-Za-z0-9+\/=\s]+)-----END ATTRIBUTE CERTIFICATE-----/
@@ -292,7 +293,7 @@ function HexBlock(BaseClass) {
292
293
  super(...args);
293
294
  const params = args[0] || {};
294
295
  this.isHexOnly = (_a = params.isHexOnly) !== null && _a !== void 0 ? _a : false;
295
- this.valueHexView = params.valueHex ? index.build.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;
296
+ this.valueHexView = params.valueHex ? download.build.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;
296
297
  }
297
298
  get valueHex() {
298
299
  return this.valueHexView.slice().buffer;
@@ -330,7 +331,7 @@ function HexBlock(BaseClass) {
330
331
  return {
331
332
  ...super.toJSON(),
332
333
  isHexOnly: this.isHexOnly,
333
- valueHex: index.build.Convert.ToHex(this.valueHexView),
334
+ valueHex: download.build.Convert.ToHex(this.valueHexView),
334
335
  };
335
336
  }
336
337
  },
@@ -343,7 +344,7 @@ class LocalBaseBlock {
343
344
  this.blockLength = blockLength;
344
345
  this.error = error;
345
346
  this.warnings = warnings;
346
- this.valueBeforeDecodeView = index.build.BufferSourceConverter.toUint8Array(valueBeforeDecode);
347
+ this.valueBeforeDecodeView = download.build.BufferSourceConverter.toUint8Array(valueBeforeDecode);
347
348
  }
348
349
  static blockName() {
349
350
  return this.NAME;
@@ -360,7 +361,7 @@ class LocalBaseBlock {
360
361
  blockLength: this.blockLength,
361
362
  error: this.error,
362
363
  warnings: this.warnings,
363
- valueBeforeDecode: index.build.Convert.ToHex(this.valueBeforeDecodeView),
364
+ valueBeforeDecode: download.build.Convert.ToHex(this.valueBeforeDecodeView),
364
365
  };
365
366
  }
366
367
  }
@@ -382,7 +383,7 @@ class LocalIdentificationBlock extends HexBlock(LocalBaseBlock) {
382
383
  super();
383
384
  if (idBlock) {
384
385
  this.isHexOnly = (_a = idBlock.isHexOnly) !== null && _a !== void 0 ? _a : false;
385
- this.valueHexView = idBlock.valueHex ? index.build.BufferSourceConverter.toUint8Array(idBlock.valueHex) : EMPTY_VIEW;
386
+ this.valueHexView = idBlock.valueHex ? download.build.BufferSourceConverter.toUint8Array(idBlock.valueHex) : EMPTY_VIEW;
386
387
  this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1;
387
388
  this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1;
388
389
  this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false;
@@ -448,7 +449,7 @@ class LocalIdentificationBlock extends HexBlock(LocalBaseBlock) {
448
449
  return retView.buffer;
449
450
  }
450
451
  fromBER(inputBuffer, inputOffset, inputLength) {
451
- const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
452
+ const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
452
453
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
453
454
  return -1;
454
455
  }
@@ -557,7 +558,7 @@ class LocalLengthBlock extends LocalBaseBlock {
557
558
  this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0;
558
559
  }
559
560
  fromBER(inputBuffer, inputOffset, inputLength) {
560
- const view = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
561
+ const view = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
561
562
  if (!checkBufferParams(this, view, inputOffset, inputLength)) {
562
563
  return -1;
563
564
  }
@@ -716,10 +717,10 @@ class BaseBlock extends LocalBaseBlock {
716
717
  if (encoding === "ascii") {
717
718
  return this.onAsciiEncoding();
718
719
  }
719
- return index.build.Convert.ToHex(this.toBER());
720
+ return download.build.Convert.ToHex(this.toBER());
720
721
  }
721
722
  onAsciiEncoding() {
722
- return `${this.constructor.NAME} : ${index.build.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`;
723
+ return `${this.constructor.NAME} : ${download.build.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`;
723
724
  }
724
725
  isEqual(other) {
725
726
  if (this === other) {
@@ -1017,7 +1018,7 @@ function fromBER(inputBuffer) {
1017
1018
  result
1018
1019
  };
1019
1020
  }
1020
- return localFromBER(index.build.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);
1021
+ return localFromBER(download.build.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);
1021
1022
  }
1022
1023
 
1023
1024
  function checkLen(indefiniteLength, length) {
@@ -1033,7 +1034,7 @@ class LocalConstructedValueBlock extends ValueBlock {
1033
1034
  this.isIndefiniteForm = isIndefiniteForm;
1034
1035
  }
1035
1036
  fromBER(inputBuffer, inputOffset, inputLength) {
1036
- const view = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1037
+ const view = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1037
1038
  if (!checkBufferParams(this, view, inputOffset, inputLength)) {
1038
1039
  return -1;
1039
1040
  }
@@ -1203,7 +1204,7 @@ class LocalBooleanValueBlock extends HexBlock(ValueBlock) {
1203
1204
  constructor({ value, ...parameters } = {}) {
1204
1205
  super(parameters);
1205
1206
  if (parameters.valueHex) {
1206
- this.valueHexView = index.build.BufferSourceConverter.toUint8Array(parameters.valueHex);
1207
+ this.valueHexView = download.build.BufferSourceConverter.toUint8Array(parameters.valueHex);
1207
1208
  }
1208
1209
  else {
1209
1210
  this.valueHexView = new Uint8Array(1);
@@ -1224,7 +1225,7 @@ class LocalBooleanValueBlock extends HexBlock(ValueBlock) {
1224
1225
  this.valueHexView[0] = value ? 0xFF : 0x00;
1225
1226
  }
1226
1227
  fromBER(inputBuffer, inputOffset, inputLength) {
1227
- const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1228
+ const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1228
1229
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
1229
1230
  return -1;
1230
1231
  }
@@ -1371,7 +1372,7 @@ class OctetString$1 extends BaseBlock {
1371
1372
  if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) {
1372
1373
  return Constructed.prototype.onAsciiEncoding.call(this);
1373
1374
  }
1374
- return `${this.constructor.NAME} : ${index.build.Convert.ToHex(this.valueBlock.valueHexView)}`;
1375
+ return `${this.constructor.NAME} : ${download.build.Convert.ToHex(this.valueBlock.valueHexView)}`;
1375
1376
  }
1376
1377
  getValue() {
1377
1378
  if (!this.idBlock.isConstructed) {
@@ -1383,7 +1384,7 @@ class OctetString$1 extends BaseBlock {
1383
1384
  array.push(content.valueBlock.valueHexView);
1384
1385
  }
1385
1386
  }
1386
- return index.build.BufferSourceConverter.concat(array);
1387
+ return download.build.BufferSourceConverter.concat(array);
1387
1388
  }
1388
1389
  }
1389
1390
  _a$r = OctetString$1;
@@ -1431,7 +1432,7 @@ class LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock) {
1431
1432
  }
1432
1433
  return resultOffset;
1433
1434
  }
1434
- const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1435
+ const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1435
1436
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
1436
1437
  return -1;
1437
1438
  }
@@ -1771,13 +1772,13 @@ class Integer extends BaseBlock {
1771
1772
  const bigIntValue = BigInt(value);
1772
1773
  const writer = new ViewWriter();
1773
1774
  const hex = bigIntValue.toString(16).replace(/^-/, "");
1774
- const view = new Uint8Array(index.build.Convert.FromHex(hex));
1775
+ const view = new Uint8Array(download.build.Convert.FromHex(hex));
1775
1776
  if (bigIntValue < 0) {
1776
1777
  const first = new Uint8Array(view.length + (view[0] & 0x80 ? 1 : 0));
1777
1778
  first[0] |= 0x80;
1778
- const firstInt = BigInt(`0x${index.build.Convert.ToHex(first)}`);
1779
+ const firstInt = BigInt(`0x${download.build.Convert.ToHex(first)}`);
1779
1780
  const secondInt = firstInt + bigIntValue;
1780
- const second = index.build.BufferSourceConverter.toUint8Array(index.build.Convert.FromHex(secondInt.toString(16)));
1781
+ const second = download.build.BufferSourceConverter.toUint8Array(download.build.Convert.FromHex(secondInt.toString(16)));
1781
1782
  second[0] |= 0x80;
1782
1783
  writer.write(second);
1783
1784
  }
@@ -1838,7 +1839,7 @@ class LocalSidValueBlock extends HexBlock(ValueBlock) {
1838
1839
  if (!inputLength) {
1839
1840
  return inputOffset;
1840
1841
  }
1841
- const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
1842
+ const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
1842
1843
  if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {
1843
1844
  return -1;
1844
1845
  }
@@ -1910,7 +1911,7 @@ class LocalSidValueBlock extends HexBlock(ValueBlock) {
1910
1911
  toString() {
1911
1912
  let result = "";
1912
1913
  if (this.isHexOnly)
1913
- result = index.build.Convert.ToHex(this.valueHexView);
1914
+ result = download.build.Convert.ToHex(this.valueHexView);
1914
1915
  else {
1915
1916
  if (this.isFirstSid) {
1916
1917
  let sidValue = this.valueDec;
@@ -2107,7 +2108,7 @@ class LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) {
2107
2108
  fromBER(inputBuffer, inputOffset, inputLength) {
2108
2109
  if (inputLength === 0)
2109
2110
  return inputOffset;
2110
- const inputView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
2111
+ const inputView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
2111
2112
  if (!checkBufferParams(this, inputView, inputOffset, inputLength))
2112
2113
  return -1;
2113
2114
  const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);
@@ -2165,7 +2166,7 @@ class LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) {
2165
2166
  toString() {
2166
2167
  let result = "";
2167
2168
  if (this.isHexOnly)
2168
- result = index.build.Convert.ToHex(this.valueHexView);
2169
+ result = download.build.Convert.ToHex(this.valueHexView);
2169
2170
  else {
2170
2171
  result = this.valueDec.toString();
2171
2172
  }
@@ -2347,7 +2348,7 @@ class LocalSimpleStringBlock extends BaseStringBlock {
2347
2348
  super(parameters, LocalSimpleStringValueBlock);
2348
2349
  }
2349
2350
  fromBuffer(inputBuffer) {
2350
- this.valueBlock.value = String.fromCharCode.apply(null, index.build.BufferSourceConverter.toUint8Array(inputBuffer));
2351
+ this.valueBlock.value = String.fromCharCode.apply(null, download.build.BufferSourceConverter.toUint8Array(inputBuffer));
2351
2352
  }
2352
2353
  fromString(inputString) {
2353
2354
  const strLen = inputString.length;
@@ -2361,17 +2362,17 @@ LocalSimpleStringBlock.NAME = "SIMPLE STRING";
2361
2362
 
2362
2363
  class LocalUtf8StringValueBlock extends LocalSimpleStringBlock {
2363
2364
  fromBuffer(inputBuffer) {
2364
- this.valueBlock.valueHexView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
2365
+ this.valueBlock.valueHexView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
2365
2366
  try {
2366
- this.valueBlock.value = index.build.Convert.ToUtf8String(inputBuffer);
2367
+ this.valueBlock.value = download.build.Convert.ToUtf8String(inputBuffer);
2367
2368
  }
2368
2369
  catch (ex) {
2369
2370
  this.warnings.push(`Error during "decodeURIComponent": ${ex}, using raw string`);
2370
- this.valueBlock.value = index.build.Convert.ToBinary(inputBuffer);
2371
+ this.valueBlock.value = download.build.Convert.ToBinary(inputBuffer);
2371
2372
  }
2372
2373
  }
2373
2374
  fromString(inputString) {
2374
- this.valueBlock.valueHexView = new Uint8Array(index.build.Convert.FromUtf8String(inputString));
2375
+ this.valueBlock.valueHexView = new Uint8Array(download.build.Convert.FromUtf8String(inputString));
2375
2376
  this.valueBlock.value = inputString;
2376
2377
  }
2377
2378
  }
@@ -2393,12 +2394,12 @@ Utf8String.NAME = "UTF8String";
2393
2394
 
2394
2395
  class LocalBmpStringValueBlock extends LocalSimpleStringBlock {
2395
2396
  fromBuffer(inputBuffer) {
2396
- this.valueBlock.value = index.build.Convert.ToUtf16String(inputBuffer);
2397
- this.valueBlock.valueHexView = index.build.BufferSourceConverter.toUint8Array(inputBuffer);
2397
+ this.valueBlock.value = download.build.Convert.ToUtf16String(inputBuffer);
2398
+ this.valueBlock.valueHexView = download.build.BufferSourceConverter.toUint8Array(inputBuffer);
2398
2399
  }
2399
2400
  fromString(inputString) {
2400
2401
  this.valueBlock.value = inputString;
2401
- this.valueBlock.valueHexView = new Uint8Array(index.build.Convert.FromUtf16String(inputString));
2402
+ this.valueBlock.valueHexView = new Uint8Array(download.build.Convert.FromUtf16String(inputString));
2402
2403
  }
2403
2404
  }
2404
2405
  LocalBmpStringValueBlock.NAME = "BmpStringValueBlock";
@@ -2610,7 +2611,7 @@ class UTCTime extends VisibleString {
2610
2611
  this.idBlock.tagNumber = 23;
2611
2612
  }
2612
2613
  fromBuffer(inputBuffer) {
2613
- this.fromString(String.fromCharCode.apply(null, index.build.BufferSourceConverter.toUint8Array(inputBuffer)));
2614
+ this.fromString(String.fromCharCode.apply(null, download.build.BufferSourceConverter.toUint8Array(inputBuffer)));
2614
2615
  }
2615
2616
  toBuffer() {
2616
2617
  const str = this.toString();
@@ -2960,17 +2961,17 @@ class Repeated extends Any {
2960
2961
 
2961
2962
  class RawData {
2962
2963
  constructor({ data = EMPTY_VIEW } = {}) {
2963
- this.dataView = index.build.BufferSourceConverter.toUint8Array(data);
2964
+ this.dataView = download.build.BufferSourceConverter.toUint8Array(data);
2964
2965
  }
2965
2966
  get data() {
2966
2967
  return this.dataView.slice().buffer;
2967
2968
  }
2968
2969
  set data(value) {
2969
- this.dataView = index.build.BufferSourceConverter.toUint8Array(value);
2970
+ this.dataView = download.build.BufferSourceConverter.toUint8Array(value);
2970
2971
  }
2971
2972
  fromBER(inputBuffer, inputOffset, inputLength) {
2972
2973
  const endLength = inputOffset + inputLength;
2973
- this.dataView = index.build.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);
2974
+ this.dataView = download.build.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);
2974
2975
  return endLength;
2975
2976
  }
2976
2977
  toBER(sizeOnly) {
@@ -3289,7 +3290,7 @@ function verifySchema(inputBuffer, inputSchema) {
3289
3290
  result: { error: "Wrong ASN.1 schema type" }
3290
3291
  };
3291
3292
  }
3292
- const asn1 = localFromBER(index.build.BufferSourceConverter.toUint8Array(inputBuffer));
3293
+ const asn1 = localFromBER(download.build.BufferSourceConverter.toUint8Array(inputBuffer));
3293
3294
  if (asn1.offset === -1) {
3294
3295
  return {
3295
3296
  verified: false,
@@ -3299,7 +3300,7 @@ function verifySchema(inputBuffer, inputSchema) {
3299
3300
  return compareSchema(asn1.result, asn1.result, inputSchema);
3300
3301
  }
3301
3302
 
3302
- const asn1 = /*#__PURE__*/Object.freeze({
3303
+ const asn1js = /*#__PURE__*/Object.freeze({
3303
3304
  __proto__: null,
3304
3305
  Any: Any,
3305
3306
  BaseBlock: BaseBlock,
@@ -3384,8 +3385,104 @@ var AsnPropTypes;
3384
3385
  AsnPropTypes[AsnPropTypes["Null"] = 27] = "Null";
3385
3386
  })(AsnPropTypes || (AsnPropTypes = {}));
3386
3387
 
3388
+ class BitString {
3389
+ constructor(params, unusedBits = 0) {
3390
+ this.unusedBits = 0;
3391
+ this.value = new ArrayBuffer(0);
3392
+ if (params) {
3393
+ if (typeof params === "number") {
3394
+ this.fromNumber(params);
3395
+ }
3396
+ else if (download.build.BufferSourceConverter.isBufferSource(params)) {
3397
+ this.unusedBits = unusedBits;
3398
+ this.value = download.build.BufferSourceConverter.toArrayBuffer(params);
3399
+ }
3400
+ else {
3401
+ throw TypeError("Unsupported type of 'params' argument for BitString");
3402
+ }
3403
+ }
3404
+ }
3405
+ fromASN(asn) {
3406
+ if (!(asn instanceof BitString$1)) {
3407
+ throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");
3408
+ }
3409
+ this.unusedBits = asn.valueBlock.unusedBits;
3410
+ this.value = asn.valueBlock.valueHex;
3411
+ return this;
3412
+ }
3413
+ toASN() {
3414
+ return new BitString$1({ unusedBits: this.unusedBits, valueHex: this.value });
3415
+ }
3416
+ toSchema(name) {
3417
+ return new BitString$1({ name });
3418
+ }
3419
+ toNumber() {
3420
+ let res = "";
3421
+ const uintArray = new Uint8Array(this.value);
3422
+ for (const octet of uintArray) {
3423
+ res += octet.toString(2).padStart(8, "0");
3424
+ }
3425
+ res = res.split("").reverse().join("");
3426
+ if (this.unusedBits) {
3427
+ res = res.slice(this.unusedBits).padStart(this.unusedBits, "0");
3428
+ }
3429
+ return parseInt(res, 2);
3430
+ }
3431
+ fromNumber(value) {
3432
+ let bits = value.toString(2);
3433
+ const octetSize = (bits.length + 7) >> 3;
3434
+ this.unusedBits = (octetSize << 3) - bits.length;
3435
+ const octets = new Uint8Array(octetSize);
3436
+ bits = bits.padStart(octetSize << 3, "0").split("").reverse().join("");
3437
+ let index = 0;
3438
+ while (index < octetSize) {
3439
+ octets[index] = parseInt(bits.slice(index << 3, (index << 3) + 8), 2);
3440
+ index++;
3441
+ }
3442
+ this.value = octets.buffer;
3443
+ }
3444
+ }
3445
+
3446
+ class OctetString {
3447
+ constructor(param) {
3448
+ if (typeof param === "number") {
3449
+ this.buffer = new ArrayBuffer(param);
3450
+ }
3451
+ else {
3452
+ if (download.build.BufferSourceConverter.isBufferSource(param)) {
3453
+ this.buffer = download.build.BufferSourceConverter.toArrayBuffer(param);
3454
+ }
3455
+ else if (Array.isArray(param)) {
3456
+ this.buffer = new Uint8Array(param);
3457
+ }
3458
+ else {
3459
+ this.buffer = new ArrayBuffer(0);
3460
+ }
3461
+ }
3462
+ }
3463
+ get byteLength() {
3464
+ return this.buffer.byteLength;
3465
+ }
3466
+ get byteOffset() {
3467
+ return 0;
3468
+ }
3469
+ fromASN(asn) {
3470
+ if (!(asn instanceof OctetString$1)) {
3471
+ throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");
3472
+ }
3473
+ this.buffer = asn.valueBlock.valueHex;
3474
+ return this;
3475
+ }
3476
+ toASN() {
3477
+ return new OctetString$1({ valueHex: this.buffer });
3478
+ }
3479
+ toSchema(name) {
3480
+ return new OctetString$1({ name });
3481
+ }
3482
+ }
3483
+
3387
3484
  const AsnAnyConverter = {
3388
- fromASN: (value) => value instanceof Null ? null : value.valueBeforeDecode,
3485
+ fromASN: (value) => value instanceof Null ? null : value.valueBeforeDecodeView,
3389
3486
  toASN: (value) => {
3390
3487
  if (value === null) {
3391
3488
  return new Null();
@@ -3398,21 +3495,21 @@ const AsnAnyConverter = {
3398
3495
  },
3399
3496
  };
3400
3497
  const AsnIntegerConverter = {
3401
- fromASN: (value) => value.valueBlock.valueHex.byteLength > 4
3498
+ fromASN: (value) => value.valueBlock.valueHexView.byteLength >= 4
3402
3499
  ? value.valueBlock.toString()
3403
3500
  : value.valueBlock.valueDec,
3404
- toASN: (value) => new Integer({ value: value }),
3501
+ toASN: (value) => new Integer({ value: +value }),
3405
3502
  };
3406
3503
  const AsnEnumeratedConverter = {
3407
3504
  fromASN: (value) => value.valueBlock.valueDec,
3408
3505
  toASN: (value) => new Enumerated({ value }),
3409
3506
  };
3410
3507
  const AsnIntegerArrayBufferConverter = {
3411
- fromASN: (value) => value.valueBlock.valueHex,
3508
+ fromASN: (value) => value.valueBlock.valueHexView,
3412
3509
  toASN: (value) => new Integer({ valueHex: value }),
3413
3510
  };
3414
3511
  const AsnBitStringConverter = {
3415
- fromASN: (value) => value.valueBlock.valueHex,
3512
+ fromASN: (value) => value.valueBlock.valueHexView,
3416
3513
  toASN: (value) => new BitString$1({ valueHex: value }),
3417
3514
  };
3418
3515
  const AsnObjectIdentifierConverter = {
@@ -3424,9 +3521,13 @@ const AsnBooleanConverter = {
3424
3521
  toASN: (value) => new Boolean({ value }),
3425
3522
  };
3426
3523
  const AsnOctetStringConverter = {
3427
- fromASN: (value) => value.valueBlock.valueHex,
3524
+ fromASN: (value) => value.valueBlock.valueHexView,
3428
3525
  toASN: (value) => new OctetString$1({ valueHex: value }),
3429
3526
  };
3527
+ const AsnConstructedOctetStringConverter = {
3528
+ fromASN: (value) => new OctetString(value.getValue()),
3529
+ toASN: (value) => value.toASN(),
3530
+ };
3430
3531
  function createStringConverter(Asn1Type) {
3431
3532
  return {
3432
3533
  fromASN: (value) => value.valueBlock.value,
@@ -3454,8 +3555,8 @@ const AsnGeneralizedTimeConverter = {
3454
3555
  toASN: (value) => new GeneralizedTime({ valueDate: value }),
3455
3556
  };
3456
3557
  const AsnNullConverter = {
3457
- fromASN: (value) => null,
3458
- toASN: (value) => {
3558
+ fromASN: () => null,
3559
+ toASN: () => {
3459
3560
  return new Null();
3460
3561
  },
3461
3562
  };
@@ -3510,104 +3611,8 @@ function defaultConverter(type) {
3510
3611
  }
3511
3612
  }
3512
3613
 
3513
- class BitString {
3514
- constructor(params, unusedBits = 0) {
3515
- this.unusedBits = 0;
3516
- this.value = new ArrayBuffer(0);
3517
- if (params) {
3518
- if (typeof params === "number") {
3519
- this.fromNumber(params);
3520
- }
3521
- else if (index.build.BufferSourceConverter.isBufferSource(params)) {
3522
- this.unusedBits = unusedBits;
3523
- this.value = index.build.BufferSourceConverter.toArrayBuffer(params);
3524
- }
3525
- else {
3526
- throw TypeError("Unsupported type of 'params' argument for BitString");
3527
- }
3528
- }
3529
- }
3530
- fromASN(asn) {
3531
- if (!(asn instanceof BitString$1)) {
3532
- throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");
3533
- }
3534
- this.unusedBits = asn.valueBlock.unusedBits;
3535
- this.value = asn.valueBlock.valueHex;
3536
- return this;
3537
- }
3538
- toASN() {
3539
- return new BitString$1({ unusedBits: this.unusedBits, valueHex: this.value });
3540
- }
3541
- toSchema(name) {
3542
- return new BitString$1({ name });
3543
- }
3544
- toNumber() {
3545
- let res = "";
3546
- const uintArray = new Uint8Array(this.value);
3547
- for (const octet of uintArray) {
3548
- res += octet.toString(2).padStart(8, "0");
3549
- }
3550
- res = res.split("").reverse().join("");
3551
- if (this.unusedBits) {
3552
- res = res.slice(this.unusedBits).padStart(this.unusedBits, "0");
3553
- }
3554
- return parseInt(res, 2);
3555
- }
3556
- fromNumber(value) {
3557
- let bits = value.toString(2);
3558
- const octetSize = (bits.length + 7) >> 3;
3559
- this.unusedBits = (octetSize << 3) - bits.length;
3560
- const octets = new Uint8Array(octetSize);
3561
- bits = bits.padStart(octetSize << 3, "0").split("").reverse().join("");
3562
- let index = 0;
3563
- while (index < octetSize) {
3564
- octets[index] = parseInt(bits.slice(index << 3, (index << 3) + 8), 2);
3565
- index++;
3566
- }
3567
- this.value = octets.buffer;
3568
- }
3569
- }
3570
-
3571
- class OctetString {
3572
- constructor(param) {
3573
- if (typeof param === "number") {
3574
- this.buffer = new ArrayBuffer(param);
3575
- }
3576
- else {
3577
- if (index.build.BufferSourceConverter.isBufferSource(param)) {
3578
- this.buffer = index.build.BufferSourceConverter.toArrayBuffer(param);
3579
- }
3580
- else if (Array.isArray(param)) {
3581
- this.buffer = new Uint8Array(param);
3582
- }
3583
- else {
3584
- this.buffer = new ArrayBuffer(0);
3585
- }
3586
- }
3587
- }
3588
- get byteLength() {
3589
- return this.buffer.byteLength;
3590
- }
3591
- get byteOffset() {
3592
- return 0;
3593
- }
3594
- fromASN(asn) {
3595
- if (!(asn instanceof OctetString$1)) {
3596
- throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");
3597
- }
3598
- this.buffer = asn.valueBlock.valueHex;
3599
- return this;
3600
- }
3601
- toASN() {
3602
- return new OctetString$1({ valueHex: this.buffer });
3603
- }
3604
- toSchema(name) {
3605
- return new OctetString$1({ name });
3606
- }
3607
- }
3608
-
3609
3614
  function isConvertible(target) {
3610
- if (target && target.prototype) {
3615
+ if (typeof target === "function" && target.prototype) {
3611
3616
  if (target.prototype.toASN && target.prototype.fromASN) {
3612
3617
  return true;
3613
3618
  }
@@ -3616,7 +3621,7 @@ function isConvertible(target) {
3616
3621
  }
3617
3622
  }
3618
3623
  else {
3619
- return !!(target && target.toASN && target.fromASN);
3624
+ return !!(target && typeof target === "object" && "toASN" in target && "fromASN" in target);
3620
3625
  }
3621
3626
  }
3622
3627
  function isTypeOfArray(target) {
@@ -3654,11 +3659,13 @@ class AsnSchemaStorage {
3654
3659
  has(target) {
3655
3660
  return this.items.has(target);
3656
3661
  }
3657
- get(target) {
3658
- var _a, _b, _c;
3662
+ get(target, checkSchema = false) {
3659
3663
  const schema = this.items.get(target);
3660
3664
  if (!schema) {
3661
- throw new Error(`Cannot get schema for '${(_c = (_b = (_a = target === null || target === void 0 ? void 0 : target.prototype) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : target}' target`);
3665
+ throw new Error(`Cannot get schema for '${target.prototype.constructor.name}' target`);
3666
+ }
3667
+ if (checkSchema && !schema.schema) {
3668
+ throw new Error(`Schema '${target.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);
3662
3669
  }
3663
3670
  return schema;
3664
3671
  }
@@ -3689,7 +3696,7 @@ class AsnSchemaStorage {
3689
3696
  let asn1Item;
3690
3697
  if (typeof (item.type) === "number") {
3691
3698
  const Asn1TypeName = AsnPropTypes[item.type];
3692
- const Asn1Type = asn1[Asn1TypeName];
3699
+ const Asn1Type = asn1js[Asn1TypeName];
3693
3700
  if (!Asn1Type) {
3694
3701
  throw new Error(`Cannot get ASN1 class by name '${Asn1TypeName}'`);
3695
3702
  }
@@ -3747,9 +3754,9 @@ class AsnSchemaStorage {
3747
3754
  this.cache(item.type);
3748
3755
  const isRepeated = !!item.repeated;
3749
3756
  let value = !isRepeated
3750
- ? this.get(item.type).schema
3757
+ ? this.get(item.type, true).schema
3751
3758
  : asn1Item;
3752
- value = value.valueBlock ? value.valueBlock.value : value.value;
3759
+ value = "valueBlock" in value ? value.valueBlock.value : value.value;
3753
3760
  asn1Value.push(new Constructed({
3754
3761
  name: !isRepeated ? name : "",
3755
3762
  optional,
@@ -3757,7 +3764,7 @@ class AsnSchemaStorage {
3757
3764
  tagClass: 3,
3758
3765
  tagNumber: item.context,
3759
3766
  },
3760
- value,
3767
+ value: value,
3761
3768
  }));
3762
3769
  }
3763
3770
  }
@@ -3793,7 +3800,7 @@ class AsnSchemaStorage {
3793
3800
  return this;
3794
3801
  }
3795
3802
  findParentSchema(target) {
3796
- const parent = target.__proto__;
3803
+ const parent = Object.getPrototypeOf(target);
3797
3804
  if (parent) {
3798
3805
  const schema = this.items.get(parent);
3799
3806
  return schema || this.findParentSchema(parent);
@@ -3879,15 +3886,19 @@ class AsnParser {
3879
3886
  }
3880
3887
  const res = new target();
3881
3888
  if (isTypeOfArray(target)) {
3882
- if (typeof schema.itemType === "number") {
3883
- const converter = defaultConverter(schema.itemType);
3889
+ if (!("value" in asn1Schema.valueBlock && Array.isArray(asn1Schema.valueBlock.value))) {
3890
+ throw new Error(`Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.`);
3891
+ }
3892
+ const itemType = schema.itemType;
3893
+ if (typeof itemType === "number") {
3894
+ const converter = defaultConverter(itemType);
3884
3895
  if (!converter) {
3885
3896
  throw new Error(`Cannot get default converter for array item of ${target.name} ASN1 schema`);
3886
3897
  }
3887
3898
  return target.from(asn1Schema.valueBlock.value, (element) => converter.fromASN(element));
3888
3899
  }
3889
3900
  else {
3890
- return target.from(asn1Schema.valueBlock.value, (element) => this.fromASN(element, schema.itemType));
3901
+ return target.from(asn1Schema.valueBlock.value, (element) => this.fromASN(element, itemType));
3891
3902
  }
3892
3903
  }
3893
3904
  for (const key in schema.items) {
@@ -3896,9 +3907,10 @@ class AsnParser {
3896
3907
  continue;
3897
3908
  }
3898
3909
  const schemaItem = schema.items[key];
3899
- if (typeof (schemaItem.type) === "number" || isConvertible(schemaItem.type)) {
3900
- const converter = (_a = schemaItem.converter) !== null && _a !== void 0 ? _a : (isConvertible(schemaItem.type)
3901
- ? new schemaItem.type()
3910
+ const schemaItemType = schemaItem.type;
3911
+ if (typeof schemaItemType === "number" || isConvertible(schemaItemType)) {
3912
+ const converter = (_a = schemaItem.converter) !== null && _a !== void 0 ? _a : (isConvertible(schemaItemType)
3913
+ ? new schemaItemType()
3902
3914
  : null);
3903
3915
  if (!converter) {
3904
3916
  throw new Error("Converter is empty");
@@ -3910,7 +3922,14 @@ class AsnParser {
3910
3922
  : Set;
3911
3923
  const newItem = new Container();
3912
3924
  newItem.valueBlock = asn1SchemaValue.valueBlock;
3913
- const value = fromBER(newItem.toBER(false)).result.valueBlock.value;
3925
+ const newItemAsn = fromBER(newItem.toBER(false));
3926
+ if (newItemAsn.offset === -1) {
3927
+ throw new Error(`Cannot parse the child item. ${newItemAsn.result.error}`);
3928
+ }
3929
+ if (!("value" in newItemAsn.result.valueBlock && Array.isArray(newItemAsn.result.valueBlock.value))) {
3930
+ throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");
3931
+ }
3932
+ const value = newItemAsn.result.valueBlock.value;
3914
3933
  res[key] = Array.from(value, (element) => converter.fromASN(element));
3915
3934
  }
3916
3935
  else {
@@ -3921,12 +3940,12 @@ class AsnParser {
3921
3940
  let value = asn1SchemaValue;
3922
3941
  if (schemaItem.implicit) {
3923
3942
  let newItem;
3924
- if (isConvertible(schemaItem.type)) {
3925
- newItem = new schemaItem.type().toSchema("");
3943
+ if (isConvertible(schemaItemType)) {
3944
+ newItem = new schemaItemType().toSchema("");
3926
3945
  }
3927
3946
  else {
3928
- const Asn1TypeName = AsnPropTypes[schemaItem.type];
3929
- const Asn1Type = asn1[Asn1TypeName];
3947
+ const Asn1TypeName = AsnPropTypes[schemaItemType];
3948
+ const Asn1Type = asn1js[Asn1TypeName];
3930
3949
  if (!Asn1Type) {
3931
3950
  throw new Error(`Cannot get '${Asn1TypeName}' class from asn1js module`);
3932
3951
  }
@@ -3940,10 +3959,13 @@ class AsnParser {
3940
3959
  }
3941
3960
  else {
3942
3961
  if (schemaItem.repeated) {
3943
- res[key] = Array.from(asn1SchemaValue, (element) => this.fromASN(element, schemaItem.type));
3962
+ if (!Array.isArray(asn1SchemaValue)) {
3963
+ throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");
3964
+ }
3965
+ res[key] = Array.from(asn1SchemaValue, (element) => this.fromASN(element, schemaItemType));
3944
3966
  }
3945
3967
  else {
3946
- res[key] = this.fromASN(asn1SchemaValue, schemaItem.type);
3968
+ res[key] = this.fromASN(asn1SchemaValue, schemaItemType);
3947
3969
  }
3948
3970
  }
3949
3971
  }
@@ -3966,14 +3988,20 @@ class AsnSerializer {
3966
3988
  return this.toASN(obj).toBER(false);
3967
3989
  }
3968
3990
  static toASN(obj) {
3969
- if (obj && isConvertible(obj.constructor)) {
3991
+ if (obj && typeof obj === "object" && isConvertible(obj)) {
3970
3992
  return obj.toASN();
3971
3993
  }
3994
+ if (!(obj && typeof obj === "object")) {
3995
+ throw new TypeError("Parameter 1 should be type of Object.");
3996
+ }
3972
3997
  const target = obj.constructor;
3973
3998
  const schema = schemaStorage.get(target);
3974
3999
  schemaStorage.cache(target);
3975
4000
  let asn1Value = [];
3976
4001
  if (schema.itemType) {
4002
+ if (!Array.isArray(obj)) {
4003
+ throw new TypeError("Parameter 1 should be type of Array.");
4004
+ }
3977
4005
  if (typeof schema.itemType === "number") {
3978
4006
  const converter = defaultConverter(schema.itemType);
3979
4007
  if (!converter) {
@@ -3995,13 +4023,13 @@ class AsnSerializer {
3995
4023
  && isArrayEqual(this.serialize(schemaItem.defaultValue), this.serialize(objProp)))) {
3996
4024
  continue;
3997
4025
  }
3998
- let asn1Item = AsnSerializer.toAsnItem(schemaItem, key, target, objProp);
4026
+ const asn1Item = AsnSerializer.toAsnItem(schemaItem, key, target, objProp);
3999
4027
  if (typeof schemaItem.context === "number") {
4000
4028
  if (schemaItem.implicit) {
4001
4029
  if (!schemaItem.repeated
4002
4030
  && (typeof schemaItem.type === "number" || isConvertible(schemaItem.type))) {
4003
4031
  const value = {};
4004
- value.valueHex = asn1Item instanceof Null ? asn1Item.valueBeforeDecode : asn1Item.valueBlock.toBER();
4032
+ value.valueHex = asn1Item instanceof Null ? asn1Item.valueBeforeDecodeView : asn1Item.valueBlock.toBER();
4005
4033
  asn1Value.push(new Primitive({
4006
4034
  optional: schemaItem.optional,
4007
4035
  idBlock: {
@@ -4066,6 +4094,9 @@ class AsnSerializer {
4066
4094
  throw new Error(`Property '${key}' doesn't have converter for type ${AsnPropTypes[schemaItem.type]} in schema '${target.name}'`);
4067
4095
  }
4068
4096
  if (schemaItem.repeated) {
4097
+ if (!Array.isArray(objProp)) {
4098
+ throw new TypeError("Parameter 'objProp' should be type of Array.");
4099
+ }
4069
4100
  const items = Array.from(objProp, (element) => converter.toASN(element));
4070
4101
  const Container = schemaItem.repeated === "sequence"
4071
4102
  ? Sequence
@@ -4080,6 +4111,9 @@ class AsnSerializer {
4080
4111
  }
4081
4112
  else {
4082
4113
  if (schemaItem.repeated) {
4114
+ if (!Array.isArray(objProp)) {
4115
+ throw new TypeError("Parameter 'objProp' should be type of Array.");
4116
+ }
4083
4117
  const items = Array.from(objProp, (element) => this.toASN(element));
4084
4118
  const Container = schemaItem.repeated === "sequence"
4085
4119
  ? Sequence
@@ -4118,8 +4152,8 @@ class AsnConvert {
4118
4152
  return AsnParser.parse(data, target);
4119
4153
  }
4120
4154
  static toString(data) {
4121
- const buf = index.build.BufferSourceConverter.isBufferSource(data)
4122
- ? index.build.BufferSourceConverter.toArrayBuffer(data)
4155
+ const buf = download.build.BufferSourceConverter.isBufferSource(data)
4156
+ ? download.build.BufferSourceConverter.toArrayBuffer(data)
4123
4157
  : AsnConvert.serialize(data);
4124
4158
  const asn = fromBER(buf);
4125
4159
  if (asn.offset === -1) {
@@ -4151,7 +4185,7 @@ function __decorate(decorators, target, key, desc) {
4151
4185
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4152
4186
  }
4153
4187
 
4154
- var ipaddr = _commonjsHelpers.createCommonjsModule(function (module) {
4188
+ var ipaddr = download.createCommonjsModule(function (module) {
4155
4189
  (function (root) {
4156
4190
  // A list of regular expressions that match arbitrary IPv4 addresses,
4157
4191
  // for which a number of weird notations exist.
@@ -5146,7 +5180,7 @@ var ipaddr = _commonjsHelpers.createCommonjsModule(function (module) {
5146
5180
  root.ipaddr = ipaddr;
5147
5181
  }
5148
5182
 
5149
- }(_commonjsHelpers.commonjsGlobal));
5183
+ }(download.commonjsGlobal));
5150
5184
  });
5151
5185
 
5152
5186
  class IpConverter {
@@ -5172,7 +5206,7 @@ class IpConverter {
5172
5206
  const addr = ipaddr.fromByteArray(Array.from(uint8));
5173
5207
  return addr.toString();
5174
5208
  }
5175
- return this.decodeIP(index.build.Convert.ToHex(buf));
5209
+ return this.decodeIP(download.build.Convert.ToHex(buf));
5176
5210
  }
5177
5211
  static fromString(text) {
5178
5212
  const addr = ipaddr.parse(text);
@@ -5214,7 +5248,7 @@ let AttributeValue = class AttributeValue extends DirectoryString {
5214
5248
  Object.assign(this, params);
5215
5249
  }
5216
5250
  toString() {
5217
- return this.ia5String || (this.anyValue ? index.build.Convert.ToHex(this.anyValue) : super.toString());
5251
+ return this.ia5String || (this.anyValue ? download.build.Convert.ToHex(this.anyValue) : super.toString());
5218
5252
  }
5219
5253
  };
5220
5254
  __decorate([
@@ -5431,7 +5465,7 @@ exports.DisplayText = class DisplayText {
5431
5465
  Object.assign(this, params);
5432
5466
  }
5433
5467
  toString() {
5434
- return this.ia5String || this.visibleString || this.bmpString || this.utf8String;
5468
+ return this.ia5String || this.visibleString || this.bmpString || this.utf8String || "";
5435
5469
  }
5436
5470
  };
5437
5471
  __decorate([
@@ -5522,19 +5556,21 @@ exports.CertificatePolicies = CertificatePolicies_1 = __decorate([
5522
5556
  AsnType({ type: AsnTypeTypes.Sequence, itemType: PolicyInformation })
5523
5557
  ], exports.CertificatePolicies);
5524
5558
 
5525
- let CRLNumber = class CRLNumber {
5559
+ const id_ce_cRLNumber = `${id_ce}.20`;
5560
+ exports.CRLNumber = class CRLNumber {
5526
5561
  constructor(value = 0) {
5527
5562
  this.value = value;
5528
5563
  }
5529
5564
  };
5530
5565
  __decorate([
5531
5566
  AsnProp({ type: AsnPropTypes.Integer })
5532
- ], CRLNumber.prototype, "value", void 0);
5533
- CRLNumber = __decorate([
5567
+ ], exports.CRLNumber.prototype, "value", void 0);
5568
+ exports.CRLNumber = __decorate([
5534
5569
  AsnType({ type: AsnTypeTypes.Choice })
5535
- ], CRLNumber);
5570
+ ], exports.CRLNumber);
5536
5571
 
5537
- let BaseCRLNumber = class BaseCRLNumber extends CRLNumber {
5572
+ const id_ce_deltaCRLIndicator = `${id_ce}.27`;
5573
+ let BaseCRLNumber = class BaseCRLNumber extends exports.CRLNumber {
5538
5574
  };
5539
5575
  BaseCRLNumber = __decorate([
5540
5576
  AsnType({ type: AsnTypeTypes.Choice })
@@ -5640,6 +5676,7 @@ FreshestCRL = FreshestCRL_1 = __decorate([
5640
5676
  AsnType({ type: AsnTypeTypes.Sequence, itemType: DistributionPoint })
5641
5677
  ], FreshestCRL);
5642
5678
 
5679
+ const id_ce_issuingDistributionPoint = `${id_ce}.28`;
5643
5680
  class IssuingDistributionPoint {
5644
5681
  constructor(params = {}) {
5645
5682
  this.onlyContainsUserCerts = IssuingDistributionPoint.ONLY;
@@ -5648,29 +5685,25 @@ class IssuingDistributionPoint {
5648
5685
  this.onlyContainsAttributeCerts = IssuingDistributionPoint.ONLY;
5649
5686
  Object.assign(this, params);
5650
5687
  }
5651
- ;
5652
- ;
5653
- ;
5654
- ;
5655
5688
  }
5656
5689
  IssuingDistributionPoint.ONLY = false;
5657
5690
  __decorate([
5658
5691
  AsnProp({ type: DistributionPointName, context: 0, optional: true })
5659
5692
  ], IssuingDistributionPoint.prototype, "distributionPoint", void 0);
5660
5693
  __decorate([
5661
- AsnProp({ type: AsnPropTypes.Boolean, context: 1, defaultValue: IssuingDistributionPoint.ONLY })
5694
+ AsnProp({ type: AsnPropTypes.Boolean, context: 1, defaultValue: IssuingDistributionPoint.ONLY, implicit: true })
5662
5695
  ], IssuingDistributionPoint.prototype, "onlyContainsUserCerts", void 0);
5663
5696
  __decorate([
5664
- AsnProp({ type: AsnPropTypes.Boolean, context: 2, defaultValue: IssuingDistributionPoint.ONLY })
5697
+ AsnProp({ type: AsnPropTypes.Boolean, context: 2, defaultValue: IssuingDistributionPoint.ONLY, implicit: true })
5665
5698
  ], IssuingDistributionPoint.prototype, "onlyContainsCACerts", void 0);
5666
5699
  __decorate([
5667
- AsnProp({ type: Reason, context: 3, optional: true })
5700
+ AsnProp({ type: Reason, context: 3, optional: true, implicit: true })
5668
5701
  ], IssuingDistributionPoint.prototype, "onlySomeReasons", void 0);
5669
5702
  __decorate([
5670
- AsnProp({ type: AsnPropTypes.Boolean, context: 4, defaultValue: IssuingDistributionPoint.ONLY })
5703
+ AsnProp({ type: AsnPropTypes.Boolean, context: 4, defaultValue: IssuingDistributionPoint.ONLY, implicit: true })
5671
5704
  ], IssuingDistributionPoint.prototype, "indirectCRL", void 0);
5672
5705
  __decorate([
5673
- AsnProp({ type: AsnPropTypes.Boolean, context: 5, defaultValue: IssuingDistributionPoint.ONLY })
5706
+ AsnProp({ type: AsnPropTypes.Boolean, context: 5, defaultValue: IssuingDistributionPoint.ONLY, implicit: true })
5674
5707
  ], IssuingDistributionPoint.prototype, "onlyContainsAttributeCerts", void 0);
5675
5708
 
5676
5709
  const id_ce_cRLReasons = `${id_ce}.21`;
@@ -6009,7 +6042,7 @@ class AlgorithmIdentifier {
6009
6042
  return data instanceof AlgorithmIdentifier
6010
6043
  && data.algorithm == this.algorithm
6011
6044
  && ((data.parameters && this.parameters
6012
- && index.build.isEqual(data.parameters, this.parameters))
6045
+ && download.build.isEqual(data.parameters, this.parameters))
6013
6046
  ||
6014
6047
  (data.parameters === this.parameters));
6015
6048
  }
@@ -6043,11 +6076,14 @@ __decorate([
6043
6076
  let Time = class Time {
6044
6077
  constructor(time) {
6045
6078
  if (time) {
6046
- if (typeof time === "string" || typeof time === "number") {
6047
- this.utcTime = new Date(time);
6048
- }
6049
- else if (time instanceof Date) {
6050
- this.utcTime = time;
6079
+ if (typeof time === "string" || typeof time === "number" || time instanceof Date) {
6080
+ const date = new Date(time);
6081
+ if (date.getUTCFullYear() > 2049) {
6082
+ this.generalTime = date;
6083
+ }
6084
+ else {
6085
+ this.utcTime = date;
6086
+ }
6051
6087
  }
6052
6088
  else {
6053
6089
  Object.assign(this, time);
@@ -8873,7 +8909,7 @@ var _Name_asn;
8873
8909
  class Name {
8874
8910
  constructor(data) {
8875
8911
  _Name_asn.set(this, new exports.Name$1());
8876
- if (index.build.BufferSourceConverter.isBufferSource(data)) {
8912
+ if (download.build.BufferSourceConverter.isBufferSource(data)) {
8877
8913
  __classPrivateFieldSet$1(this, _Name_asn, AsnParser.parse(data, exports.Name$1), "f");
8878
8914
  }
8879
8915
  else {
@@ -9078,8 +9114,8 @@ exports.CaVersion = class CaVersion {
9078
9114
  data.set(new Uint8Array(this.value), 4 - this.value.byteLength);
9079
9115
  }
9080
9116
  return {
9081
- keyIndex: parseInt(index.build.Convert.ToHex(data.slice(0, 2)), 16),
9082
- certificateIndex: parseInt(index.build.Convert.ToHex(data.slice(2)), 16),
9117
+ keyIndex: parseInt(download.build.Convert.ToHex(data.slice(0, 2)), 16),
9118
+ certificateIndex: parseInt(download.build.Convert.ToHex(data.slice(2)), 16),
9083
9119
  };
9084
9120
  }
9085
9121
  };
@@ -9497,7 +9533,7 @@ exports.LeiRole = __decorate([
9497
9533
  class ByteStream {
9498
9534
  constructor(bytes) {
9499
9535
  this.offset = 0;
9500
- this.view = index.build.BufferSourceConverter.toUint8Array(bytes);
9536
+ this.view = download.build.BufferSourceConverter.toUint8Array(bytes);
9501
9537
  }
9502
9538
  get position() {
9503
9539
  return this.offset;
@@ -9516,7 +9552,7 @@ class ByteStream {
9516
9552
  }
9517
9553
  readNumber(size) {
9518
9554
  const bytes = this.read(size);
9519
- const hex = index.build.Convert.ToHex(bytes);
9555
+ const hex = download.build.Convert.ToHex(bytes);
9520
9556
  return parseInt(hex, 16);
9521
9557
  }
9522
9558
  readEnd() {
@@ -9529,7 +9565,7 @@ class ByteStream {
9529
9565
 
9530
9566
  class Structure {
9531
9567
  static createStream(bytes) {
9532
- const view = index.build.BufferSourceConverter.toUint8Array(bytes);
9568
+ const view = download.build.BufferSourceConverter.toUint8Array(bytes);
9533
9569
  return new ByteStream(view);
9534
9570
  }
9535
9571
  }
@@ -9573,7 +9609,7 @@ class SignedCertificateTimestamp extends Structure {
9573
9609
  parse(stream) {
9574
9610
  this.version = stream.readByte();
9575
9611
  stream.read(2);
9576
- this.logId = index.build.BufferSourceConverter.toArrayBuffer(stream.read(32));
9612
+ this.logId = download.build.BufferSourceConverter.toArrayBuffer(stream.read(32));
9577
9613
  this.timestamp = new Date(stream.readNumber(8));
9578
9614
  const extLen = stream.readNumber(2);
9579
9615
  this.extensions = stream.read(extLen).buffer;
@@ -9584,12 +9620,12 @@ class SignedCertificateTimestamp extends Structure {
9584
9620
  toJSON() {
9585
9621
  return {
9586
9622
  version: this.version,
9587
- logId: index.build.Convert.ToHex(this.logId),
9623
+ logId: download.build.Convert.ToHex(this.logId),
9588
9624
  timestamp: this.timestamp,
9589
- extensions: index.build.Convert.ToBase64(this.extensions),
9625
+ extensions: download.build.Convert.ToBase64(this.extensions),
9590
9626
  hashAlgorithm: HashAlgorithm[this.hashAlgorithm] || "undefined",
9591
9627
  signatureAlgorithm: SignatureAlgorithm[this.signatureAlgorithm] || "undefined",
9592
- signature: index.build.Convert.ToBase64(this.signature),
9628
+ signature: download.build.Convert.ToBase64(this.signature),
9593
9629
  };
9594
9630
  }
9595
9631
  }
@@ -10011,7 +10047,7 @@ class AsnData {
10011
10047
  else {
10012
10048
  // raw, type
10013
10049
  __classPrivateFieldSet(this, _AsnData_asn, AsnConvert.parse(args[0], args[1]), "f");
10014
- __classPrivateFieldSet(this, _AsnData_raw, index.build.BufferSourceConverter.toArrayBuffer(args[0]), "f");
10050
+ __classPrivateFieldSet(this, _AsnData_raw, download.build.BufferSourceConverter.toArrayBuffer(args[0]), "f");
10015
10051
  }
10016
10052
  }
10017
10053
  get asn() {
@@ -10055,6 +10091,9 @@ class Extension extends AsnData {
10055
10091
  case '2.5.29.46':
10056
10092
  this.value = AsnParser.parse(asnExtnValue, exports.CRLDistributionPoints);
10057
10093
  break;
10094
+ case id_ce_issuingDistributionPoint:
10095
+ this.value = AsnParser.parse(asnExtnValue, IssuingDistributionPoint);
10096
+ break;
10058
10097
  case id_ce_cRLReasons:
10059
10098
  this.value = AsnParser.parse(asnExtnValue, exports.CRLReason);
10060
10099
  break;
@@ -10143,14 +10182,20 @@ class Extension extends AsnData {
10143
10182
  case id_pe_subjectInfoAccess:
10144
10183
  this.value = AsnParser.parse(asnExtnValue, exports.SubjectInfoAccessSyntax);
10145
10184
  break;
10185
+ case id_ce_cRLNumber:
10186
+ this.value = AsnParser.parse(asnExtnValue, exports.CRLNumber);
10187
+ break;
10188
+ case id_ce_deltaCRLIndicator:
10189
+ this.value = AsnParser.parse(asnExtnValue, BaseCRLNumber);
10190
+ break;
10146
10191
  default:
10147
10192
  console.warn(`Didn't detect parser for "${this.asn.extnID}" extension.`);
10148
- this.value = index.build.Convert.ToHex(asnExtnValue);
10193
+ this.value = download.build.Convert.ToHex(asnExtnValue);
10149
10194
  }
10150
10195
  }
10151
10196
  catch (error) {
10152
10197
  console.error(`Error parse "${this.asn.extnID}" extension:`, error.message);
10153
- this.value = index.build.Convert.ToHex(asnExtnValue);
10198
+ this.value = download.build.Convert.ToHex(asnExtnValue);
10154
10199
  }
10155
10200
  }
10156
10201
  getAsnExtnValue() {
@@ -10199,10 +10244,11 @@ class CryptoProvider {
10199
10244
  CryptoProvider.DEFAULT = 'default';
10200
10245
  const cryptoProvider = new CryptoProvider();
10201
10246
 
10202
- const base64Clarify = (base64) => (base64
10203
- .replace(/.*base64,/, '')
10204
- .replace(/-----.+-----/g, '')
10205
- .replace(/[\s\r\n]/g, ''));
10247
+ const base64Re = /-----BEGIN [^-]+-----([A-Za-z0-9+/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+/=\s]+)====/;
10248
+ const base64Clarify = (base64) => {
10249
+ const execArray = base64Re.exec(base64);
10250
+ return execArray ? (execArray[1] || execArray[2]) : base64;
10251
+ };
10206
10252
  const hexFormat = (hex) => (hex
10207
10253
  .replace(/(.{32})/g, '$1\n')
10208
10254
  .replace(/(.{4})/g, '$1 ')
@@ -10213,13 +10259,13 @@ const certificateRawToBuffer = (raw) => {
10213
10259
  const rawClarified = base64Clarify(raw);
10214
10260
  let buffer;
10215
10261
  if (isHex(rawClarified)) {
10216
- buffer = index.build.Convert.FromHex(rawClarified);
10262
+ buffer = download.build.Convert.FromHex(rawClarified);
10217
10263
  }
10218
10264
  else if (isBase64(rawClarified) || isPem(rawClarified)) {
10219
- buffer = index.build.Convert.FromBase64(rawClarified);
10265
+ buffer = download.build.Convert.FromBase64(rawClarified);
10220
10266
  }
10221
10267
  else {
10222
- buffer = index.build.Convert.FromBinary(raw);
10268
+ buffer = download.build.Convert.FromBinary(raw);
10223
10269
  }
10224
10270
  return buffer;
10225
10271
  };
@@ -10883,6 +10929,77 @@ __decorate([
10883
10929
  AsnProp({ type: EncapsulatedContent, context: 0, optional: true })
10884
10930
  ], EncapsulatedContentInfo.prototype, "eContent", void 0);
10885
10931
 
10932
+ var CMSVersion;
10933
+ (function (CMSVersion) {
10934
+ CMSVersion[CMSVersion["v0"] = 0] = "v0";
10935
+ CMSVersion[CMSVersion["v1"] = 1] = "v1";
10936
+ CMSVersion[CMSVersion["v2"] = 2] = "v2";
10937
+ CMSVersion[CMSVersion["v3"] = 3] = "v3";
10938
+ CMSVersion[CMSVersion["v4"] = 4] = "v4";
10939
+ CMSVersion[CMSVersion["v5"] = 5] = "v5";
10940
+ })(CMSVersion || (CMSVersion = {}));
10941
+ let DigestAlgorithmIdentifier = class DigestAlgorithmIdentifier extends AlgorithmIdentifier {
10942
+ };
10943
+ DigestAlgorithmIdentifier = __decorate([
10944
+ AsnType({ type: AsnTypeTypes.Sequence })
10945
+ ], DigestAlgorithmIdentifier);
10946
+ let SignatureAlgorithmIdentifier = class SignatureAlgorithmIdentifier extends AlgorithmIdentifier {
10947
+ };
10948
+ SignatureAlgorithmIdentifier = __decorate([
10949
+ AsnType({ type: AsnTypeTypes.Sequence })
10950
+ ], SignatureAlgorithmIdentifier);
10951
+ let KeyEncryptionAlgorithmIdentifier = class KeyEncryptionAlgorithmIdentifier extends AlgorithmIdentifier {
10952
+ };
10953
+ KeyEncryptionAlgorithmIdentifier = __decorate([
10954
+ AsnType({ type: AsnTypeTypes.Sequence })
10955
+ ], KeyEncryptionAlgorithmIdentifier);
10956
+ let ContentEncryptionAlgorithmIdentifier = class ContentEncryptionAlgorithmIdentifier extends AlgorithmIdentifier {
10957
+ };
10958
+ ContentEncryptionAlgorithmIdentifier = __decorate([
10959
+ AsnType({ type: AsnTypeTypes.Sequence })
10960
+ ], ContentEncryptionAlgorithmIdentifier);
10961
+ let MessageAuthenticationCodeAlgorithm = class MessageAuthenticationCodeAlgorithm extends AlgorithmIdentifier {
10962
+ };
10963
+ MessageAuthenticationCodeAlgorithm = __decorate([
10964
+ AsnType({ type: AsnTypeTypes.Sequence })
10965
+ ], MessageAuthenticationCodeAlgorithm);
10966
+ let KeyDerivationAlgorithmIdentifier = class KeyDerivationAlgorithmIdentifier extends AlgorithmIdentifier {
10967
+ };
10968
+ KeyDerivationAlgorithmIdentifier = __decorate([
10969
+ AsnType({ type: AsnTypeTypes.Sequence })
10970
+ ], KeyDerivationAlgorithmIdentifier);
10971
+
10972
+ let EncryptedContent = class EncryptedContent {
10973
+ constructor(params = {}) {
10974
+ Object.assign(this, params);
10975
+ }
10976
+ };
10977
+ __decorate([
10978
+ AsnProp({ type: OctetString, context: 0, implicit: true, optional: true })
10979
+ ], EncryptedContent.prototype, "value", void 0);
10980
+ __decorate([
10981
+ AsnProp({ type: OctetString, converter: AsnConstructedOctetStringConverter, context: 0, implicit: true, optional: true, repeated: "sequence" })
10982
+ ], EncryptedContent.prototype, "constructedValue", void 0);
10983
+ EncryptedContent = __decorate([
10984
+ AsnType({ type: AsnTypeTypes.Choice })
10985
+ ], EncryptedContent);
10986
+ class EncryptedContentInfo {
10987
+ constructor(params = {}) {
10988
+ this.contentType = "";
10989
+ this.contentEncryptionAlgorithm = new ContentEncryptionAlgorithmIdentifier();
10990
+ Object.assign(this, params);
10991
+ }
10992
+ }
10993
+ __decorate([
10994
+ AsnProp({ type: AsnPropTypes.ObjectIdentifier })
10995
+ ], EncryptedContentInfo.prototype, "contentType", void 0);
10996
+ __decorate([
10997
+ AsnProp({ type: ContentEncryptionAlgorithmIdentifier })
10998
+ ], EncryptedContentInfo.prototype, "contentEncryptionAlgorithm", void 0);
10999
+ __decorate([
11000
+ AsnProp({ type: EncryptedContent, optional: true })
11001
+ ], EncryptedContentInfo.prototype, "encryptedContent", void 0);
11002
+
10886
11003
  class IssuerAndSerialNumber {
10887
11004
  constructor(params = {}) {
10888
11005
  this.issuer = new exports.Name$1;
@@ -10897,6 +11014,268 @@ __decorate([
10897
11014
  AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
10898
11015
  ], IssuerAndSerialNumber.prototype, "serialNumber", void 0);
10899
11016
 
11017
+ class OtherKeyAttribute {
11018
+ constructor(params = {}) {
11019
+ this.keyAttrId = "";
11020
+ Object.assign(this, params);
11021
+ }
11022
+ }
11023
+ __decorate([
11024
+ AsnProp({ type: AsnPropTypes.ObjectIdentifier })
11025
+ ], OtherKeyAttribute.prototype, "keyAttrId", void 0);
11026
+ __decorate([
11027
+ AsnProp({ type: AsnPropTypes.Any, optional: true })
11028
+ ], OtherKeyAttribute.prototype, "keyAttr", void 0);
11029
+
11030
+ var RecipientEncryptedKeys_1;
11031
+ class RecipientKeyIdentifier {
11032
+ constructor(params = {}) {
11033
+ this.subjectKeyIdentifier = new SubjectKeyIdentifier();
11034
+ Object.assign(this, params);
11035
+ }
11036
+ }
11037
+ __decorate([
11038
+ AsnProp({ type: SubjectKeyIdentifier })
11039
+ ], RecipientKeyIdentifier.prototype, "subjectKeyIdentifier", void 0);
11040
+ __decorate([
11041
+ AsnProp({ type: AsnPropTypes.GeneralizedTime, optional: true })
11042
+ ], RecipientKeyIdentifier.prototype, "date", void 0);
11043
+ __decorate([
11044
+ AsnProp({ type: OtherKeyAttribute, optional: true })
11045
+ ], RecipientKeyIdentifier.prototype, "other", void 0);
11046
+ let KeyAgreeRecipientIdentifier = class KeyAgreeRecipientIdentifier {
11047
+ constructor(params = {}) {
11048
+ Object.assign(this, params);
11049
+ }
11050
+ };
11051
+ __decorate([
11052
+ AsnProp({ type: RecipientKeyIdentifier, context: 0, implicit: true, optional: true })
11053
+ ], KeyAgreeRecipientIdentifier.prototype, "rKeyId", void 0);
11054
+ __decorate([
11055
+ AsnProp({ type: IssuerAndSerialNumber, optional: true })
11056
+ ], KeyAgreeRecipientIdentifier.prototype, "issuerAndSerialNumber", void 0);
11057
+ KeyAgreeRecipientIdentifier = __decorate([
11058
+ AsnType({ type: AsnTypeTypes.Choice })
11059
+ ], KeyAgreeRecipientIdentifier);
11060
+ class RecipientEncryptedKey {
11061
+ constructor(params = {}) {
11062
+ this.rid = new KeyAgreeRecipientIdentifier();
11063
+ this.encryptedKey = new OctetString();
11064
+ Object.assign(this, params);
11065
+ }
11066
+ }
11067
+ __decorate([
11068
+ AsnProp({ type: KeyAgreeRecipientIdentifier })
11069
+ ], RecipientEncryptedKey.prototype, "rid", void 0);
11070
+ __decorate([
11071
+ AsnProp({ type: OctetString })
11072
+ ], RecipientEncryptedKey.prototype, "encryptedKey", void 0);
11073
+ let RecipientEncryptedKeys = RecipientEncryptedKeys_1 = class RecipientEncryptedKeys extends AsnArray {
11074
+ constructor(items) {
11075
+ super(items);
11076
+ Object.setPrototypeOf(this, RecipientEncryptedKeys_1.prototype);
11077
+ }
11078
+ };
11079
+ RecipientEncryptedKeys = RecipientEncryptedKeys_1 = __decorate([
11080
+ AsnType({ type: AsnTypeTypes.Sequence, itemType: RecipientEncryptedKey })
11081
+ ], RecipientEncryptedKeys);
11082
+ class OriginatorPublicKey {
11083
+ constructor(params = {}) {
11084
+ this.algorithm = new AlgorithmIdentifier();
11085
+ this.publicKey = new ArrayBuffer(0);
11086
+ Object.assign(this, params);
11087
+ }
11088
+ }
11089
+ __decorate([
11090
+ AsnProp({ type: AlgorithmIdentifier })
11091
+ ], OriginatorPublicKey.prototype, "algorithm", void 0);
11092
+ __decorate([
11093
+ AsnProp({ type: AsnPropTypes.BitString })
11094
+ ], OriginatorPublicKey.prototype, "publicKey", void 0);
11095
+ let OriginatorIdentifierOrKey = class OriginatorIdentifierOrKey {
11096
+ constructor(params = {}) {
11097
+ Object.assign(this, params);
11098
+ }
11099
+ };
11100
+ __decorate([
11101
+ AsnProp({ type: SubjectKeyIdentifier, context: 0, implicit: true, optional: true })
11102
+ ], OriginatorIdentifierOrKey.prototype, "subjectKeyIdentifier", void 0);
11103
+ __decorate([
11104
+ AsnProp({ type: OriginatorPublicKey, context: 1, implicit: true, optional: true })
11105
+ ], OriginatorIdentifierOrKey.prototype, "originatorKey", void 0);
11106
+ __decorate([
11107
+ AsnProp({ type: IssuerAndSerialNumber, optional: true })
11108
+ ], OriginatorIdentifierOrKey.prototype, "issuerAndSerialNumber", void 0);
11109
+ OriginatorIdentifierOrKey = __decorate([
11110
+ AsnType({ type: AsnTypeTypes.Choice })
11111
+ ], OriginatorIdentifierOrKey);
11112
+ class KeyAgreeRecipientInfo {
11113
+ constructor(params = {}) {
11114
+ this.version = CMSVersion.v3;
11115
+ this.originator = new OriginatorIdentifierOrKey();
11116
+ this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();
11117
+ this.recipientEncryptedKeys = new RecipientEncryptedKeys();
11118
+ Object.assign(this, params);
11119
+ }
11120
+ }
11121
+ __decorate([
11122
+ AsnProp({ type: AsnPropTypes.Integer })
11123
+ ], KeyAgreeRecipientInfo.prototype, "version", void 0);
11124
+ __decorate([
11125
+ AsnProp({ type: OriginatorIdentifierOrKey, context: 0 })
11126
+ ], KeyAgreeRecipientInfo.prototype, "originator", void 0);
11127
+ __decorate([
11128
+ AsnProp({ type: OctetString, context: 1, optional: true })
11129
+ ], KeyAgreeRecipientInfo.prototype, "ukm", void 0);
11130
+ __decorate([
11131
+ AsnProp({ type: KeyEncryptionAlgorithmIdentifier })
11132
+ ], KeyAgreeRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0);
11133
+ __decorate([
11134
+ AsnProp({ type: RecipientEncryptedKeys })
11135
+ ], KeyAgreeRecipientInfo.prototype, "recipientEncryptedKeys", void 0);
11136
+
11137
+ let RecipientIdentifier = class RecipientIdentifier {
11138
+ constructor(params = {}) {
11139
+ Object.assign(this, params);
11140
+ }
11141
+ };
11142
+ __decorate([
11143
+ AsnProp({ type: SubjectKeyIdentifier, context: 0, implicit: true })
11144
+ ], RecipientIdentifier.prototype, "subjectKeyIdentifier", void 0);
11145
+ __decorate([
11146
+ AsnProp({ type: IssuerAndSerialNumber })
11147
+ ], RecipientIdentifier.prototype, "issuerAndSerialNumber", void 0);
11148
+ RecipientIdentifier = __decorate([
11149
+ AsnType({ type: AsnTypeTypes.Choice })
11150
+ ], RecipientIdentifier);
11151
+ class KeyTransRecipientInfo {
11152
+ constructor(params = {}) {
11153
+ this.version = CMSVersion.v0;
11154
+ this.rid = new RecipientIdentifier();
11155
+ this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();
11156
+ this.encryptedKey = new OctetString();
11157
+ Object.assign(this, params);
11158
+ }
11159
+ }
11160
+ __decorate([
11161
+ AsnProp({ type: AsnPropTypes.Integer })
11162
+ ], KeyTransRecipientInfo.prototype, "version", void 0);
11163
+ __decorate([
11164
+ AsnProp({ type: RecipientIdentifier })
11165
+ ], KeyTransRecipientInfo.prototype, "rid", void 0);
11166
+ __decorate([
11167
+ AsnProp({ type: KeyEncryptionAlgorithmIdentifier })
11168
+ ], KeyTransRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0);
11169
+ __decorate([
11170
+ AsnProp({ type: OctetString })
11171
+ ], KeyTransRecipientInfo.prototype, "encryptedKey", void 0);
11172
+
11173
+ class KEKIdentifier {
11174
+ constructor(params = {}) {
11175
+ this.keyIdentifier = new OctetString();
11176
+ Object.assign(this, params);
11177
+ }
11178
+ }
11179
+ __decorate([
11180
+ AsnProp({ type: OctetString })
11181
+ ], KEKIdentifier.prototype, "keyIdentifier", void 0);
11182
+ __decorate([
11183
+ AsnProp({ type: AsnPropTypes.GeneralizedTime, optional: true })
11184
+ ], KEKIdentifier.prototype, "date", void 0);
11185
+ __decorate([
11186
+ AsnProp({ type: OtherKeyAttribute, optional: true })
11187
+ ], KEKIdentifier.prototype, "other", void 0);
11188
+ class KEKRecipientInfo {
11189
+ constructor(params = {}) {
11190
+ this.version = CMSVersion.v4;
11191
+ this.kekid = new KEKIdentifier();
11192
+ this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();
11193
+ this.encryptedKey = new OctetString();
11194
+ Object.assign(this, params);
11195
+ }
11196
+ }
11197
+ __decorate([
11198
+ AsnProp({ type: AsnPropTypes.Integer })
11199
+ ], KEKRecipientInfo.prototype, "version", void 0);
11200
+ __decorate([
11201
+ AsnProp({ type: KEKIdentifier })
11202
+ ], KEKRecipientInfo.prototype, "kekid", void 0);
11203
+ __decorate([
11204
+ AsnProp({ type: KeyEncryptionAlgorithmIdentifier })
11205
+ ], KEKRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0);
11206
+ __decorate([
11207
+ AsnProp({ type: OctetString })
11208
+ ], KEKRecipientInfo.prototype, "encryptedKey", void 0);
11209
+
11210
+ class PasswordRecipientInfo {
11211
+ constructor(params = {}) {
11212
+ this.version = CMSVersion.v0;
11213
+ this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();
11214
+ this.encryptedKey = new OctetString();
11215
+ Object.assign(this, params);
11216
+ }
11217
+ }
11218
+ __decorate([
11219
+ AsnProp({ type: AsnPropTypes.Integer })
11220
+ ], PasswordRecipientInfo.prototype, "version", void 0);
11221
+ __decorate([
11222
+ AsnProp({ type: KeyDerivationAlgorithmIdentifier, context: 0, optional: true })
11223
+ ], PasswordRecipientInfo.prototype, "keyDerivationAlgorithm", void 0);
11224
+ __decorate([
11225
+ AsnProp({ type: KeyEncryptionAlgorithmIdentifier })
11226
+ ], PasswordRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0);
11227
+ __decorate([
11228
+ AsnProp({ type: OctetString })
11229
+ ], PasswordRecipientInfo.prototype, "encryptedKey", void 0);
11230
+
11231
+ class OtherRecipientInfo {
11232
+ constructor(params = {}) {
11233
+ this.oriType = "";
11234
+ this.oriValue = new ArrayBuffer(0);
11235
+ Object.assign(this, params);
11236
+ }
11237
+ }
11238
+ __decorate([
11239
+ AsnProp({ type: AsnPropTypes.ObjectIdentifier })
11240
+ ], OtherRecipientInfo.prototype, "oriType", void 0);
11241
+ __decorate([
11242
+ AsnProp({ type: AsnPropTypes.Any })
11243
+ ], OtherRecipientInfo.prototype, "oriValue", void 0);
11244
+ let RecipientInfo = class RecipientInfo {
11245
+ constructor(params = {}) {
11246
+ Object.assign(this, params);
11247
+ }
11248
+ };
11249
+ __decorate([
11250
+ AsnProp({ type: KeyTransRecipientInfo, optional: true })
11251
+ ], RecipientInfo.prototype, "ktri", void 0);
11252
+ __decorate([
11253
+ AsnProp({ type: KeyAgreeRecipientInfo, context: 1, implicit: true, optional: true })
11254
+ ], RecipientInfo.prototype, "kari", void 0);
11255
+ __decorate([
11256
+ AsnProp({ type: KEKRecipientInfo, context: 2, implicit: true, optional: true })
11257
+ ], RecipientInfo.prototype, "kekri", void 0);
11258
+ __decorate([
11259
+ AsnProp({ type: PasswordRecipientInfo, context: 3, implicit: true, optional: true })
11260
+ ], RecipientInfo.prototype, "pwri", void 0);
11261
+ __decorate([
11262
+ AsnProp({ type: OtherRecipientInfo, context: 4, implicit: true, optional: true })
11263
+ ], RecipientInfo.prototype, "ori", void 0);
11264
+ RecipientInfo = __decorate([
11265
+ AsnType({ type: AsnTypeTypes.Choice })
11266
+ ], RecipientInfo);
11267
+
11268
+ var RecipientInfos_1;
11269
+ let RecipientInfos = RecipientInfos_1 = class RecipientInfos extends AsnArray {
11270
+ constructor(items) {
11271
+ super(items);
11272
+ Object.setPrototypeOf(this, RecipientInfos_1.prototype);
11273
+ }
11274
+ };
11275
+ RecipientInfos = RecipientInfos_1 = __decorate([
11276
+ AsnType({ type: AsnTypeTypes.Set, itemType: RecipientInfo })
11277
+ ], RecipientInfos);
11278
+
10900
11279
  var RevocationInfoChoices_1;
10901
11280
  class OtherRevocationInfoFormat {
10902
11281
  constructor(params = {}) {
@@ -10933,25 +11312,51 @@ RevocationInfoChoices = RevocationInfoChoices_1 = __decorate([
10933
11312
  AsnType({ type: AsnTypeTypes.Set, itemType: RevocationInfoChoice })
10934
11313
  ], RevocationInfoChoices);
10935
11314
 
10936
- var CMSVersion;
10937
- (function (CMSVersion) {
10938
- CMSVersion[CMSVersion["v0"] = 0] = "v0";
10939
- CMSVersion[CMSVersion["v1"] = 1] = "v1";
10940
- CMSVersion[CMSVersion["v2"] = 2] = "v2";
10941
- CMSVersion[CMSVersion["v3"] = 3] = "v3";
10942
- CMSVersion[CMSVersion["v4"] = 4] = "v4";
10943
- CMSVersion[CMSVersion["v5"] = 5] = "v5";
10944
- })(CMSVersion || (CMSVersion = {}));
10945
- let DigestAlgorithmIdentifier = class DigestAlgorithmIdentifier extends AlgorithmIdentifier {
10946
- };
10947
- DigestAlgorithmIdentifier = __decorate([
10948
- AsnType({ type: AsnTypeTypes.Sequence })
10949
- ], DigestAlgorithmIdentifier);
10950
- let SignatureAlgorithmIdentifier = class SignatureAlgorithmIdentifier extends AlgorithmIdentifier {
11315
+ class OriginatorInfo {
11316
+ constructor(params = {}) {
11317
+ Object.assign(this, params);
11318
+ }
11319
+ }
11320
+ __decorate([
11321
+ AsnProp({ type: CertificateSet, context: 0, implicit: true, optional: true })
11322
+ ], OriginatorInfo.prototype, "certs", void 0);
11323
+ __decorate([
11324
+ AsnProp({ type: RevocationInfoChoices, context: 1, implicit: true, optional: true })
11325
+ ], OriginatorInfo.prototype, "crls", void 0);
11326
+
11327
+ var UnprotectedAttributes_1;
11328
+ let UnprotectedAttributes = UnprotectedAttributes_1 = class UnprotectedAttributes extends AsnArray {
11329
+ constructor(items) {
11330
+ super(items);
11331
+ Object.setPrototypeOf(this, UnprotectedAttributes_1.prototype);
11332
+ }
10951
11333
  };
10952
- SignatureAlgorithmIdentifier = __decorate([
10953
- AsnType({ type: AsnTypeTypes.Sequence })
10954
- ], SignatureAlgorithmIdentifier);
11334
+ UnprotectedAttributes = UnprotectedAttributes_1 = __decorate([
11335
+ AsnType({ type: AsnTypeTypes.Set, itemType: Attribute })
11336
+ ], UnprotectedAttributes);
11337
+ class EnvelopedData {
11338
+ constructor(params = {}) {
11339
+ this.version = CMSVersion.v0;
11340
+ this.recipientInfos = new RecipientInfos();
11341
+ this.encryptedContentInfo = new EncryptedContentInfo();
11342
+ Object.assign(this, params);
11343
+ }
11344
+ }
11345
+ __decorate([
11346
+ AsnProp({ type: AsnPropTypes.Integer })
11347
+ ], EnvelopedData.prototype, "version", void 0);
11348
+ __decorate([
11349
+ AsnProp({ type: OriginatorInfo, context: 0, implicit: true, optional: true })
11350
+ ], EnvelopedData.prototype, "originatorInfo", void 0);
11351
+ __decorate([
11352
+ AsnProp({ type: RecipientInfos })
11353
+ ], EnvelopedData.prototype, "recipientInfos", void 0);
11354
+ __decorate([
11355
+ AsnProp({ type: EncryptedContentInfo })
11356
+ ], EnvelopedData.prototype, "encryptedContentInfo", void 0);
11357
+ __decorate([
11358
+ AsnProp({ type: UnprotectedAttributes, context: 1, implicit: true, optional: true })
11359
+ ], EnvelopedData.prototype, "unprotectedAttrs", void 0);
10955
11360
 
10956
11361
  let SignerIdentifier = class SignerIdentifier {
10957
11362
  constructor(params = {}) {
@@ -11518,12 +11923,14 @@ exports.AttributeCertificate = AttributeCertificate;
11518
11923
  exports.AuthorityKeyIdentifier = AuthorityKeyIdentifier;
11519
11924
  exports.BasicConstraints = BasicConstraints;
11520
11925
  exports.Certificate = Certificate;
11926
+ exports.CertificateList = CertificateList;
11521
11927
  exports.CertificateTemplate = CertificateTemplate;
11522
11928
  exports.CertificateTransparency = CertificateTransparency;
11523
11929
  exports.CertificationRequest = CertificationRequest;
11524
11930
  exports.EDIPartyName = EDIPartyName;
11525
11931
  exports.EntrustVersionInfo = EntrustVersionInfo;
11526
11932
  exports.Extension = Extension;
11933
+ exports.IssuingDistributionPoint = IssuingDistributionPoint;
11527
11934
  exports.KeyUsage = KeyUsage;
11528
11935
  exports.LogotypeExtn = LogotypeExtn;
11529
11936
  exports.Name = Name;
@@ -11558,4 +11965,5 @@ exports.id_rsaEncryption = id_rsaEncryption;
11558
11965
  exports.isPem = isPem;
11559
11966
  exports.isPkcs10Pem = isPkcs10Pem;
11560
11967
  exports.isX509AttributePem = isX509AttributePem;
11968
+ exports.isX509CRLPem = isX509CRLPem;
11561
11969
  exports.isX509Pem = isX509Pem;