node-opcua-crypto 4.9.3 → 4.10.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.mjs CHANGED
@@ -14,8 +14,10 @@ import {
14
14
  readPublicKeyPEM,
15
15
  readPublicRsaKey,
16
16
  setCertificateStore
17
- } from "./chunk-WYY6WVVJ.mjs";
18
- import "./chunk-5NV4OKIV.mjs";
17
+ } from "./chunk-GNEWUC7X.mjs";
18
+ import {
19
+ exploreAsn1
20
+ } from "./chunk-VI4S2NM5.mjs";
19
21
  import {
20
22
  CertificatePurpose,
21
23
  PaddingAlgorithm,
@@ -110,7 +112,7 @@ import {
110
112
  verifyChunkSignature,
111
113
  verifyChunkSignatureWithDerivedKeys,
112
114
  verifyMessageChunkSignature
113
- } from "./chunk-VAMKYXNP.mjs";
115
+ } from "./chunk-46EEAYVO.mjs";
114
116
  export {
115
117
  CertificatePurpose,
116
118
  PaddingAlgorithm,
@@ -157,6 +159,7 @@ export {
157
159
  decryptBufferWithDerivedKeys,
158
160
  derToPrivateKey,
159
161
  encryptBufferWithDerivedKeys,
162
+ exploreAsn1,
160
163
  exploreCertificate,
161
164
  exploreCertificateInfo,
162
165
  exploreCertificateRevocationList,
@@ -1,4 +1,5 @@
1
1
  export { C as Certificate, d as CertificatePEM, h as CertificatePurpose, g as CertificateRevocationList, D as DER, K as KeyObject, N as Nonce, b as PEM, P as PrivateKey, e as PrivateKeyPEM, a as PublicKey, f as PublicKeyPEM, S as Signature, c as createPrivateKeyFromNodeJSCrypto, i as isKeyObject } from './common-CFr95Map.mjs';
2
- export { AlgorithmIdentifier, AttributeTypeAndValue, AuthorityKeyIdentifier, BasicConstraints, BitString, BlockInfo, CertificateExtension, CertificateInfo, CertificateInternals, CertificateRevocationListInfo, CertificateSerialNumber, CertificateSigningRequestInfo, ComputeDerivedKeysOptions, CreateSelfSignCertificateOptions, DerivedKeys, DirectoryName, ExtensionRequest, Extensions, Name, PaddingAlgorithm, PrivateKeyInternals, PublicKeyLength, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, RevokedCertificate, SignatureValue, Subject, SubjectOptions, SubjectPublicKey, SubjectPublicKeyInfo, TBSCertList, TagType, TbsCertificate, Validity, VerifyChunkSignatureOptions, VerifyMessageChunkSignatureOptions, Version, X509ExtKeyUsage, X509KeyUsage, _VerifyStatus, _coercePrivateKey, _findBlockAtIndex, _getBlock, _readAlgorithmIdentifier, _readBitString, _readBooleanValue, _readDirectoryName, _readECCAlgorithmIdentifier, _readExtension, _readIntegerAsByteString, _readIntegerValue, _readListOfInteger, _readLongIntegerValue, _readObjectIdentifier, _readOctetString, _readSignatureValue, _readSignatureValueBin, _readStruct, _readTime, _readValue, _readVersionValue, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, compactDirectoryName, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, formatBuffer2DigitHexWithColum, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePseudoRandomBuffer, makeSHA1Thumbprint, parseBitString, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readNameForCrl, readTag, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyMessageChunkSignature } from './source/index.mjs';
2
+ export { AlgorithmIdentifier, AttributeTypeAndValue, AuthorityKeyIdentifier, BasicConstraints, BitString, BlockInfo, CertificateExtension, CertificateInfo, CertificateInternals, CertificateRevocationListInfo, CertificateSerialNumber, CertificateSigningRequestInfo, ComputeDerivedKeysOptions, CreateSelfSignCertificateOptions, DerivedKeys, DirectoryName, ExtensionRequest, Extensions, Name, PaddingAlgorithm, PrivateKeyInternals, PublicKeyLength, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, RevokedCertificate, SignatureValue, Subject, SubjectOptions, SubjectPublicKey, SubjectPublicKeyInfo, TBSCertList, TagType, TbsCertificate, Validity, VerifyChunkSignatureOptions, VerifyMessageChunkSignatureOptions, Version, X509ExtKeyUsage, X509KeyUsage, _VerifyStatus, _coercePrivateKey, _findBlockAtIndex, _getBlock, _readAlgorithmIdentifier, _readBitString, _readBooleanValue, _readDirectoryName, _readECCAlgorithmIdentifier, _readExtension, _readIntegerAsByteString, _readIntegerValue, _readListOfInteger, _readLongIntegerValue, _readObjectIdentifier, _readOctetString, _readSignatureValue, _readSignatureValueBin, _readStruct, _readTime, _readValue, _readVersionValue, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, compactDirectoryName, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, formatBuffer2DigitHexWithColum, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePseudoRandomBuffer, makeSHA1Thumbprint, parseBitString, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readNameForCrl, readTag, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyMessageChunkSignature } from './source/index_web.mjs';
3
+ export { exploreAsn1 } from './source/index.mjs';
3
4
  import 'crypto';
4
5
  import '@peculiar/x509';
@@ -1,4 +1,5 @@
1
1
  export { C as Certificate, d as CertificatePEM, h as CertificatePurpose, g as CertificateRevocationList, D as DER, K as KeyObject, N as Nonce, b as PEM, P as PrivateKey, e as PrivateKeyPEM, a as PublicKey, f as PublicKeyPEM, S as Signature, c as createPrivateKeyFromNodeJSCrypto, i as isKeyObject } from './common-CFr95Map.js';
2
- export { AlgorithmIdentifier, AttributeTypeAndValue, AuthorityKeyIdentifier, BasicConstraints, BitString, BlockInfo, CertificateExtension, CertificateInfo, CertificateInternals, CertificateRevocationListInfo, CertificateSerialNumber, CertificateSigningRequestInfo, ComputeDerivedKeysOptions, CreateSelfSignCertificateOptions, DerivedKeys, DirectoryName, ExtensionRequest, Extensions, Name, PaddingAlgorithm, PrivateKeyInternals, PublicKeyLength, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, RevokedCertificate, SignatureValue, Subject, SubjectOptions, SubjectPublicKey, SubjectPublicKeyInfo, TBSCertList, TagType, TbsCertificate, Validity, VerifyChunkSignatureOptions, VerifyMessageChunkSignatureOptions, Version, X509ExtKeyUsage, X509KeyUsage, _VerifyStatus, _coercePrivateKey, _findBlockAtIndex, _getBlock, _readAlgorithmIdentifier, _readBitString, _readBooleanValue, _readDirectoryName, _readECCAlgorithmIdentifier, _readExtension, _readIntegerAsByteString, _readIntegerValue, _readListOfInteger, _readLongIntegerValue, _readObjectIdentifier, _readOctetString, _readSignatureValue, _readSignatureValueBin, _readStruct, _readTime, _readValue, _readVersionValue, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, compactDirectoryName, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, formatBuffer2DigitHexWithColum, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePseudoRandomBuffer, makeSHA1Thumbprint, parseBitString, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readNameForCrl, readTag, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyMessageChunkSignature } from './source/index.js';
2
+ export { AlgorithmIdentifier, AttributeTypeAndValue, AuthorityKeyIdentifier, BasicConstraints, BitString, BlockInfo, CertificateExtension, CertificateInfo, CertificateInternals, CertificateRevocationListInfo, CertificateSerialNumber, CertificateSigningRequestInfo, ComputeDerivedKeysOptions, CreateSelfSignCertificateOptions, DerivedKeys, DirectoryName, ExtensionRequest, Extensions, Name, PaddingAlgorithm, PrivateKeyInternals, PublicKeyLength, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, RevokedCertificate, SignatureValue, Subject, SubjectOptions, SubjectPublicKey, SubjectPublicKeyInfo, TBSCertList, TagType, TbsCertificate, Validity, VerifyChunkSignatureOptions, VerifyMessageChunkSignatureOptions, Version, X509ExtKeyUsage, X509KeyUsage, _VerifyStatus, _coercePrivateKey, _findBlockAtIndex, _getBlock, _readAlgorithmIdentifier, _readBitString, _readBooleanValue, _readDirectoryName, _readECCAlgorithmIdentifier, _readExtension, _readIntegerAsByteString, _readIntegerValue, _readListOfInteger, _readLongIntegerValue, _readObjectIdentifier, _readOctetString, _readSignatureValue, _readSignatureValueBin, _readStruct, _readTime, _readValue, _readVersionValue, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, compactDirectoryName, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, formatBuffer2DigitHexWithColum, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePseudoRandomBuffer, makeSHA1Thumbprint, parseBitString, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readNameForCrl, readTag, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyMessageChunkSignature } from './source/index_web.js';
3
+ export { exploreAsn1 } from './source/index.js';
3
4
  import 'crypto';
4
5
  import '@peculiar/x509';
package/dist/index_web.js CHANGED
@@ -75,6 +75,7 @@ __export(index_web_exports, {
75
75
  decryptBufferWithDerivedKeys: () => decryptBufferWithDerivedKeys,
76
76
  derToPrivateKey: () => derToPrivateKey,
77
77
  encryptBufferWithDerivedKeys: () => encryptBufferWithDerivedKeys,
78
+ exploreAsn1: () => exploreAsn1,
78
79
  exploreCertificate: () => exploreCertificate,
79
80
  exploreCertificateInfo: () => exploreCertificateInfo,
80
81
  exploreCertificateRevocationList: () => exploreCertificateRevocationList,
@@ -229,6 +230,7 @@ var oid_map = {
229
230
  "1.3.6.1.4.1.311.2.1.22": { d: "1.3.6.1.4.1.311.2.1.22", c: "SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID" },
230
231
  "1.3.6.1.4.1.311.10.3.1": { d: "1.3.6.1.4.1.311.10.3.1", c: "Signer of CTLs -- szOID_KP_CTL_USAGE_SIGNING" },
231
232
  "1.3.6.1.4.1.311.10.3.4": { d: "1.3.6.1.4.1.311.10.3.4", c: "szOID_EFS_RECOVERY (Encryption File System)" },
233
+ "1.3.6.1.4.1.311.20.2.3": { d: "1.3.6.1.4.1.311.20.2.3", c: "id-on-personalData" },
232
234
  "1.3.6.1.5.5.7.3.17": { d: "1.3.6.1.5.5.7.3.17", c: "Internet Key Exchange (IKE)" },
233
235
  "1.3.6.1.5.5.7.3.1": { d: "serverAuth", c: "PKIX key purpose" },
234
236
  "1.3.6.1.5.5.7.3.2": { d: "clientAuth", c: "PKIX key purpose" },
@@ -488,12 +490,15 @@ var TagType = /* @__PURE__ */ ((TagType3) => {
488
490
  TagType3[TagType3["BMPString"] = 30] = "BMPString";
489
491
  TagType3[TagType3["SEQUENCE"] = 48] = "SEQUENCE";
490
492
  TagType3[TagType3["SET"] = 49] = "SET";
491
- TagType3[TagType3["A3"] = 163] = "A3";
493
+ TagType3[TagType3["CONTEXT_SPECIFIC0"] = 160] = "CONTEXT_SPECIFIC0";
494
+ TagType3[TagType3["CONTEXT_SPECIFIC1"] = 161] = "CONTEXT_SPECIFIC1";
495
+ TagType3[TagType3["CONTEXT_SPECIFIC2"] = 162] = "CONTEXT_SPECIFIC2";
496
+ TagType3[TagType3["CONTEXT_SPECIFIC3"] = 163] = "CONTEXT_SPECIFIC3";
497
+ TagType3[TagType3["A4"] = 164] = "A4";
492
498
  return TagType3;
493
499
  })(TagType || {});
494
500
  function readTag(buf, pos) {
495
- (0, import_assert.default)(buf instanceof Buffer);
496
- (0, import_assert.default)(Number.isFinite(pos) && pos >= 0);
501
+ const start = pos;
497
502
  if (buf.length <= pos) {
498
503
  throw new Error("Invalid position : buf.length=" + buf.length + " pos =" + pos);
499
504
  }
@@ -509,7 +514,7 @@ function readTag(buf, pos) {
509
514
  pos += 1;
510
515
  }
511
516
  }
512
- return { tag, position: pos, length };
517
+ return { start, tag, position: pos, length };
513
518
  }
514
519
  function _readStruct(buf, blockInfo) {
515
520
  const length = blockInfo.length;
@@ -574,8 +579,8 @@ function _readIntegerAsByteString(buffer, block) {
574
579
  function _readListOfInteger(buffer) {
575
580
  const block = readTag(buffer, 0);
576
581
  const inner_blocks = _readStruct(buffer, block);
577
- return inner_blocks.map((bblock) => {
578
- return _readIntegerAsByteString(buffer, bblock);
582
+ return inner_blocks.map((innerBlock) => {
583
+ return _readIntegerAsByteString(buffer, innerBlock);
579
584
  });
580
585
  }
581
586
  function parseOID(buffer, start, end) {
@@ -838,7 +843,8 @@ function _readGeneralNames(buffer, block) {
838
843
  5: { name: "ediPartyName", type: "EDIPartyName" },
839
844
  6: { name: "uniformResourceIdentifier", type: "IA5String" },
840
845
  7: { name: "iPAddress", type: "OCTET_STRING" },
841
- 8: { name: "registeredID", type: "OBJECT_IDENTIFIER" }
846
+ 8: { name: "registeredID", type: "OBJECT_IDENTIFIER" },
847
+ 32: { name: "otherName", type: "AnotherName" }
842
848
  };
843
849
  const blocks = _readStruct(buffer, block);
844
850
  function _readFromType(buffer2, block2, type) {
@@ -852,13 +858,28 @@ function _readGeneralNames(buffer, block) {
852
858
  const n = {};
853
859
  for (const block2 of blocks) {
854
860
  (0, import_assert2.default)((block2.tag & 128) === 128);
855
- const t = block2.tag & 127;
856
- const type = _data[t];
861
+ const t2 = block2.tag & 127;
862
+ const type = _data[t2];
857
863
  if (!type) {
858
- throw new Error(" INVALID TYPE => " + t + "0x" + t.toString(16));
864
+ console.log("_readGeneralNames: INVALID TYPE => " + t2 + " 0x" + t2.toString(16));
865
+ continue;
866
+ }
867
+ if (t2 == 32) {
868
+ n[type.name] = n[type.name] || [];
869
+ const blocks2 = _readStruct(buffer, block2);
870
+ const name = _readObjectIdentifier(buffer, blocks2[0]).name;
871
+ const buf = _getBlock(buffer, blocks2[1]);
872
+ const b = readTag(buf, 0);
873
+ const nn = _readValue(buf, b);
874
+ const data = {
875
+ identifier: name,
876
+ value: nn
877
+ };
878
+ n[type.name].push(data.value);
879
+ } else {
880
+ n[type.name] = n[type.name] || [];
881
+ n[type.name].push(_readFromType(buffer, block2, type.type));
859
882
  }
860
- n[type.name] = n[type.name] || [];
861
- n[type.name].push(_readFromType(buffer, block2, type.type));
862
883
  }
863
884
  return n;
864
885
  }
@@ -1744,19 +1765,20 @@ var x509 = __toESM(require("@peculiar/x509"));
1744
1765
  var import_webcrypto = require("@peculiar/webcrypto");
1745
1766
  var import_crypto5 = __toESM(require("crypto"));
1746
1767
  var x5092 = __toESM(require("@peculiar/x509"));
1768
+ var doDebug3 = false;
1747
1769
  var _crypto;
1748
1770
  var ignoreCrypto = process.env.IGNORE_SUBTLE_FROM_CRYPTO;
1749
1771
  if (typeof window === "undefined") {
1750
1772
  _crypto = import_crypto5.default;
1751
1773
  if (!_crypto?.subtle || ignoreCrypto) {
1752
1774
  _crypto = new import_webcrypto.Crypto();
1753
- console.warn("using @peculiar/webcrypto");
1775
+ doDebug3 && console.warn("using @peculiar/webcrypto");
1754
1776
  } else {
1755
- console.warn("using nodejs crypto (native)");
1777
+ doDebug3 && console.warn("using nodejs crypto (native)");
1756
1778
  }
1757
1779
  x509.cryptoProvider.set(_crypto);
1758
1780
  } else {
1759
- console.warn("using browser crypto (native)");
1781
+ doDebug3 && console.warn("using browser crypto (native)");
1760
1782
  _crypto = crypto;
1761
1783
  x509.cryptoProvider.set(crypto);
1762
1784
  }
@@ -1894,8 +1916,8 @@ var Subject = class _Subject {
1894
1916
  return this.toStringInternal("/");
1895
1917
  }
1896
1918
  toString() {
1897
- const t = this.toStringForOPCUA();
1898
- return t ? "/" + t : t;
1919
+ const t2 = this.toStringForOPCUA();
1920
+ return t2 ? "/" + t2 : t2;
1899
1921
  }
1900
1922
  };
1901
1923
 
@@ -6166,7 +6188,7 @@ async function createSelfSignedCertificate({
6166
6188
 
6167
6189
  // source/x509/coerce_private_key.ts
6168
6190
  var crypto2 = getCrypto();
6169
- var doDebug3 = false;
6191
+ var doDebug4 = false;
6170
6192
  function coercePEMorDerToPrivateKey(privateKeyInDerOrPem) {
6171
6193
  if (typeof privateKeyInDerOrPem === "string") {
6172
6194
  const hidden = createPrivateKeyFromNodeJSCrypto(privateKeyInDerOrPem);
@@ -6184,7 +6206,7 @@ async function _coercePrivateKey(privateKey) {
6184
6206
  const privateKey1 = await pemToPrivateKey(privateKey);
6185
6207
  return KeyObject4.from(privateKey1);
6186
6208
  } catch (err) {
6187
- doDebug3 && console.log(privateKey);
6209
+ doDebug4 && console.log(privateKey);
6188
6210
  throw err;
6189
6211
  }
6190
6212
  } else if (privateKey instanceof KeyObject4) {
@@ -6193,6 +6215,33 @@ async function _coercePrivateKey(privateKey) {
6193
6215
  throw new Error("Invalid privateKey");
6194
6216
  }
6195
6217
 
6218
+ // source/explore_asn1.ts
6219
+ function t(tag) {
6220
+ return TagType[tag];
6221
+ }
6222
+ function bi(blockInfo, depth) {
6223
+ const indent = " ".repeat(depth);
6224
+ const hl = blockInfo.position - blockInfo.start;
6225
+ return `${blockInfo.start.toString().padStart(5, " ")}:d=${depth} hl=${hl.toString().padEnd(3, " ")} l=${blockInfo.length.toString().padStart(6, " ")} ${blockInfo.tag.toString(16).padEnd(2, " ")} ${indent} ${t(blockInfo.tag)}`;
6226
+ }
6227
+ function exploreAsn1(buffer) {
6228
+ console.log(hexDump(buffer));
6229
+ function dump(offset, depth) {
6230
+ const blockInfo = readTag(buffer, offset);
6231
+ dumpBlock(blockInfo, depth);
6232
+ function dumpBlock(blockInfo2, depth2) {
6233
+ console.log(bi(blockInfo2, depth2));
6234
+ if (blockInfo2.tag === 48 /* SEQUENCE */ || blockInfo2.tag === 49 /* SET */ || blockInfo2.tag >= 160 /* CONTEXT_SPECIFIC0 */) {
6235
+ const blocks = _readStruct(buffer, blockInfo2);
6236
+ for (const block of blocks) {
6237
+ dumpBlock(block, depth2 + 1);
6238
+ }
6239
+ }
6240
+ }
6241
+ }
6242
+ dump(0, 0);
6243
+ }
6244
+
6196
6245
  // source/make_private_key_from_pem.ts
6197
6246
  function makePrivateKeyFromPem(privateKeyInPem) {
6198
6247
  return { hidden: privateKeyInPem };
@@ -6244,6 +6293,7 @@ function makePrivateKeyFromPem(privateKeyInPem) {
6244
6293
  decryptBufferWithDerivedKeys,
6245
6294
  derToPrivateKey,
6246
6295
  encryptBufferWithDerivedKeys,
6296
+ exploreAsn1,
6247
6297
  exploreCertificate,
6248
6298
  exploreCertificateInfo,
6249
6299
  exploreCertificateRevocationList,