node-opcua-crypto-web 5.11.0 → 6.1.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.
package/dist/index_web.js CHANGED
@@ -11060,24 +11060,24 @@ var require_algorithms = __commonJS({
11060
11060
  id: ""
11061
11061
  },
11062
11062
  sha256: {
11063
- sign: "ecdsa",
11063
+ sign: "ecdsa/rsa",
11064
11064
  hash: "sha256",
11065
- id: ""
11065
+ id: "3031300d060960864801650304020105000420"
11066
11066
  },
11067
11067
  sha224: {
11068
- sign: "ecdsa",
11068
+ sign: "ecdsa/rsa",
11069
11069
  hash: "sha224",
11070
- id: ""
11070
+ id: "302d300d06096086480165030402040500041c"
11071
11071
  },
11072
11072
  sha384: {
11073
- sign: "ecdsa",
11073
+ sign: "ecdsa/rsa",
11074
11074
  hash: "sha384",
11075
- id: ""
11075
+ id: "3041300d060960864801650304020205000430"
11076
11076
  },
11077
11077
  sha512: {
11078
- sign: "ecdsa",
11078
+ sign: "ecdsa/rsa",
11079
11079
  hash: "sha512",
11080
- id: ""
11080
+ id: "3051300d060960864801650304020305000440"
11081
11081
  },
11082
11082
  "DSA-SHA": {
11083
11083
  sign: "dsa",
@@ -35356,14 +35356,14 @@ var require_asn12 = __commonJS({
35356
35356
  );
35357
35357
  });
35358
35358
  exports2.PublicKey = PublicKey2;
35359
- var PrivateKeyInfo2 = asn12.define("PrivateKeyInfo", function() {
35359
+ var PrivateKeyInfo4 = asn12.define("PrivateKeyInfo", function() {
35360
35360
  this.seq().obj(
35361
35361
  this.key("version")["int"](),
35362
35362
  this.key("algorithm").use(AlgorithmIdentifier2),
35363
35363
  this.key("subjectPrivateKey").octstr()
35364
35364
  );
35365
35365
  });
35366
- exports2.PrivateKey = PrivateKeyInfo2;
35366
+ exports2.PrivateKey = PrivateKeyInfo4;
35367
35367
  var EncryptedPrivateKeyInfo4 = asn12.define("EncryptedPrivateKeyInfo", function() {
35368
35368
  this.seq().obj(
35369
35369
  this.key("algorithm").seq().obj(
@@ -47594,9 +47594,56 @@ function combine_der(certificates) {
47594
47594
 
47595
47595
  // ../node-opcua-crypto/source/explore_certificate_revocation_list.ts
47596
47596
  init_inject_buffer();
47597
+ var crlReasonNames = {
47598
+ 0: "unspecified",
47599
+ 1: "keyCompromise",
47600
+ 2: "cACompromise",
47601
+ 3: "affiliationChanged",
47602
+ 4: "superseded",
47603
+ 5: "cessationOfOperation",
47604
+ 6: "certificateHold",
47605
+ 8: "removeFromCRL",
47606
+ 9: "privilegeWithdrawn",
47607
+ 10: "aACompromise"
47608
+ };
47597
47609
  function readNameForCrl(buffer, block) {
47598
47610
  return readDirectoryName(buffer, block);
47599
47611
  }
47612
+ function _readCrlEntryExtensions(buffer, block) {
47613
+ const result = {};
47614
+ for (const extensionBlock of readStruct(buffer, block)) {
47615
+ const inner = readStruct(buffer, extensionBlock);
47616
+ const { oid } = readObjectIdentifier(buffer, inner[0]);
47617
+ const extnValue = inner[inner.length - 1];
47618
+ const value = readTag(buffer, extnValue.position);
47619
+ switch (oid) {
47620
+ case "2.5.29.21": {
47621
+ const code = readIntegerValue(buffer, { ...value, tag: 2 /* INTEGER */ });
47622
+ result.reasonCode = crlReasonNames[code] ?? `unknown(${code})`;
47623
+ break;
47624
+ }
47625
+ case "2.5.29.24":
47626
+ result.invalidityDate = readTime(buffer, value);
47627
+ break;
47628
+ default:
47629
+ result[oid] = getBlock(buffer, extnValue);
47630
+ }
47631
+ }
47632
+ return result;
47633
+ }
47634
+ function _readRevokedCertificates(buffer, block) {
47635
+ return readStruct(buffer, block).map((r) => {
47636
+ const rr = readStruct(buffer, r);
47637
+ const revokedCertificate = {
47638
+ revocationDate: readTime(buffer, rr[1]),
47639
+ userCertificate: formatBuffer2DigitHexWithColum(readLongIntegerValue(buffer, rr[0]))
47640
+ };
47641
+ if (rr[2]) {
47642
+ revokedCertificate.crlEntryExtensions = _readCrlEntryExtensions(buffer, rr[2]);
47643
+ }
47644
+ return revokedCertificate;
47645
+ });
47646
+ }
47600
47647
  function _readTbsCertList(buffer, blockInfo) {
47601
47648
  const blocks = readStruct(buffer, blockInfo);
47602
47649
  const hasOptionalVersion = blocks[0].tag === 2 /* INTEGER */;
@@ -47609,16 +47656,7 @@ function _readTbsCertList(buffer, blockInfo) {
47609
47656
  const nextUpdate = readTime(buffer, blocks[4]);
47610
47657
  const revokedCertificates = [];
47611
47658
  if (blocks[5] && blocks[5].tag < 128) {
47612
- const list = readStruct(buffer, blocks[5]);
47613
- for (const r of list) {
47614
- const rr = readStruct(buffer, r);
47615
- const userCertificate = formatBuffer2DigitHexWithColum(readLongIntegerValue(buffer, rr[0]));
47616
- const revocationDate = readTime(buffer, rr[1]);
47617
- revokedCertificates.push({
47618
- revocationDate,
47619
- userCertificate
47620
- });
47621
- }
47659
+ revokedCertificates.push(..._readRevokedCertificates(buffer, blocks[5]));
47622
47660
  }
47623
47661
  const _ext0 = findBlockAtIndex(blocks, 0);
47624
47662
  return { issuer, issuerFingerprint, thisUpdate, nextUpdate, signature, revokedCertificates };
@@ -47630,16 +47668,7 @@ function _readTbsCertList(buffer, blockInfo) {
47630
47668
  const nextUpdate = readTime(buffer, blocks[3]);
47631
47669
  const revokedCertificates = [];
47632
47670
  if (blocks[4] && blocks[4].tag < 128) {
47633
- const list = readStruct(buffer, blocks[4]);
47634
- for (const r of list) {
47635
- const rr = readStruct(buffer, r);
47636
- const userCertificate = formatBuffer2DigitHexWithColum(readLongIntegerValue(buffer, rr[0]));
47637
- const revocationDate = readTime(buffer, rr[1]);
47638
- revokedCertificates.push({
47639
- revocationDate,
47640
- userCertificate
47641
- });
47642
- }
47671
+ revokedCertificates.push(..._readRevokedCertificates(buffer, blocks[4]));
47643
47672
  }
47644
47673
  return { issuer, issuerFingerprint, thisUpdate, nextUpdate, signature, revokedCertificates };
47645
47674
  }
@@ -48247,6 +48276,7 @@ __export(x509_es_exports, {
48247
48276
  IssuerAlternativeNameExtension: () => IssuerAlternativeNameExtension,
48248
48277
  KeyUsageFlags: () => KeyUsageFlags2,
48249
48278
  KeyUsagesExtension: () => KeyUsagesExtension,
48279
+ MlDsaAlgorithm: () => MlDsaAlgorithm,
48250
48280
  Name: () => Name3,
48251
48281
  NameIdentifier: () => NameIdentifier,
48252
48282
  OidSerializer: () => OidSerializer,
@@ -48258,6 +48288,7 @@ __export(x509_es_exports, {
48258
48288
  REGISTERED_ID: () => REGISTERED_ID,
48259
48289
  RsaAlgorithm: () => RsaAlgorithm,
48260
48290
  ShaAlgorithm: () => ShaAlgorithm,
48291
+ SlhDsaAlgorithm: () => SlhDsaAlgorithm,
48261
48292
  SubjectAlternativeNameExtension: () => SubjectAlternativeNameExtension,
48262
48293
  SubjectKeyIdentifierExtension: () => SubjectKeyIdentifierExtension,
48263
48294
  TextConverter: () => TextConverter,
@@ -54916,10 +54947,10 @@ Extensions = Extensions_1 = __decorate([
54916
54947
  // ../../node_modules/@peculiar/asn1-x509/build/es2015/types.js
54917
54948
  init_inject_buffer();
54918
54949
  var Version;
54919
- (function(Version3) {
54920
- Version3[Version3["v1"] = 0] = "v1";
54921
- Version3[Version3["v2"] = 1] = "v2";
54922
- Version3[Version3["v3"] = 2] = "v3";
54950
+ (function(Version4) {
54951
+ Version4[Version4["v1"] = 0] = "v1";
54952
+ Version4[Version4["v2"] = 1] = "v2";
54953
+ Version4[Version4["v3"] = 2] = "v3";
54923
54954
  })(Version || (Version = {}));
54924
54955
 
54925
54956
  // ../../node_modules/@peculiar/asn1-x509/build/es2015/tbs_certificate.js
@@ -56683,6 +56714,8 @@ init_inject_buffer();
56683
56714
  // ../../node_modules/@peculiar/asn1-ecc/build/es2015/rfc3279.js
56684
56715
  init_inject_buffer();
56685
56716
  var FieldID = class FieldID2 {
56717
+ fieldType;
56718
+ parameters;
56686
56719
  constructor(params = {}) {
56687
56720
  Object.assign(this, params);
56688
56721
  }
@@ -56699,6 +56732,9 @@ FieldID = __decorate([
56699
56732
  var ECPoint = class extends OctetString2 {
56700
56733
  };
56701
56734
  var Curve = class Curve2 {
56735
+ a;
56736
+ b;
56737
+ seed;
56702
56738
  constructor(params = {}) {
56703
56739
  Object.assign(this, params);
56704
56740
  }
@@ -56710,7 +56746,10 @@ __decorate([
56710
56746
  AsnProp({ type: AsnPropTypes.OctetString })
56711
56747
  ], Curve.prototype, "b", void 0);
56712
56748
  __decorate([
56713
- AsnProp({ type: AsnPropTypes.BitString, optional: true })
56749
+ AsnProp({
56750
+ type: AsnPropTypes.BitString,
56751
+ optional: true
56752
+ })
56714
56753
  ], Curve.prototype, "seed", void 0);
56715
56754
  Curve = __decorate([
56716
56755
  AsnType({ type: AsnTypeTypes.Sequence })
@@ -56720,8 +56759,13 @@ var ECPVer;
56720
56759
  ECPVer2[ECPVer2["ecpVer1"] = 1] = "ecpVer1";
56721
56760
  })(ECPVer || (ECPVer = {}));
56722
56761
  var SpecifiedECDomain = class SpecifiedECDomain2 {
56762
+ version = ECPVer.ecpVer1;
56763
+ fieldID;
56764
+ curve;
56765
+ base;
56766
+ order;
56767
+ cofactor;
56723
56768
  constructor(params = {}) {
56724
- this.version = ECPVer.ecpVer1;
56725
56769
  Object.assign(this, params);
56726
56770
  }
56727
56771
  };
@@ -56738,10 +56782,16 @@ __decorate([
56738
56782
  AsnProp({ type: ECPoint })
56739
56783
  ], SpecifiedECDomain.prototype, "base", void 0);
56740
56784
  __decorate([
56741
- AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
56785
+ AsnProp({
56786
+ type: AsnPropTypes.Integer,
56787
+ converter: AsnIntegerArrayBufferConverter
56788
+ })
56742
56789
  ], SpecifiedECDomain.prototype, "order", void 0);
56743
56790
  __decorate([
56744
- AsnProp({ type: AsnPropTypes.Integer, optional: true })
56791
+ AsnProp({
56792
+ type: AsnPropTypes.Integer,
56793
+ optional: true
56794
+ })
56745
56795
  ], SpecifiedECDomain.prototype, "cofactor", void 0);
56746
56796
  SpecifiedECDomain = __decorate([
56747
56797
  AsnType({ type: AsnTypeTypes.Sequence })
@@ -56749,6 +56799,9 @@ SpecifiedECDomain = __decorate([
56749
56799
 
56750
56800
  // ../../node_modules/@peculiar/asn1-ecc/build/es2015/ec_parameters.js
56751
56801
  var ECParameters = class ECParameters2 {
56802
+ namedCurve;
56803
+ implicitCurve;
56804
+ specifiedCurve;
56752
56805
  constructor(params = {}) {
56753
56806
  Object.assign(this, params);
56754
56807
  }
@@ -56769,9 +56822,11 @@ ECParameters = __decorate([
56769
56822
  // ../../node_modules/@peculiar/asn1-ecc/build/es2015/ec_private_key.js
56770
56823
  init_inject_buffer();
56771
56824
  var ECPrivateKey = class {
56825
+ version = 1;
56826
+ privateKey = new OctetString2();
56827
+ parameters;
56828
+ publicKey;
56772
56829
  constructor(params = {}) {
56773
- this.version = 1;
56774
- this.privateKey = new OctetString2();
56775
56830
  Object.assign(this, params);
56776
56831
  }
56777
56832
  };
@@ -56782,26 +56837,40 @@ __decorate([
56782
56837
  AsnProp({ type: OctetString2 })
56783
56838
  ], ECPrivateKey.prototype, "privateKey", void 0);
56784
56839
  __decorate([
56785
- AsnProp({ type: ECParameters, context: 0, optional: true })
56840
+ AsnProp({
56841
+ type: ECParameters,
56842
+ context: 0,
56843
+ optional: true
56844
+ })
56786
56845
  ], ECPrivateKey.prototype, "parameters", void 0);
56787
56846
  __decorate([
56788
- AsnProp({ type: AsnPropTypes.BitString, context: 1, optional: true })
56847
+ AsnProp({
56848
+ type: AsnPropTypes.BitString,
56849
+ context: 1,
56850
+ optional: true
56851
+ })
56789
56852
  ], ECPrivateKey.prototype, "publicKey", void 0);
56790
56853
 
56791
56854
  // ../../node_modules/@peculiar/asn1-ecc/build/es2015/ec_signature_value.js
56792
56855
  init_inject_buffer();
56793
56856
  var ECDSASigValue = class {
56857
+ r = new ArrayBuffer(0);
56858
+ s = new ArrayBuffer(0);
56794
56859
  constructor(params = {}) {
56795
- this.r = new ArrayBuffer(0);
56796
- this.s = new ArrayBuffer(0);
56797
56860
  Object.assign(this, params);
56798
56861
  }
56799
56862
  };
56800
56863
  __decorate([
56801
- AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
56864
+ AsnProp({
56865
+ type: AsnPropTypes.Integer,
56866
+ converter: AsnIntegerArrayBufferConverter
56867
+ })
56802
56868
  ], ECDSASigValue.prototype, "r", void 0);
56803
56869
  __decorate([
56804
- AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
56870
+ AsnProp({
56871
+ type: AsnPropTypes.Integer,
56872
+ converter: AsnIntegerArrayBufferConverter
56873
+ })
56805
56874
  ], ECDSASigValue.prototype, "s", void 0);
56806
56875
 
56807
56876
  // ../../node_modules/@peculiar/asn1-rsa/build/es2015/index.js
@@ -58133,8 +58202,8 @@ __decorate([
58133
58202
  init_inject_buffer();
58134
58203
  var Attributes_1;
58135
58204
  var Version2;
58136
- (function(Version3) {
58137
- Version3[Version3["v1"] = 0] = "v1";
58205
+ (function(Version4) {
58206
+ Version4[Version4["v1"] = 0] = "v1";
58138
58207
  })(Version2 || (Version2 = {}));
58139
58208
  var PrivateKey = class extends OctetString2 {
58140
58209
  };
@@ -58555,6 +58624,159 @@ SMIMECapabilities = SMIMECapabilities_1 = __decorate([
58555
58624
  })
58556
58625
  ], SMIMECapabilities);
58557
58626
 
58627
+ // ../../node_modules/@peculiar/asn1-x509-post-quantum/build/es2015/index.js
58628
+ init_inject_buffer();
58629
+
58630
+ // ../../node_modules/@peculiar/asn1-x509-post-quantum/build/es2015/composite_signatures.js
58631
+ init_inject_buffer();
58632
+ var CompositeParams_1;
58633
+ var CompositeSignatureValue_1;
58634
+ var CompositeParams = CompositeParams_1 = class CompositeParams2 extends AsnArray {
58635
+ constructor(items) {
58636
+ super(items);
58637
+ Object.setPrototypeOf(this, CompositeParams_1.prototype);
58638
+ }
58639
+ };
58640
+ CompositeParams = CompositeParams_1 = __decorate([
58641
+ AsnType({
58642
+ type: AsnTypeTypes.Sequence,
58643
+ itemType: AlgorithmIdentifier
58644
+ })
58645
+ ], CompositeParams);
58646
+ var CompositeSignatureValue = CompositeSignatureValue_1 = class CompositeSignatureValue2 extends AsnArray {
58647
+ constructor(items) {
58648
+ super(items);
58649
+ Object.setPrototypeOf(this, CompositeSignatureValue_1.prototype);
58650
+ }
58651
+ };
58652
+ CompositeSignatureValue = CompositeSignatureValue_1 = __decorate([
58653
+ AsnType({
58654
+ type: AsnTypeTypes.Sequence,
58655
+ itemType: AsnPropTypes.BitString
58656
+ })
58657
+ ], CompositeSignatureValue);
58658
+
58659
+ // ../../node_modules/@peculiar/asn1-x509-post-quantum/build/es2015/composite_keys.js
58660
+ init_inject_buffer();
58661
+
58662
+ // ../../node_modules/@peculiar/asn1-asym-key/build/es2015/index.js
58663
+ init_inject_buffer();
58664
+ var AsymmetricKeyPackage_1;
58665
+ var Version3;
58666
+ (function(Version4) {
58667
+ Version4[Version4["v1"] = 0] = "v1";
58668
+ Version4[Version4["v2"] = 1] = "v2";
58669
+ })(Version3 || (Version3 = {}));
58670
+ var PrivateKeyAlgorithmIdentifier = class PrivateKeyAlgorithmIdentifier2 extends AlgorithmIdentifier {
58671
+ };
58672
+ PrivateKeyAlgorithmIdentifier = __decorate([
58673
+ AsnType({ type: AsnTypeTypes.Sequence })
58674
+ ], PrivateKeyAlgorithmIdentifier);
58675
+ var OneAsymmetricKey = class OneAsymmetricKey2 {
58676
+ version = Version3.v1;
58677
+ privateKeyAlgorithm = new AlgorithmIdentifier();
58678
+ privateKey = new ArrayBuffer(0);
58679
+ attributes;
58680
+ publicKey;
58681
+ };
58682
+ __decorate([
58683
+ AsnProp({ type: AsnPropTypes.Integer })
58684
+ ], OneAsymmetricKey.prototype, "version", void 0);
58685
+ __decorate([
58686
+ AsnProp({ type: AlgorithmIdentifier })
58687
+ ], OneAsymmetricKey.prototype, "privateKeyAlgorithm", void 0);
58688
+ __decorate([
58689
+ AsnProp({ type: AsnPropTypes.OctetString })
58690
+ ], OneAsymmetricKey.prototype, "privateKey", void 0);
58691
+ __decorate([
58692
+ AsnProp({
58693
+ type: Attributes,
58694
+ context: 0,
58695
+ implicit: true,
58696
+ optional: true
58697
+ })
58698
+ ], OneAsymmetricKey.prototype, "attributes", void 0);
58699
+ __decorate([
58700
+ AsnProp({
58701
+ type: AsnPropTypes.BitString,
58702
+ context: 1,
58703
+ implicit: true,
58704
+ optional: true
58705
+ })
58706
+ ], OneAsymmetricKey.prototype, "publicKey", void 0);
58707
+ OneAsymmetricKey = __decorate([
58708
+ AsnType({ type: AsnTypeTypes.Sequence })
58709
+ ], OneAsymmetricKey);
58710
+ var PrivateKeyInfo2 = class PrivateKeyInfo3 extends OneAsymmetricKey {
58711
+ };
58712
+ PrivateKeyInfo2 = __decorate([
58713
+ AsnType({ type: AsnTypeTypes.Sequence })
58714
+ ], PrivateKeyInfo2);
58715
+ var AsymmetricKeyPackage = AsymmetricKeyPackage_1 = class AsymmetricKeyPackage2 extends AsnArray {
58716
+ constructor(items) {
58717
+ super(items);
58718
+ Object.setPrototypeOf(this, AsymmetricKeyPackage_1.prototype);
58719
+ }
58720
+ };
58721
+ AsymmetricKeyPackage = AsymmetricKeyPackage_1 = __decorate([
58722
+ AsnType({
58723
+ type: AsnTypeTypes.Sequence,
58724
+ itemType: OneAsymmetricKey
58725
+ })
58726
+ ], AsymmetricKeyPackage);
58727
+
58728
+ // ../../node_modules/@peculiar/asn1-x509-post-quantum/build/es2015/composite_keys.js
58729
+ var CompositePublicKey_1;
58730
+ var CompositePrivateKey_1;
58731
+ var CompositeAlgorithmIdentifier = class CompositeAlgorithmIdentifier2 extends AlgorithmIdentifier {
58732
+ };
58733
+ CompositeAlgorithmIdentifier = __decorate([
58734
+ AsnType({ type: AsnTypeTypes.Sequence })
58735
+ ], CompositeAlgorithmIdentifier);
58736
+ var CompositePublicKey = CompositePublicKey_1 = class CompositePublicKey2 extends AsnArray {
58737
+ constructor(items) {
58738
+ super(items);
58739
+ Object.setPrototypeOf(this, CompositePublicKey_1.prototype);
58740
+ }
58741
+ };
58742
+ CompositePublicKey = CompositePublicKey_1 = __decorate([
58743
+ AsnType({
58744
+ type: AsnTypeTypes.Sequence,
58745
+ itemType: SubjectPublicKeyInfo
58746
+ })
58747
+ ], CompositePublicKey);
58748
+ var CompositePrivateKey = CompositePrivateKey_1 = class CompositePrivateKey2 extends AsnArray {
58749
+ constructor(items) {
58750
+ super(items);
58751
+ Object.setPrototypeOf(this, CompositePrivateKey_1.prototype);
58752
+ }
58753
+ };
58754
+ CompositePrivateKey = CompositePrivateKey_1 = __decorate([
58755
+ AsnType({
58756
+ type: AsnTypeTypes.Sequence,
58757
+ itemType: OneAsymmetricKey
58758
+ })
58759
+ ], CompositePrivateKey);
58760
+
58761
+ // ../../node_modules/@peculiar/asn1-x509-post-quantum/build/es2015/object_identifiers.js
58762
+ init_inject_buffer();
58763
+ var id_sigAlgs = "2.16.840.1.101.3.4.3";
58764
+ var id_ml_dsa_44 = `${id_sigAlgs}.17`;
58765
+ var id_ml_dsa_65 = `${id_sigAlgs}.18`;
58766
+ var id_ml_dsa_87 = `${id_sigAlgs}.19`;
58767
+ var id_slh_dsa_sha2_128s = `${id_sigAlgs}.20`;
58768
+ var id_slh_dsa_sha2_128f = `${id_sigAlgs}.21`;
58769
+ var id_slh_dsa_sha2_192s = `${id_sigAlgs}.22`;
58770
+ var id_slh_dsa_sha2_192f = `${id_sigAlgs}.23`;
58771
+ var id_slh_dsa_sha2_256s = `${id_sigAlgs}.24`;
58772
+ var id_slh_dsa_sha2_256f = `${id_sigAlgs}.25`;
58773
+ var id_slh_dsa_shake_128s = `${id_sigAlgs}.26`;
58774
+ var id_slh_dsa_shake_128f = `${id_sigAlgs}.27`;
58775
+ var id_slh_dsa_shake_192s = `${id_sigAlgs}.28`;
58776
+ var id_slh_dsa_shake_192f = `${id_sigAlgs}.29`;
58777
+ var id_slh_dsa_shake_256s = `${id_sigAlgs}.30`;
58778
+ var id_slh_dsa_shake_256f = `${id_sigAlgs}.31`;
58779
+
58558
58780
  // ../../node_modules/@peculiar/asn1-csr/build/es2015/index.js
58559
58781
  init_inject_buffer();
58560
58782
 
@@ -58568,7 +58790,10 @@ var Attributes3 = Attributes_12 = class Attributes4 extends AsnArray {
58568
58790
  }
58569
58791
  };
58570
58792
  Attributes3 = Attributes_12 = __decorate([
58571
- AsnType({ type: AsnTypeTypes.Sequence, itemType: Attribute })
58793
+ AsnType({
58794
+ type: AsnTypeTypes.Sequence,
58795
+ itemType: Attribute
58796
+ })
58572
58797
  ], Attributes3);
58573
58798
 
58574
58799
  // ../../node_modules/@peculiar/asn1-csr/build/es2015/certification_request.js
@@ -58577,11 +58802,11 @@ init_inject_buffer();
58577
58802
  // ../../node_modules/@peculiar/asn1-csr/build/es2015/certification_request_info.js
58578
58803
  init_inject_buffer();
58579
58804
  var CertificationRequestInfo = class {
58805
+ version = 0;
58806
+ subject = new Name();
58807
+ subjectPKInfo = new SubjectPublicKeyInfo();
58808
+ attributes = new Attributes3();
58580
58809
  constructor(params = {}) {
58581
- this.version = 0;
58582
- this.subject = new Name();
58583
- this.subjectPKInfo = new SubjectPublicKeyInfo();
58584
- this.attributes = new Attributes3();
58585
58810
  Object.assign(this, params);
58586
58811
  }
58587
58812
  };
@@ -58595,20 +58820,29 @@ __decorate([
58595
58820
  AsnProp({ type: SubjectPublicKeyInfo })
58596
58821
  ], CertificationRequestInfo.prototype, "subjectPKInfo", void 0);
58597
58822
  __decorate([
58598
- AsnProp({ type: Attributes3, implicit: true, context: 0, optional: true })
58823
+ AsnProp({
58824
+ type: Attributes3,
58825
+ implicit: true,
58826
+ context: 0,
58827
+ optional: true
58828
+ })
58599
58829
  ], CertificationRequestInfo.prototype, "attributes", void 0);
58600
58830
 
58601
58831
  // ../../node_modules/@peculiar/asn1-csr/build/es2015/certification_request.js
58602
58832
  var CertificationRequest = class {
58833
+ certificationRequestInfo = new CertificationRequestInfo();
58834
+ certificationRequestInfoRaw;
58835
+ signatureAlgorithm = new AlgorithmIdentifier();
58836
+ signature = new ArrayBuffer(0);
58603
58837
  constructor(params = {}) {
58604
- this.certificationRequestInfo = new CertificationRequestInfo();
58605
- this.signatureAlgorithm = new AlgorithmIdentifier();
58606
- this.signature = new ArrayBuffer(0);
58607
58838
  Object.assign(this, params);
58608
58839
  }
58609
58840
  };
58610
58841
  __decorate([
58611
- AsnProp({ type: CertificationRequestInfo, raw: true })
58842
+ AsnProp({
58843
+ type: CertificationRequestInfo,
58844
+ raw: true
58845
+ })
58612
58846
  ], CertificationRequest.prototype, "certificationRequestInfo", void 0);
58613
58847
  __decorate([
58614
58848
  AsnProp({ type: AlgorithmIdentifier })
@@ -59049,7 +59283,11 @@ var TextConverter = class {
59049
59283
  TextConverter.oidSerializer = OidSerializer;
59050
59284
  TextConverter.algorithmSerializer = DefaultAlgorithmSerializer;
59051
59285
  var _AsnData_rawData;
59286
+ var _AsnData_options;
59052
59287
  var AsnData = class _AsnData {
59288
+ get parseOptions() {
59289
+ return __classPrivateFieldGet(this, _AsnData_options, "f");
59290
+ }
59053
59291
  get rawData() {
59054
59292
  if (!__classPrivateFieldGet(this, _AsnData_rawData, "f")) {
59055
59293
  __classPrivateFieldSet(this, _AsnData_rawData, AsnConvert.serialize(this.asn), "f");
@@ -59058,11 +59296,14 @@ var AsnData = class _AsnData {
59058
59296
  }
59059
59297
  constructor(...args) {
59060
59298
  _AsnData_rawData.set(this, void 0);
59299
+ _AsnData_options.set(this, void 0);
59061
59300
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
59062
- this.asn = AsnConvert.parse(args[0], args[1]);
59301
+ __classPrivateFieldSet(this, _AsnData_options, args[2], "f");
59302
+ this.asn = AsnConvert.parse(args[0], args[1], args[2]);
59063
59303
  __classPrivateFieldSet(this, _AsnData_rawData, import_pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]), "f");
59064
59304
  this.onInit(this.asn);
59065
59305
  } else {
59306
+ __classPrivateFieldSet(this, _AsnData_options, args[1], "f");
59066
59307
  this.asn = args[0];
59067
59308
  this.onInit(this.asn);
59068
59309
  }
@@ -59076,7 +59317,7 @@ var AsnData = class _AsnData {
59076
59317
  toString(format4 = "text") {
59077
59318
  switch (format4) {
59078
59319
  case "asn":
59079
- return AsnConvert.toString(this.rawData);
59320
+ return AsnConvert.toString(this.rawData, __classPrivateFieldGet(this, _AsnData_options, "f"));
59080
59321
  case "text":
59081
59322
  return TextConverter.serialize(this.toTextObject());
59082
59323
  case "hex":
@@ -59102,13 +59343,15 @@ var AsnData = class _AsnData {
59102
59343
  return new TextObject(this.getTextName(), {}, value);
59103
59344
  }
59104
59345
  };
59105
- _AsnData_rawData = /* @__PURE__ */ new WeakMap();
59346
+ _AsnData_rawData = /* @__PURE__ */ new WeakMap(), _AsnData_options = /* @__PURE__ */ new WeakMap();
59106
59347
  AsnData.NAME = "ASN";
59107
59348
  var Extension2 = class _Extension extends AsnData {
59108
59349
  constructor(...args) {
59109
59350
  let raw;
59351
+ let options;
59110
59352
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
59111
59353
  raw = import_pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]);
59354
+ options = args[1];
59112
59355
  } else {
59113
59356
  raw = AsnConvert.serialize(new Extension({
59114
59357
  extnID: args[0],
@@ -59116,7 +59359,7 @@ var Extension2 = class _Extension extends AsnData {
59116
59359
  extnValue: new OctetString2(import_pvtsutils.BufferSourceConverter.toArrayBuffer(args[2]))
59117
59360
  }));
59118
59361
  }
59119
- super(raw, Extension);
59362
+ super(raw, Extension, options);
59120
59363
  }
59121
59364
  onInit(asn) {
59122
59365
  this.type = asn.extnID;
@@ -59406,7 +59649,7 @@ var Name3 = class _Name {
59406
59649
  if (quotedMatches) {
59407
59650
  value = quotedMatches[1];
59408
59651
  }
59409
- return value.replace(/\\0a/ig, "\n").replace(/\\0d/ig, "\r").replace(/\\0g/ig, " ").replace(/\\(.)/g, "$1");
59652
+ return value.replace(/\\0a/gi, "\n").replace(/\\0d/gi, "\r").replace(/\\0g/gi, " ").replace(/\\(.)/g, "$1");
59410
59653
  }
59411
59654
  toArrayBuffer() {
59412
59655
  return AsnConvert.serialize(this.asn);
@@ -59793,9 +60036,9 @@ var PemData = class _PemData extends AsnData {
59793
60036
  }
59794
60037
  constructor(...args) {
59795
60038
  if (_PemData.isAsnEncoded(args[0])) {
59796
- super(_PemData.toArrayBuffer(args[0]), args[1]);
60039
+ super(_PemData.toArrayBuffer(args[0]), args[1], args[2]);
59797
60040
  } else {
59798
- super(args[0]);
60041
+ super(args[0], args[1]);
59799
60042
  }
59800
60043
  }
59801
60044
  toString(format4 = "pem") {
@@ -59825,11 +60068,11 @@ var PublicKey = class _PublicKey extends PemData {
59825
60068
  throw new TypeError("Unsupported PublicKeyType");
59826
60069
  }
59827
60070
  }
59828
- constructor(param) {
60071
+ constructor(param, options) {
59829
60072
  if (PemData.isAsnEncoded(param)) {
59830
- super(param, SubjectPublicKeyInfo);
60073
+ super(param, SubjectPublicKeyInfo, options);
59831
60074
  } else {
59832
- super(param);
60075
+ super(param, options);
59833
60076
  }
59834
60077
  this.tag = PemConverter.PublicKeyTag;
59835
60078
  }
@@ -59849,7 +60092,7 @@ var PublicKey = class _PublicKey extends PemData {
59849
60092
  }
59850
60093
  crypto4 !== null && crypto4 !== void 0 ? crypto4 : crypto4 = cryptoProvider.get();
59851
60094
  let raw = this.rawData;
59852
- const asnSpki = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo);
60095
+ const asnSpki = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo, this.parseOptions);
59853
60096
  if (asnSpki.algorithm.algorithm === id_RSASSA_PSS) {
59854
60097
  raw = convertSpkiToRsaPkcs1(asnSpki, raw);
59855
60098
  }
@@ -59860,7 +60103,7 @@ var PublicKey = class _PublicKey extends PemData {
59860
60103
  const algorithm = this.algorithm = algProv.toWebAlgorithm(asn.algorithm);
59861
60104
  switch (asn.algorithm.algorithm) {
59862
60105
  case id_rsaEncryption: {
59863
- const rsaPublicKey = AsnConvert.parse(asn.subjectPublicKey, RSAPublicKey);
60106
+ const rsaPublicKey = AsnConvert.parse(asn.subjectPublicKey, RSAPublicKey, this.parseOptions);
59864
60107
  const modulus = import_pvtsutils.BufferSourceConverter.toUint8Array(rsaPublicKey.modulus);
59865
60108
  algorithm.publicExponent = import_pvtsutils.BufferSourceConverter.toUint8Array(rsaPublicKey.publicExponent);
59866
60109
  algorithm.modulusLength = (!modulus[0] ? modulus.slice(1) : modulus).byteLength << 3;
@@ -59894,12 +60137,12 @@ var PublicKey = class _PublicKey extends PemData {
59894
60137
  }
59895
60138
  }
59896
60139
  crypto4 !== null && crypto4 !== void 0 ? crypto4 : crypto4 = cryptoProvider.get();
59897
- const asn = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo);
60140
+ const asn = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo, this.parseOptions);
59898
60141
  return await crypto4.subtle.digest(algorithm, asn.subjectPublicKey);
59899
60142
  }
59900
60143
  toTextObject() {
59901
60144
  const obj = this.toTextObjectEmpty();
59902
- const asn = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo);
60145
+ const asn = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo, this.parseOptions);
59903
60146
  obj["Algorithm"] = TextConverter.serializeAlgorithm(asn.algorithm);
59904
60147
  switch (asn.algorithm.algorithm) {
59905
60148
  case id_ecPublicKey:
@@ -59931,9 +60174,11 @@ var AuthorityKeyIdentifierExtension = class _AuthorityKeyIdentifierExtension ext
59931
60174
  }
59932
60175
  constructor(...args) {
59933
60176
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
59934
- super(args[0]);
60177
+ super(args[0], args[1]);
59935
60178
  } else if (typeof args[0] === "string") {
59936
- const value = new AuthorityKeyIdentifier({ keyIdentifier: new KeyIdentifier(import_pvtsutils.Convert.FromHex(args[0])) });
60179
+ const value = new AuthorityKeyIdentifier({
60180
+ keyIdentifier: new KeyIdentifier(import_pvtsutils.Convert.FromHex(args[0]))
60181
+ });
59937
60182
  super(id_ce_authorityKeyIdentifier, args[1], AsnConvert.serialize(value));
59938
60183
  } else {
59939
60184
  const certId = args[0];
@@ -59947,7 +60192,7 @@ var AuthorityKeyIdentifierExtension = class _AuthorityKeyIdentifierExtension ext
59947
60192
  }
59948
60193
  onInit(asn) {
59949
60194
  super.onInit(asn);
59950
- const aki = AsnConvert.parse(asn.extnValue, AuthorityKeyIdentifier);
60195
+ const aki = AsnConvert.parse(asn.extnValue, AuthorityKeyIdentifier, this.parseOptions);
59951
60196
  if (aki.keyIdentifier) {
59952
60197
  this.keyId = import_pvtsutils.Convert.ToHex(aki.keyIdentifier);
59953
60198
  }
@@ -59960,7 +60205,7 @@ var AuthorityKeyIdentifierExtension = class _AuthorityKeyIdentifierExtension ext
59960
60205
  }
59961
60206
  toTextObject() {
59962
60207
  const obj = this.toTextObjectWithoutValue();
59963
- const asn = AsnConvert.parse(this.value, AuthorityKeyIdentifier);
60208
+ const asn = AsnConvert.parse(this.value, AuthorityKeyIdentifier, this.parseOptions);
59964
60209
  if (asn.authorityCertIssuer) {
59965
60210
  obj["Authority Issuer"] = new GeneralNames3(asn.authorityCertIssuer).toTextObject();
59966
60211
  }
@@ -59977,8 +60222,8 @@ AuthorityKeyIdentifierExtension.NAME = "Authority Key Identifier";
59977
60222
  var BasicConstraintsExtension = class extends Extension2 {
59978
60223
  constructor(...args) {
59979
60224
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
59980
- super(args[0]);
59981
- const value = AsnConvert.parse(this.value, BasicConstraints);
60225
+ super(args[0], args[1]);
60226
+ const value = AsnConvert.parse(this.value, BasicConstraints, this.parseOptions);
59982
60227
  this.ca = value.cA;
59983
60228
  this.pathLength = value.pathLenConstraint;
59984
60229
  } else {
@@ -60015,8 +60260,8 @@ var ExtendedKeyUsage3;
60015
60260
  var ExtendedKeyUsageExtension = class extends Extension2 {
60016
60261
  constructor(...args) {
60017
60262
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60018
- super(args[0]);
60019
- const value = AsnConvert.parse(this.value, ExtendedKeyUsage);
60263
+ super(args[0], args[1]);
60264
+ const value = AsnConvert.parse(this.value, ExtendedKeyUsage, this.parseOptions);
60020
60265
  this.usages = value.map((o) => o);
60021
60266
  } else {
60022
60267
  const value = new ExtendedKeyUsage(args[0]);
@@ -60046,8 +60291,8 @@ var KeyUsageFlags2;
60046
60291
  var KeyUsagesExtension = class extends Extension2 {
60047
60292
  constructor(...args) {
60048
60293
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60049
- super(args[0]);
60050
- const value = AsnConvert.parse(this.value, KeyUsage);
60294
+ super(args[0], args[1]);
60295
+ const value = AsnConvert.parse(this.value, KeyUsage, this.parseOptions);
60051
60296
  this.usages = value.toNumber();
60052
60297
  } else {
60053
60298
  const value = new KeyUsage(args[0]);
@@ -60057,7 +60302,7 @@ var KeyUsagesExtension = class extends Extension2 {
60057
60302
  }
60058
60303
  toTextObject() {
60059
60304
  const obj = this.toTextObjectWithoutValue();
60060
- const asn = AsnConvert.parse(this.value, KeyUsage);
60305
+ const asn = AsnConvert.parse(this.value, KeyUsage, this.parseOptions);
60061
60306
  obj[""] = asn.toJSON().join(", ");
60062
60307
  return obj;
60063
60308
  }
@@ -60071,8 +60316,8 @@ var SubjectKeyIdentifierExtension = class _SubjectKeyIdentifierExtension extends
60071
60316
  }
60072
60317
  constructor(...args) {
60073
60318
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60074
- super(args[0]);
60075
- const value = AsnConvert.parse(this.value, SubjectKeyIdentifier);
60319
+ super(args[0], args[1]);
60320
+ const value = AsnConvert.parse(this.value, SubjectKeyIdentifier, this.parseOptions);
60076
60321
  this.keyId = import_pvtsutils.Convert.ToHex(value);
60077
60322
  } else {
60078
60323
  const identifier = typeof args[0] === "string" ? import_pvtsutils.Convert.FromHex(args[0]) : args[0];
@@ -60083,7 +60328,7 @@ var SubjectKeyIdentifierExtension = class _SubjectKeyIdentifierExtension extends
60083
60328
  }
60084
60329
  toTextObject() {
60085
60330
  const obj = this.toTextObjectWithoutValue();
60086
- const asn = AsnConvert.parse(this.value, SubjectKeyIdentifier);
60331
+ const asn = AsnConvert.parse(this.value, SubjectKeyIdentifier, this.parseOptions);
60087
60332
  obj[""] = asn;
60088
60333
  return obj;
60089
60334
  }
@@ -60092,14 +60337,14 @@ SubjectKeyIdentifierExtension.NAME = "Subject Key Identifier";
60092
60337
  var SubjectAlternativeNameExtension = class extends Extension2 {
60093
60338
  constructor(...args) {
60094
60339
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60095
- super(args[0]);
60340
+ super(args[0], args[1]);
60096
60341
  } else {
60097
60342
  super(id_ce_subjectAltName, args[1], new GeneralNames3(args[0] || []).rawData);
60098
60343
  }
60099
60344
  }
60100
60345
  onInit(asn) {
60101
60346
  super.onInit(asn);
60102
- const value = AsnConvert.parse(asn.extnValue, SubjectAlternativeName);
60347
+ const value = AsnConvert.parse(asn.extnValue, SubjectAlternativeName, this.parseOptions);
60103
60348
  this.names = new GeneralNames3(value);
60104
60349
  }
60105
60350
  toTextObject() {
@@ -60116,11 +60361,11 @@ var ExtensionFactory = class {
60116
60361
  static register(id, type) {
60117
60362
  this.items.set(id, type);
60118
60363
  }
60119
- static create(data) {
60120
- const extension = new Extension2(data);
60364
+ static create(data, options) {
60365
+ const extension = new Extension2(data, options);
60121
60366
  const Type = this.items.get(extension.type);
60122
60367
  if (Type) {
60123
- return new Type(data);
60368
+ return new Type(data, options);
60124
60369
  }
60125
60370
  return extension;
60126
60371
  }
@@ -60130,8 +60375,8 @@ var CertificatePolicyExtension = class extends Extension2 {
60130
60375
  constructor(...args) {
60131
60376
  var _a3;
60132
60377
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60133
- super(args[0]);
60134
- const asnPolicies = AsnConvert.parse(this.value, CertificatePolicies);
60378
+ super(args[0], args[1]);
60379
+ const asnPolicies = AsnConvert.parse(this.value, CertificatePolicies, this.parseOptions);
60135
60380
  this.policies = asnPolicies.map((o) => o.policyIdentifier);
60136
60381
  } else {
60137
60382
  const policies = args[0];
@@ -60153,12 +60398,14 @@ var CRLDistributionPointsExtension = class extends Extension2 {
60153
60398
  constructor(...args) {
60154
60399
  var _a3;
60155
60400
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60156
- super(args[0]);
60401
+ super(args[0], args[1]);
60157
60402
  } else if (Array.isArray(args[0]) && typeof args[0][0] === "string") {
60158
60403
  const urls = args[0];
60159
60404
  const dps = urls.map((url) => {
60160
60405
  return new DistributionPoint({
60161
- distributionPoint: new DistributionPointName({ fullName: [new GeneralName({ uniformResourceIdentifier: url })] })
60406
+ distributionPoint: new DistributionPointName({
60407
+ fullName: [new GeneralName({ uniformResourceIdentifier: url })]
60408
+ })
60162
60409
  });
60163
60410
  });
60164
60411
  const value = new CRLDistributionPoints(dps);
@@ -60171,7 +60418,7 @@ var CRLDistributionPointsExtension = class extends Extension2 {
60171
60418
  }
60172
60419
  onInit(asn) {
60173
60420
  super.onInit(asn);
60174
- const crlExt = AsnConvert.parse(asn.extnValue, CRLDistributionPoints);
60421
+ const crlExt = AsnConvert.parse(asn.extnValue, CRLDistributionPoints, this.parseOptions);
60175
60422
  this.distributionPoints = crlExt;
60176
60423
  }
60177
60424
  toTextObject() {
@@ -60198,7 +60445,7 @@ var AuthorityInfoAccessExtension = class extends Extension2 {
60198
60445
  constructor(...args) {
60199
60446
  var _a3, _b, _c, _d;
60200
60447
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60201
- super(args[0]);
60448
+ super(args[0], args[1]);
60202
60449
  } else if (args[0] instanceof AuthorityInfoAccessSyntax) {
60203
60450
  const value = new AuthorityInfoAccessSyntax(args[0]);
60204
60451
  super(id_pe_authorityInfoAccess, args[1], AsnConvert.serialize(value));
@@ -60222,7 +60469,7 @@ var AuthorityInfoAccessExtension = class extends Extension2 {
60222
60469
  this.caIssuers = [];
60223
60470
  this.timeStamping = [];
60224
60471
  this.caRepository = [];
60225
- const aia = AsnConvert.parse(asn.extnValue, AuthorityInfoAccessSyntax);
60472
+ const aia = AsnConvert.parse(asn.extnValue, AuthorityInfoAccessSyntax, this.parseOptions);
60226
60473
  aia.forEach((accessDescription) => {
60227
60474
  switch (accessDescription.accessMethod) {
60228
60475
  case id_ad_ocsp:
@@ -60294,14 +60541,14 @@ function addAccessDescriptions(value, params, method, key) {
60294
60541
  var IssuerAlternativeNameExtension = class extends Extension2 {
60295
60542
  constructor(...args) {
60296
60543
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60297
- super(args[0]);
60544
+ super(args[0], args[1]);
60298
60545
  } else {
60299
60546
  super(id_ce_issuerAltName, args[1], new GeneralNames3(args[0] || []).rawData);
60300
60547
  }
60301
60548
  }
60302
60549
  onInit(asn) {
60303
60550
  super.onInit(asn);
60304
- const value = AsnConvert.parse(asn.extnValue, GeneralNames);
60551
+ const value = AsnConvert.parse(asn.extnValue, GeneralNames, this.parseOptions);
60305
60552
  this.names = new GeneralNames3(value);
60306
60553
  }
60307
60554
  toTextObject() {
@@ -60317,8 +60564,10 @@ IssuerAlternativeNameExtension.NAME = "Issuer Alternative Name";
60317
60564
  var Attribute3 = class _Attribute extends AsnData {
60318
60565
  constructor(...args) {
60319
60566
  let raw;
60567
+ let options;
60320
60568
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60321
60569
  raw = import_pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]);
60570
+ options = args[1];
60322
60571
  } else {
60323
60572
  const type = args[0];
60324
60573
  const values = Array.isArray(args[1]) ? args[1].map((o) => import_pvtsutils.BufferSourceConverter.toArrayBuffer(o)) : [];
@@ -60327,7 +60576,7 @@ var Attribute3 = class _Attribute extends AsnData {
60327
60576
  values
60328
60577
  }));
60329
60578
  }
60330
- super(raw, Attribute);
60579
+ super(raw, Attribute, options);
60331
60580
  }
60332
60581
  onInit(asn) {
60333
60582
  this.type = asn.type;
@@ -60351,7 +60600,7 @@ var ChallengePasswordAttribute = class extends Attribute3 {
60351
60600
  constructor(...args) {
60352
60601
  var _a3;
60353
60602
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60354
- super(args[0]);
60603
+ super(args[0], args[1]);
60355
60604
  } else {
60356
60605
  const value = new ChallengePassword({ printableString: args[0] });
60357
60606
  super(id_pkcs9_at_challengePassword, [AsnConvert.serialize(value)]);
@@ -60361,7 +60610,7 @@ var ChallengePasswordAttribute = class extends Attribute3 {
60361
60610
  onInit(asn) {
60362
60611
  super.onInit(asn);
60363
60612
  if (this.values[0]) {
60364
- const value = AsnConvert.parse(this.values[0], ChallengePassword);
60613
+ const value = AsnConvert.parse(this.values[0], ChallengePassword, this.parseOptions);
60365
60614
  this.password = value.toString();
60366
60615
  }
60367
60616
  }
@@ -60376,7 +60625,7 @@ var ExtensionsAttribute = class extends Attribute3 {
60376
60625
  constructor(...args) {
60377
60626
  var _a3;
60378
60627
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
60379
- super(args[0]);
60628
+ super(args[0], args[1]);
60380
60629
  } else {
60381
60630
  const extensions = args[0];
60382
60631
  const value = new Extensions();
@@ -60390,8 +60639,8 @@ var ExtensionsAttribute = class extends Attribute3 {
60390
60639
  onInit(asn) {
60391
60640
  super.onInit(asn);
60392
60641
  if (this.values[0]) {
60393
- const value = AsnConvert.parse(this.values[0], Extensions);
60394
- this.items = value.map((o) => ExtensionFactory.create(AsnConvert.serialize(o)));
60642
+ const value = AsnConvert.parse(this.values[0], Extensions, this.parseOptions);
60643
+ this.items = value.map((o) => ExtensionFactory.create(AsnConvert.serialize(o), this.parseOptions));
60395
60644
  }
60396
60645
  }
60397
60646
  toTextObject() {
@@ -60408,11 +60657,11 @@ var AttributeFactory = class {
60408
60657
  static register(id, type) {
60409
60658
  this.items.set(id, type);
60410
60659
  }
60411
- static create(data) {
60412
- const attribute = new Attribute3(data);
60660
+ static create(data, options) {
60661
+ const attribute = new Attribute3(data, options);
60413
60662
  const Type = this.items.get(attribute.type);
60414
60663
  if (Type) {
60415
- return new Type(data);
60664
+ return new Type(data, options);
60416
60665
  }
60417
60666
  return attribute;
60418
60667
  }
@@ -60705,6 +60954,121 @@ EdAlgorithm = __decorate([
60705
60954
  injectable_default()
60706
60955
  ], EdAlgorithm);
60707
60956
  instance.registerSingleton(diAlgorithm, EdAlgorithm);
60957
+ var MlDsaAlgorithm = class MlDsaAlgorithm2 {
60958
+ toAsnAlgorithm(alg) {
60959
+ let algorithm = null;
60960
+ switch (alg.name.toLowerCase()) {
60961
+ case "ml-dsa-44":
60962
+ algorithm = id_ml_dsa_44;
60963
+ break;
60964
+ case "ml-dsa-65":
60965
+ algorithm = id_ml_dsa_65;
60966
+ break;
60967
+ case "ml-dsa-87":
60968
+ algorithm = id_ml_dsa_87;
60969
+ break;
60970
+ }
60971
+ if (algorithm) {
60972
+ return new AlgorithmIdentifier({ algorithm });
60973
+ }
60974
+ return null;
60975
+ }
60976
+ toWebAlgorithm(alg) {
60977
+ switch (alg.algorithm) {
60978
+ case id_ml_dsa_44:
60979
+ return { name: "ML-DSA-44" };
60980
+ case id_ml_dsa_65:
60981
+ return { name: "ML-DSA-65" };
60982
+ case id_ml_dsa_87:
60983
+ return { name: "ML-DSA-87" };
60984
+ }
60985
+ return null;
60986
+ }
60987
+ };
60988
+ MlDsaAlgorithm = __decorate([
60989
+ injectable_default()
60990
+ ], MlDsaAlgorithm);
60991
+ instance.registerSingleton(diAlgorithm, MlDsaAlgorithm);
60992
+ var SlhDsaAlgorithm = class SlhDsaAlgorithm2 {
60993
+ toAsnAlgorithm(alg) {
60994
+ let algorithm = null;
60995
+ switch (alg.name.toLowerCase()) {
60996
+ case "slh-dsa-sha2-128s":
60997
+ algorithm = id_slh_dsa_sha2_128s;
60998
+ break;
60999
+ case "slh-dsa-sha2-128f":
61000
+ algorithm = id_slh_dsa_sha2_128f;
61001
+ break;
61002
+ case "slh-dsa-sha2-192s":
61003
+ algorithm = id_slh_dsa_sha2_192s;
61004
+ break;
61005
+ case "slh-dsa-sha2-192f":
61006
+ algorithm = id_slh_dsa_sha2_192f;
61007
+ break;
61008
+ case "slh-dsa-sha2-256s":
61009
+ algorithm = id_slh_dsa_sha2_256s;
61010
+ break;
61011
+ case "slh-dsa-sha2-256f":
61012
+ algorithm = id_slh_dsa_sha2_256f;
61013
+ break;
61014
+ case "slh-dsa-shake-128s":
61015
+ algorithm = id_slh_dsa_shake_128s;
61016
+ break;
61017
+ case "slh-dsa-shake-128f":
61018
+ algorithm = id_slh_dsa_shake_128f;
61019
+ break;
61020
+ case "slh-dsa-shake-192s":
61021
+ algorithm = id_slh_dsa_shake_192s;
61022
+ break;
61023
+ case "slh-dsa-shake-192f":
61024
+ algorithm = id_slh_dsa_shake_192f;
61025
+ break;
61026
+ case "slh-dsa-shake-256s":
61027
+ algorithm = id_slh_dsa_shake_256s;
61028
+ break;
61029
+ case "slh-dsa-shake-256f":
61030
+ algorithm = id_slh_dsa_shake_256f;
61031
+ break;
61032
+ }
61033
+ if (algorithm) {
61034
+ return new AlgorithmIdentifier({ algorithm });
61035
+ }
61036
+ return null;
61037
+ }
61038
+ toWebAlgorithm(alg) {
61039
+ switch (alg.algorithm) {
61040
+ case id_slh_dsa_sha2_128s:
61041
+ return { name: "SLH-DSA-SHA2-128s" };
61042
+ case id_slh_dsa_sha2_128f:
61043
+ return { name: "SLH-DSA-SHA2-128f" };
61044
+ case id_slh_dsa_sha2_192s:
61045
+ return { name: "SLH-DSA-SHA2-192s" };
61046
+ case id_slh_dsa_sha2_192f:
61047
+ return { name: "SLH-DSA-SHA2-192f" };
61048
+ case id_slh_dsa_sha2_256s:
61049
+ return { name: "SLH-DSA-SHA2-256s" };
61050
+ case id_slh_dsa_sha2_256f:
61051
+ return { name: "SLH-DSA-SHA2-256f" };
61052
+ case id_slh_dsa_shake_128s:
61053
+ return { name: "SLH-DSA-SHAKE-128s" };
61054
+ case id_slh_dsa_shake_128f:
61055
+ return { name: "SLH-DSA-SHAKE-128f" };
61056
+ case id_slh_dsa_shake_192s:
61057
+ return { name: "SLH-DSA-SHAKE-192s" };
61058
+ case id_slh_dsa_shake_192f:
61059
+ return { name: "SLH-DSA-SHAKE-192f" };
61060
+ case id_slh_dsa_shake_256s:
61061
+ return { name: "SLH-DSA-SHAKE-256s" };
61062
+ case id_slh_dsa_shake_256f:
61063
+ return { name: "SLH-DSA-SHAKE-256f" };
61064
+ }
61065
+ return null;
61066
+ }
61067
+ };
61068
+ SlhDsaAlgorithm = __decorate([
61069
+ injectable_default()
61070
+ ], SlhDsaAlgorithm);
61071
+ instance.registerSingleton(diAlgorithm, SlhDsaAlgorithm);
60708
61072
  var _Pkcs10CertificateRequest_tbs;
60709
61073
  var _Pkcs10CertificateRequest_subjectName;
60710
61074
  var _Pkcs10CertificateRequest_subject;
@@ -60741,13 +61105,13 @@ var Pkcs10CertificateRequest = class extends PemData {
60741
61105
  }
60742
61106
  get publicKey() {
60743
61107
  if (!__classPrivateFieldGet(this, _Pkcs10CertificateRequest_publicKey, "f")) {
60744
- __classPrivateFieldSet(this, _Pkcs10CertificateRequest_publicKey, new PublicKey(this.asn.certificationRequestInfo.subjectPKInfo), "f");
61108
+ __classPrivateFieldSet(this, _Pkcs10CertificateRequest_publicKey, new PublicKey(this.asn.certificationRequestInfo.subjectPKInfo, this.parseOptions), "f");
60745
61109
  }
60746
61110
  return __classPrivateFieldGet(this, _Pkcs10CertificateRequest_publicKey, "f");
60747
61111
  }
60748
61112
  get attributes() {
60749
61113
  if (!__classPrivateFieldGet(this, _Pkcs10CertificateRequest_attributes, "f")) {
60750
- __classPrivateFieldSet(this, _Pkcs10CertificateRequest_attributes, this.asn.certificationRequestInfo.attributes.map((o) => AttributeFactory.create(AsnConvert.serialize(o))), "f");
61114
+ __classPrivateFieldSet(this, _Pkcs10CertificateRequest_attributes, this.asn.certificationRequestInfo.attributes.map((o) => AttributeFactory.create(AsnConvert.serialize(o), this.parseOptions)), "f");
60751
61115
  }
60752
61116
  return __classPrivateFieldGet(this, _Pkcs10CertificateRequest_attributes, "f");
60753
61117
  }
@@ -60767,9 +61131,9 @@ var Pkcs10CertificateRequest = class extends PemData {
60767
61131
  }
60768
61132
  return __classPrivateFieldGet(this, _Pkcs10CertificateRequest_tbs, "f");
60769
61133
  }
60770
- constructor(param) {
60771
- const args = PemData.isAsnEncoded(param) ? [param, CertificationRequest] : [param];
60772
- super(args[0], args[1]);
61134
+ constructor(param, options) {
61135
+ const args = PemData.isAsnEncoded(param) ? [param, CertificationRequest, options] : [param, options];
61136
+ super(args[0], args[1], args[2]);
60773
61137
  _Pkcs10CertificateRequest_tbs.set(this, void 0);
60774
61138
  _Pkcs10CertificateRequest_subjectName.set(this, void 0);
60775
61139
  _Pkcs10CertificateRequest_subject.set(this, void 0);
@@ -60826,7 +61190,7 @@ var Pkcs10CertificateRequest = class extends PemData {
60826
61190
  }
60827
61191
  toTextObject() {
60828
61192
  const obj = this.toTextObjectEmpty();
60829
- const req = AsnConvert.parse(this.rawData, CertificationRequest);
61193
+ const req = AsnConvert.parse(this.rawData, CertificationRequest, this.parseOptions);
60830
61194
  const tbs = req.certificationRequestInfo;
60831
61195
  const data = new TextObject("", {
60832
61196
  Version: `${Version[tbs.version]} (${tbs.version})`,
@@ -60861,7 +61225,9 @@ var Pkcs10CertificateRequestGenerator = class {
60861
61225
  }
60862
61226
  const spki = await crypto4.subtle.exportKey("spki", params.keys.publicKey);
60863
61227
  const asnReq = new CertificationRequest({
60864
- certificationRequestInfo: new CertificationRequestInfo({ subjectPKInfo: AsnConvert.parse(spki, SubjectPublicKeyInfo) })
61228
+ certificationRequestInfo: new CertificationRequestInfo({
61229
+ subjectPKInfo: AsnConvert.parse(spki, SubjectPublicKeyInfo)
61230
+ })
60865
61231
  });
60866
61232
  if (params.name) {
60867
61233
  const name = params.name instanceof Name3 ? params.name : new Name3(params.name);
@@ -60904,6 +61270,38 @@ var Pkcs10CertificateRequestGenerator = class {
60904
61270
  return new Pkcs10CertificateRequest(AsnConvert.serialize(asnReq));
60905
61271
  }
60906
61272
  };
61273
+ function toPositiveIntegerOctets(input) {
61274
+ let firstNonZero = 0;
61275
+ while (firstNonZero < input.length - 1 && input[firstNonZero] === 0) {
61276
+ firstNonZero++;
61277
+ }
61278
+ let serialNumber = input.slice(firstNonZero);
61279
+ if (!serialNumber.length) {
61280
+ serialNumber = new Uint8Array([0]);
61281
+ }
61282
+ if (serialNumber[0] > 127) {
61283
+ const newSerialNumber = new Uint8Array(serialNumber.length + 1);
61284
+ newSerialNumber[0] = 0;
61285
+ newSerialNumber.set(serialNumber, 1);
61286
+ serialNumber = newSerialNumber;
61287
+ }
61288
+ return serialNumber.buffer;
61289
+ }
61290
+ function normalizeCertificateSerialNumber(input) {
61291
+ return toPositiveIntegerOctets(import_pvtsutils.BufferSourceConverter.toUint8Array(import_pvtsutils.Convert.FromHex(input || "")));
61292
+ }
61293
+ function generateCertificateSerialNumber(input, crypto4 = cryptoProvider.get()) {
61294
+ const inputView = import_pvtsutils.BufferSourceConverter.toUint8Array(import_pvtsutils.Convert.FromHex(input || ""));
61295
+ const serialNumber = inputView.length && inputView.some((o) => o > 0) ? inputView : crypto4.getRandomValues(new Uint8Array(16));
61296
+ return toPositiveIntegerOctets(serialNumber);
61297
+ }
61298
+ function getCertificateSerialNumber(raw) {
61299
+ let serialNumber = import_pvtsutils.BufferSourceConverter.toUint8Array(raw);
61300
+ if (serialNumber.length > 1 && serialNumber[0] === 0 && serialNumber[1] > 127) {
61301
+ serialNumber = serialNumber.slice(1);
61302
+ }
61303
+ return import_pvtsutils.Convert.ToHex(serialNumber);
61304
+ }
60907
61305
  var _X509Certificate_tbs;
60908
61306
  var _X509Certificate_serialNumber;
60909
61307
  var _X509Certificate_subjectName;
@@ -60919,18 +61317,13 @@ var _X509Certificate_publicKey;
60919
61317
  var X509Certificate = class extends PemData {
60920
61318
  get publicKey() {
60921
61319
  if (!__classPrivateFieldGet(this, _X509Certificate_publicKey, "f")) {
60922
- __classPrivateFieldSet(this, _X509Certificate_publicKey, new PublicKey(this.asn.tbsCertificate.subjectPublicKeyInfo), "f");
61320
+ __classPrivateFieldSet(this, _X509Certificate_publicKey, new PublicKey(this.asn.tbsCertificate.subjectPublicKeyInfo, this.parseOptions), "f");
60923
61321
  }
60924
61322
  return __classPrivateFieldGet(this, _X509Certificate_publicKey, "f");
60925
61323
  }
60926
61324
  get serialNumber() {
60927
61325
  if (!__classPrivateFieldGet(this, _X509Certificate_serialNumber, "f")) {
60928
- const tbs = this.asn.tbsCertificate;
60929
- let serialNumberBytes = new Uint8Array(tbs.serialNumber);
60930
- if (serialNumberBytes.length > 1 && serialNumberBytes[0] === 0 && serialNumberBytes[1] > 127) {
60931
- serialNumberBytes = serialNumberBytes.slice(1);
60932
- }
60933
- __classPrivateFieldSet(this, _X509Certificate_serialNumber, import_pvtsutils.Convert.ToHex(serialNumberBytes), "f");
61326
+ __classPrivateFieldSet(this, _X509Certificate_serialNumber, getCertificateSerialNumber(this.asn.tbsCertificate.serialNumber), "f");
60934
61327
  }
60935
61328
  return __classPrivateFieldGet(this, _X509Certificate_serialNumber, "f");
60936
61329
  }
@@ -60995,7 +61388,7 @@ var X509Certificate = class extends PemData {
60995
61388
  if (!__classPrivateFieldGet(this, _X509Certificate_extensions, "f")) {
60996
61389
  __classPrivateFieldSet(this, _X509Certificate_extensions, [], "f");
60997
61390
  if (this.asn.tbsCertificate.extensions) {
60998
- __classPrivateFieldSet(this, _X509Certificate_extensions, this.asn.tbsCertificate.extensions.map((o) => ExtensionFactory.create(AsnConvert.serialize(o))), "f");
61391
+ __classPrivateFieldSet(this, _X509Certificate_extensions, this.asn.tbsCertificate.extensions.map((o) => ExtensionFactory.create(AsnConvert.serialize(o), this.parseOptions)), "f");
60999
61392
  }
61000
61393
  }
61001
61394
  return __classPrivateFieldGet(this, _X509Certificate_extensions, "f");
@@ -61006,9 +61399,9 @@ var X509Certificate = class extends PemData {
61006
61399
  }
61007
61400
  return __classPrivateFieldGet(this, _X509Certificate_tbs, "f");
61008
61401
  }
61009
- constructor(param) {
61010
- const args = PemData.isAsnEncoded(param) ? [param, Certificate] : [param];
61011
- super(args[0], args[1]);
61402
+ constructor(param, options) {
61403
+ const args = PemData.isAsnEncoded(param) ? [param, Certificate, options] : [param, options];
61404
+ super(args[0], args[1], args[2]);
61012
61405
  _X509Certificate_tbs.set(this, void 0);
61013
61406
  _X509Certificate_serialNumber.set(this, void 0);
61014
61407
  _X509Certificate_subjectName.set(this, void 0);
@@ -61127,7 +61520,7 @@ var X509Certificate = class extends PemData {
61127
61520
  }
61128
61521
  toTextObject() {
61129
61522
  const obj = this.toTextObjectEmpty();
61130
- const cert = AsnConvert.parse(this.rawData, Certificate);
61523
+ const cert = AsnConvert.parse(this.rawData, Certificate, this.parseOptions);
61131
61524
  const tbs = cert.tbsCertificate;
61132
61525
  const data = new TextObject("", {
61133
61526
  Version: `${Version[tbs.version]} (${tbs.version})`,
@@ -61165,11 +61558,13 @@ var X509Certificate = class extends PemData {
61165
61558
  };
61166
61559
  _X509Certificate_tbs = /* @__PURE__ */ new WeakMap(), _X509Certificate_serialNumber = /* @__PURE__ */ new WeakMap(), _X509Certificate_subjectName = /* @__PURE__ */ new WeakMap(), _X509Certificate_subject = /* @__PURE__ */ new WeakMap(), _X509Certificate_issuerName = /* @__PURE__ */ new WeakMap(), _X509Certificate_issuer = /* @__PURE__ */ new WeakMap(), _X509Certificate_notBefore = /* @__PURE__ */ new WeakMap(), _X509Certificate_notAfter = /* @__PURE__ */ new WeakMap(), _X509Certificate_signatureAlgorithm = /* @__PURE__ */ new WeakMap(), _X509Certificate_signature = /* @__PURE__ */ new WeakMap(), _X509Certificate_extensions = /* @__PURE__ */ new WeakMap(), _X509Certificate_publicKey = /* @__PURE__ */ new WeakMap();
61167
61560
  X509Certificate.NAME = "Certificate";
61561
+ var _X509Certificates_options;
61168
61562
  var X509Certificates = class extends Array {
61169
- constructor(param) {
61563
+ constructor(param, options) {
61170
61564
  super();
61565
+ _X509Certificates_options.set(this, void 0);
61171
61566
  if (PemData.isAsnEncoded(param)) {
61172
- this.import(param);
61567
+ this.import(param, options);
61173
61568
  } else if (param instanceof X509Certificate) {
61174
61569
  this.push(param);
61175
61570
  } else if (Array.isArray(param)) {
@@ -61182,8 +61577,12 @@ var X509Certificates = class extends Array {
61182
61577
  const signedData = new SignedData();
61183
61578
  signedData.version = 1;
61184
61579
  signedData.encapContentInfo.eContentType = id_data;
61185
- signedData.encapContentInfo.eContent = new EncapsulatedContent({ single: new OctetString2() });
61186
- signedData.certificates = new CertificateSet(this.map((o) => new CertificateChoices({ certificate: AsnConvert.parse(o.rawData, Certificate) })));
61580
+ signedData.encapContentInfo.eContent = new EncapsulatedContent({
61581
+ single: new OctetString2()
61582
+ });
61583
+ signedData.certificates = new CertificateSet(this.map((o) => new CertificateChoices({
61584
+ certificate: AsnConvert.parse(o.rawData, Certificate, __classPrivateFieldGet(this, _X509Certificates_options, "f"))
61585
+ })));
61187
61586
  const cms = new ContentInfo({
61188
61587
  contentType: id_signedData,
61189
61588
  content: AsnConvert.serialize(signedData)
@@ -61194,19 +61593,24 @@ var X509Certificates = class extends Array {
61194
61593
  }
61195
61594
  return this.toString(format4);
61196
61595
  }
61197
- import(data) {
61596
+ import(data, options) {
61198
61597
  const raw = PemData.toArrayBuffer(data);
61199
- const cms = AsnConvert.parse(raw, ContentInfo);
61598
+ const cms = AsnConvert.parse(raw, ContentInfo, options);
61200
61599
  if (cms.contentType !== id_signedData) {
61201
61600
  throw new TypeError("Cannot parse CMS package. Incoming data is not a SignedData object.");
61202
61601
  }
61203
- const signedData = AsnConvert.parse(cms.content, SignedData);
61204
- this.clear();
61602
+ const signedData = AsnConvert.parse(cms.content, SignedData, options);
61603
+ const certificates = [];
61205
61604
  for (const item of signedData.certificates || []) {
61206
61605
  if (item.certificate) {
61207
- this.push(new X509Certificate(item.certificate));
61606
+ certificates.push(new X509Certificate(item.certificate, options));
61208
61607
  }
61209
61608
  }
61609
+ this.clear();
61610
+ for (const certificate of certificates) {
61611
+ this.push(certificate);
61612
+ }
61613
+ __classPrivateFieldSet(this, _X509Certificates_options, options, "f");
61210
61614
  }
61211
61615
  clear() {
61212
61616
  while (this.pop()) {
@@ -61220,7 +61624,7 @@ var X509Certificates = class extends Array {
61220
61624
  case "pem-chain":
61221
61625
  return this.map((o) => o.toString("pem")).join("\n");
61222
61626
  case "asn":
61223
- return AsnConvert.toString(raw);
61627
+ return AsnConvert.toString(raw, __classPrivateFieldGet(this, _X509Certificates_options, "f"));
61224
61628
  case "hex":
61225
61629
  return import_pvtsutils.Convert.ToHex(raw);
61226
61630
  case "base64":
@@ -61234,8 +61638,8 @@ var X509Certificates = class extends Array {
61234
61638
  }
61235
61639
  }
61236
61640
  toTextObject() {
61237
- const contentInfo = AsnConvert.parse(this.export("raw"), ContentInfo);
61238
- const signedData = AsnConvert.parse(contentInfo.content, SignedData);
61641
+ const contentInfo = AsnConvert.parse(this.export("raw"), ContentInfo, __classPrivateFieldGet(this, _X509Certificates_options, "f"));
61642
+ const signedData = AsnConvert.parse(contentInfo.content, SignedData, __classPrivateFieldGet(this, _X509Certificates_options, "f"));
61239
61643
  const obj = new TextObject("X509Certificates", {
61240
61644
  "Content Type": OidSerializer.toString(contentInfo.contentType),
61241
61645
  Content: new TextObject("", {
@@ -61246,6 +61650,7 @@ var X509Certificates = class extends Array {
61246
61650
  return obj;
61247
61651
  }
61248
61652
  };
61653
+ _X509Certificates_options = /* @__PURE__ */ new WeakMap();
61249
61654
  var X509ChainBuilder = class {
61250
61655
  constructor(params = {}) {
61251
61656
  this.certificates = [];
@@ -61310,25 +61715,6 @@ var X509ChainBuilder = class {
61310
61715
  return null;
61311
61716
  }
61312
61717
  };
61313
- function generateCertificateSerialNumber(input, crypto4 = cryptoProvider.get()) {
61314
- const inputView = import_pvtsutils.BufferSourceConverter.toUint8Array(import_pvtsutils.Convert.FromHex(input || ""));
61315
- let serialNumber = inputView && inputView.length && inputView.some((o) => o > 0) ? new Uint8Array(inputView) : void 0;
61316
- if (!serialNumber) {
61317
- serialNumber = crypto4.getRandomValues(new Uint8Array(16));
61318
- }
61319
- let firstNonZero = 0;
61320
- while (firstNonZero < serialNumber.length - 1 && serialNumber[firstNonZero] === 0) {
61321
- firstNonZero++;
61322
- }
61323
- serialNumber = serialNumber.slice(firstNonZero);
61324
- if (serialNumber[0] > 127) {
61325
- const newSerialNumber = new Uint8Array(serialNumber.length + 1);
61326
- newSerialNumber[0] = 0;
61327
- newSerialNumber.set(serialNumber, 1);
61328
- serialNumber = newSerialNumber;
61329
- }
61330
- return serialNumber.buffer;
61331
- }
61332
61718
  var X509CertificateGenerator = class {
61333
61719
  static async createSelfSigned(params, crypto4 = cryptoProvider.get()) {
61334
61720
  if (!params.keys.privateKey) {
@@ -61433,7 +61819,7 @@ var X509CrlReason;
61433
61819
  var X509CrlEntry = class extends AsnData {
61434
61820
  get serialNumber() {
61435
61821
  if (!__classPrivateFieldGet(this, _X509CrlEntry_serialNumber, "f")) {
61436
- __classPrivateFieldSet(this, _X509CrlEntry_serialNumber, import_pvtsutils.Convert.ToHex(this.asn.userCertificate), "f");
61822
+ __classPrivateFieldSet(this, _X509CrlEntry_serialNumber, getCertificateSerialNumber(this.asn.userCertificate), "f");
61437
61823
  }
61438
61824
  return __classPrivateFieldGet(this, _X509CrlEntry_serialNumber, "f");
61439
61825
  }
@@ -61460,16 +61846,16 @@ var X509CrlEntry = class extends AsnData {
61460
61846
  __classPrivateFieldSet(this, _X509CrlEntry_extensions, [], "f");
61461
61847
  if (this.asn.crlEntryExtensions) {
61462
61848
  __classPrivateFieldSet(this, _X509CrlEntry_extensions, this.asn.crlEntryExtensions.map((o) => {
61463
- const extension = ExtensionFactory.create(AsnConvert.serialize(o));
61849
+ const extension = ExtensionFactory.create(AsnConvert.serialize(o), this.parseOptions);
61464
61850
  switch (extension.type) {
61465
61851
  case id_ce_cRLReasons:
61466
61852
  if (__classPrivateFieldGet(this, _X509CrlEntry_reason, "f") === void 0) {
61467
- __classPrivateFieldSet(this, _X509CrlEntry_reason, AsnConvert.parse(extension.value, CRLReason).reason, "f");
61853
+ __classPrivateFieldSet(this, _X509CrlEntry_reason, AsnConvert.parse(extension.value, CRLReason, this.parseOptions).reason, "f");
61468
61854
  }
61469
61855
  break;
61470
61856
  case id_ce_invalidityDate:
61471
61857
  if (__classPrivateFieldGet(this, _X509CrlEntry_invalidity, "f") === void 0) {
61472
- __classPrivateFieldSet(this, _X509CrlEntry_invalidity, AsnConvert.parse(extension.value, InvalidityDate).value, "f");
61858
+ __classPrivateFieldSet(this, _X509CrlEntry_invalidity, AsnConvert.parse(extension.value, InvalidityDate, this.parseOptions).value, "f");
61473
61859
  }
61474
61860
  break;
61475
61861
  }
@@ -61481,21 +61867,25 @@ var X509CrlEntry = class extends AsnData {
61481
61867
  }
61482
61868
  constructor(...args) {
61483
61869
  let raw;
61870
+ let options;
61484
61871
  if (import_pvtsutils.BufferSourceConverter.isBufferSource(args[0])) {
61485
61872
  raw = import_pvtsutils.BufferSourceConverter.toArrayBuffer(args[0]);
61873
+ options = args[1];
61486
61874
  } else if (typeof args[0] === "string") {
61487
61875
  raw = AsnConvert.serialize(new RevokedCertificate({
61488
- userCertificate: generateCertificateSerialNumber(args[0]),
61876
+ userCertificate: normalizeCertificateSerialNumber(args[0]),
61489
61877
  revocationDate: new Time(args[1]),
61490
61878
  crlEntryExtensions: args[2]
61491
61879
  }));
61492
61880
  } else if (args[0] instanceof RevokedCertificate) {
61493
61881
  raw = args[0];
61882
+ options = args[1];
61494
61883
  }
61495
61884
  if (!raw) {
61496
61885
  throw new TypeError("Cannot create X509CrlEntry instance. Wrong constructor arguments.");
61497
61886
  }
61498
- super(raw, RevokedCertificate);
61887
+ const superArgs = raw instanceof RevokedCertificate ? [raw, options] : [raw, RevokedCertificate, options];
61888
+ super(superArgs[0], superArgs[1], superArgs[2]);
61499
61889
  _X509CrlEntry_serialNumber.set(this, void 0);
61500
61890
  _X509CrlEntry_revocationDate.set(this, void 0);
61501
61891
  _X509CrlEntry_reason.set(this, void 0);
@@ -61556,7 +61946,7 @@ var X509Crl = class extends PemData {
61556
61946
  get entries() {
61557
61947
  var _a3;
61558
61948
  if (!__classPrivateFieldGet(this, _X509Crl_entries, "f")) {
61559
- __classPrivateFieldSet(this, _X509Crl_entries, ((_a3 = this.asn.tbsCertList.revokedCertificates) === null || _a3 === void 0 ? void 0 : _a3.map((o) => new X509CrlEntry(o))) || [], "f");
61949
+ __classPrivateFieldSet(this, _X509Crl_entries, ((_a3 = this.asn.tbsCertList.revokedCertificates) === null || _a3 === void 0 ? void 0 : _a3.map((o) => new X509CrlEntry(o, this.parseOptions))) || [], "f");
61560
61950
  }
61561
61951
  return __classPrivateFieldGet(this, _X509Crl_entries, "f");
61562
61952
  }
@@ -61564,7 +61954,7 @@ var X509Crl = class extends PemData {
61564
61954
  if (!__classPrivateFieldGet(this, _X509Crl_extensions, "f")) {
61565
61955
  __classPrivateFieldSet(this, _X509Crl_extensions, [], "f");
61566
61956
  if (this.asn.tbsCertList.crlExtensions) {
61567
- __classPrivateFieldSet(this, _X509Crl_extensions, this.asn.tbsCertList.crlExtensions.map((o) => ExtensionFactory.create(AsnConvert.serialize(o))), "f");
61957
+ __classPrivateFieldSet(this, _X509Crl_extensions, this.asn.tbsCertList.crlExtensions.map((o) => ExtensionFactory.create(AsnConvert.serialize(o), this.parseOptions)), "f");
61568
61958
  }
61569
61959
  }
61570
61960
  return __classPrivateFieldGet(this, _X509Crl_extensions, "f");
@@ -61581,8 +61971,9 @@ var X509Crl = class extends PemData {
61581
61971
  get certListSignatureAlgorithm() {
61582
61972
  return this.asn.signatureAlgorithm;
61583
61973
  }
61584
- constructor(param) {
61585
- super(param, PemData.isAsnEncoded(param) ? CertificateList : void 0);
61974
+ constructor(param, options) {
61975
+ const args = PemData.isAsnEncoded(param) ? [param, CertificateList, options] : [param, options];
61976
+ super(args[0], args[1], args[2]);
61586
61977
  this.tag = PemConverter.CrlTag;
61587
61978
  _X509Crl_tbs.set(this, void 0);
61588
61979
  _X509Crl_signatureAlgorithm.set(this, void 0);
@@ -61676,10 +62067,10 @@ var X509Crl = class extends PemData {
61676
62067
  }
61677
62068
  findRevoked(certOrSerialNumber) {
61678
62069
  const serialNumber = typeof certOrSerialNumber === "string" ? certOrSerialNumber : certOrSerialNumber.serialNumber;
61679
- const serialBuffer = generateCertificateSerialNumber(serialNumber);
62070
+ const serialBuffer = normalizeCertificateSerialNumber(serialNumber);
61680
62071
  for (const revoked of this.asn.tbsCertList.revokedCertificates || []) {
61681
62072
  if (import_pvtsutils.BufferSourceConverter.isEqual(revoked.userCertificate, serialBuffer)) {
61682
- return new X509CrlEntry(AsnConvert.serialize(revoked));
62073
+ return new X509CrlEntry(AsnConvert.serialize(revoked), this.parseOptions);
61683
62074
  }
61684
62075
  }
61685
62076
  return null;
@@ -61706,7 +62097,7 @@ var X509CrlGenerator = class {
61706
62097
  if (params.entries && params.entries.length) {
61707
62098
  asnX509Crl.tbsCertList.revokedCertificates = [];
61708
62099
  for (const entry of params.entries) {
61709
- const userCertificate = PemData.toArrayBuffer(entry.serialNumber);
62100
+ const userCertificate = normalizeCertificateSerialNumber(entry.serialNumber);
61710
62101
  const index = asnX509Crl.tbsCertList.revokedCertificates.findIndex((cert) => (0, import_pvtsutils.isEqual)(cert.userCertificate, userCertificate));
61711
62102
  if (index > -1) {
61712
62103
  throw new Error(`Certificate serial number ${entry.serialNumber} already exists in tbsCertList`);