node-opcua-crypto 5.0.0 → 5.2.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/{source/index.js → chunk-ERHE4VFS.cjs} +573 -569
- package/dist/chunk-ERHE4VFS.cjs.map +1 -0
- package/dist/{chunk-BIS3W2GR.mjs → chunk-KCVNMSLI.js} +462 -363
- package/dist/chunk-KCVNMSLI.js.map +1 -0
- package/dist/chunk-LCGIBEY5.cjs +168 -0
- package/dist/chunk-LCGIBEY5.cjs.map +1 -0
- package/dist/{chunk-ISIVVQGT.mjs → chunk-WXGEXWZG.js} +9 -8
- package/dist/chunk-WXGEXWZG.js.map +1 -0
- package/dist/index.cjs +185 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +98 -6652
- package/dist/index.js.map +1 -1
- package/dist/source/index_web.cjs +155 -0
- package/dist/source/index_web.cjs.map +1 -0
- package/dist/source/{index_web.d.mts → index_web.d.cts} +212 -159
- package/dist/source/index_web.d.ts +211 -158
- package/dist/source/index_web.js +82 -6497
- package/dist/source/index_web.js.map +1 -1
- package/dist/source_nodejs/index.cjs +34 -0
- package/dist/source_nodejs/index.cjs.map +1 -0
- package/dist/source_nodejs/{index.d.mts → index.d.cts} +3 -2
- package/dist/source_nodejs/index.d.ts +2 -1
- package/dist/source_nodejs/index.js +19 -4141
- package/dist/source_nodejs/index.js.map +1 -1
- package/package.json +36 -21
- package/dist/chunk-BIS3W2GR.mjs.map +0 -1
- package/dist/chunk-ISIVVQGT.mjs.map +0 -1
- package/dist/chunk-RQA4DO2Z.mjs +0 -1
- package/dist/chunk-RQA4DO2Z.mjs.map +0 -1
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +0 -180
- package/dist/index.mjs.map +0 -1
- package/dist/source/index.d.mts +0 -4
- package/dist/source/index.d.ts +0 -4
- package/dist/source/index.js.map +0 -1
- package/dist/source/index.mjs +0 -150
- package/dist/source/index.mjs.map +0 -1
- package/dist/source/index_web.mjs +0 -149
- package/dist/source/index_web.mjs.map +0 -1
- package/dist/source_nodejs/index.mjs +0 -35
- package/dist/source_nodejs/index.mjs.map +0 -1
- /package/dist/{common-DxHkx4Pv.d.mts → common-DxHkx4Pv.d.cts} +0 -0
|
@@ -1,114 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
|
|
8
2
|
var __export = (target, all) => {
|
|
9
3
|
for (var name in all)
|
|
10
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
5
|
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// source/index.ts
|
|
31
|
-
var source_exports = {};
|
|
32
|
-
__export(source_exports, {
|
|
33
|
-
CertificatePurpose: () => CertificatePurpose,
|
|
34
|
-
PaddingAlgorithm: () => PaddingAlgorithm,
|
|
35
|
-
RSA_PKCS1_OAEP_PADDING: () => RSA_PKCS1_OAEP_PADDING,
|
|
36
|
-
RSA_PKCS1_PADDING: () => RSA_PKCS1_PADDING,
|
|
37
|
-
Subject: () => Subject,
|
|
38
|
-
_coercePrivateKey: () => _coercePrivateKey,
|
|
39
|
-
asn1: () => asn1,
|
|
40
|
-
certificateMatchesPrivateKey: () => certificateMatchesPrivateKey,
|
|
41
|
-
coerceCertificate: () => coerceCertificate,
|
|
42
|
-
coerceCertificatePem: () => coerceCertificatePem,
|
|
43
|
-
coercePEMorDerToPrivateKey: () => coercePEMorDerToPrivateKey,
|
|
44
|
-
coercePrivateKeyPem: () => coercePrivateKeyPem,
|
|
45
|
-
coercePublicKeyPem: () => coercePublicKeyPem,
|
|
46
|
-
coerceRsaPublicKeyPem: () => coerceRsaPublicKeyPem,
|
|
47
|
-
combine_der: () => combine_der,
|
|
48
|
-
computeDerivedKeys: () => computeDerivedKeys,
|
|
49
|
-
computePaddingFooter: () => computePaddingFooter,
|
|
50
|
-
convertPEMtoDER: () => convertPEMtoDER,
|
|
51
|
-
createCertificateSigningRequest: () => createCertificateSigningRequest,
|
|
52
|
-
createPrivateKeyFromNodeJSCrypto: () => createPrivateKeyFromNodeJSCrypto,
|
|
53
|
-
createSelfSignedCertificate: () => createSelfSignedCertificate,
|
|
54
|
-
decryptBufferWithDerivedKeys: () => decryptBufferWithDerivedKeys,
|
|
55
|
-
derToPrivateKey: () => derToPrivateKey,
|
|
56
|
-
encryptBufferWithDerivedKeys: () => encryptBufferWithDerivedKeys,
|
|
57
|
-
exploreAsn1: () => exploreAsn1,
|
|
58
|
-
exploreCertificate: () => exploreCertificate,
|
|
59
|
-
exploreCertificateInfo: () => exploreCertificateInfo,
|
|
60
|
-
exploreCertificateRevocationList: () => exploreCertificateRevocationList,
|
|
61
|
-
exploreCertificateSigningRequest: () => exploreCertificateSigningRequest,
|
|
62
|
-
explorePrivateKey: () => explorePrivateKey,
|
|
63
|
-
extractPublicKeyFromCertificate: () => extractPublicKeyFromCertificate,
|
|
64
|
-
extractPublicKeyFromCertificateSync: () => extractPublicKeyFromCertificateSync,
|
|
65
|
-
generateKeyPair: () => generateKeyPair,
|
|
66
|
-
generatePrivateKey: () => generatePrivateKey,
|
|
67
|
-
hexDump: () => hexDump,
|
|
68
|
-
identifyPemType: () => identifyPemType,
|
|
69
|
-
isKeyObject: () => isKeyObject,
|
|
70
|
-
makeMessageChunkSignature: () => makeMessageChunkSignature,
|
|
71
|
-
makeMessageChunkSignatureWithDerivedKeys: () => makeMessageChunkSignatureWithDerivedKeys,
|
|
72
|
-
makePrivateKeyFromPem: () => makePrivateKeyFromPem,
|
|
73
|
-
makePrivateKeyThumbPrint: () => makePrivateKeyThumbPrint,
|
|
74
|
-
makePseudoRandomBuffer: () => makePseudoRandomBuffer,
|
|
75
|
-
makeSHA1Thumbprint: () => makeSHA1Thumbprint,
|
|
76
|
-
pemToPrivateKey: () => pemToPrivateKey,
|
|
77
|
-
privateDecrypt: () => privateDecrypt,
|
|
78
|
-
privateDecrypt_long: () => privateDecrypt_long,
|
|
79
|
-
privateDecrypt_native: () => privateDecrypt_native,
|
|
80
|
-
privateKeyToPEM: () => privateKeyToPEM,
|
|
81
|
-
publicEncrypt: () => publicEncrypt,
|
|
82
|
-
publicEncrypt_long: () => publicEncrypt_long,
|
|
83
|
-
publicEncrypt_native: () => publicEncrypt_native,
|
|
84
|
-
publicKeyAndPrivateKeyMatches: () => publicKeyAndPrivateKeyMatches,
|
|
85
|
-
readCertificationRequestInfo: () => readCertificationRequestInfo,
|
|
86
|
-
readExtension: () => readExtension,
|
|
87
|
-
readNameForCrl: () => readNameForCrl,
|
|
88
|
-
readTbsCertificate: () => readTbsCertificate,
|
|
89
|
-
reduceLength: () => reduceLength,
|
|
90
|
-
removePadding: () => removePadding,
|
|
91
|
-
removeTrailingLF: () => removeTrailingLF,
|
|
92
|
-
rsaLengthPrivateKey: () => rsaLengthPrivateKey,
|
|
93
|
-
rsaLengthPublicKey: () => rsaLengthPublicKey,
|
|
94
|
-
rsaLengthRsaPublicKey: () => rsaLengthRsaPublicKey,
|
|
95
|
-
split_der: () => split_der,
|
|
96
|
-
toPem: () => toPem,
|
|
97
|
-
toPem2: () => toPem2,
|
|
98
|
-
verifyCertificateChain: () => verifyCertificateChain,
|
|
99
|
-
verifyCertificateOrClrSignature: () => verifyCertificateOrClrSignature,
|
|
100
|
-
verifyCertificateRevocationListSignature: () => verifyCertificateRevocationListSignature,
|
|
101
|
-
verifyCertificateSignature: () => verifyCertificateSignature,
|
|
102
|
-
verifyChunkSignature: () => verifyChunkSignature,
|
|
103
|
-
verifyChunkSignatureWithDerivedKeys: () => verifyChunkSignatureWithDerivedKeys,
|
|
104
|
-
verifyMessageChunkSignature: () => verifyMessageChunkSignature
|
|
105
|
-
});
|
|
106
|
-
module.exports = __toCommonJS(source_exports);
|
|
107
6
|
|
|
108
7
|
// source/common.ts
|
|
109
|
-
var
|
|
110
|
-
var KeyObjectOrig =
|
|
111
|
-
var { createPrivateKey: createPrivateKeyFromNodeJSCrypto } =
|
|
8
|
+
var _crypto2 = require('crypto'); var _crypto3 = _interopRequireDefault(_crypto2);
|
|
9
|
+
var KeyObjectOrig = _crypto3.default.KeyObject;
|
|
10
|
+
var { createPrivateKey: createPrivateKeyFromNodeJSCrypto } = _crypto3.default;
|
|
112
11
|
function isKeyObject(mayBeKeyObject) {
|
|
113
12
|
if (KeyObjectOrig) {
|
|
114
13
|
return mayBeKeyObject instanceof KeyObjectOrig;
|
|
@@ -124,10 +23,10 @@ var CertificatePurpose = /* @__PURE__ */ ((CertificatePurpose2) => {
|
|
|
124
23
|
})(CertificatePurpose || {});
|
|
125
24
|
|
|
126
25
|
// source/crypto_explore_certificate.ts
|
|
127
|
-
var
|
|
26
|
+
var _assert = require('assert'); var _assert2 = _interopRequireDefault(_assert);
|
|
128
27
|
|
|
129
28
|
// source/asn1.ts
|
|
130
|
-
|
|
29
|
+
|
|
131
30
|
|
|
132
31
|
// source/oid_map.ts
|
|
133
32
|
var oid_map = {
|
|
@@ -501,12 +400,12 @@ function parseBitString(buffer, start, end, maxLength) {
|
|
|
501
400
|
s += b >> j & 1 ? "1" : "0";
|
|
502
401
|
}
|
|
503
402
|
skip = 0;
|
|
504
|
-
(0,
|
|
403
|
+
_assert2.default.call(void 0, s.length <= maxLength);
|
|
505
404
|
}
|
|
506
405
|
return intro + s;
|
|
507
406
|
}
|
|
508
407
|
function readBitString(buffer, block) {
|
|
509
|
-
(0,
|
|
408
|
+
_assert2.default.call(void 0, block.tag === 3 /* BIT_STRING */);
|
|
510
409
|
const data = getBlock(buffer, block);
|
|
511
410
|
const ignore_bits = data.readUInt8(0);
|
|
512
411
|
return {
|
|
@@ -524,9 +423,9 @@ function formatBuffer2DigitHexWithColum(buffer) {
|
|
|
524
423
|
return value.join(":").toUpperCase().replace(/^(00:)*/, "");
|
|
525
424
|
}
|
|
526
425
|
function readOctetString(buffer, block) {
|
|
527
|
-
(0,
|
|
426
|
+
_assert2.default.call(void 0, block.tag === 4 /* OCTET_STRING */);
|
|
528
427
|
const tag = readTag(buffer, block.position);
|
|
529
|
-
(0,
|
|
428
|
+
_assert2.default.call(void 0, tag.tag === 4 /* OCTET_STRING */);
|
|
530
429
|
const nbBytes = tag.length;
|
|
531
430
|
const pos = tag.position;
|
|
532
431
|
const b = buffer.subarray(pos, pos + nbBytes);
|
|
@@ -564,11 +463,11 @@ function parseOID(buffer, start, end) {
|
|
|
564
463
|
bits = 0;
|
|
565
464
|
}
|
|
566
465
|
}
|
|
567
|
-
(0,
|
|
466
|
+
_assert2.default.call(void 0, bits === 0);
|
|
568
467
|
return s;
|
|
569
468
|
}
|
|
570
469
|
function readObjectIdentifier(buffer, block) {
|
|
571
|
-
(0,
|
|
470
|
+
_assert2.default.call(void 0, block.tag === 6 /* OBJECT_IDENTIFIER */);
|
|
572
471
|
const b = buffer.subarray(block.position, block.position + block.length);
|
|
573
472
|
const oid = parseOID(b, 0, block.length);
|
|
574
473
|
return {
|
|
@@ -596,17 +495,17 @@ function readSignatureValue(buffer, block) {
|
|
|
596
495
|
return readSignatureValueBin(buffer, block).toString("hex");
|
|
597
496
|
}
|
|
598
497
|
function readLongIntegerValue(buffer, block) {
|
|
599
|
-
(0,
|
|
498
|
+
_assert2.default.call(void 0, block.tag === 2 /* INTEGER */, "expecting a INTEGER tag");
|
|
600
499
|
const pos = block.position;
|
|
601
500
|
const nbBytes = block.length;
|
|
602
501
|
const buf = buffer.subarray(pos, pos + nbBytes);
|
|
603
502
|
return buf;
|
|
604
503
|
}
|
|
605
504
|
function readIntegerValue(buffer, block) {
|
|
606
|
-
(0,
|
|
505
|
+
_assert2.default.call(void 0, block.tag === 2 /* INTEGER */, "expecting a INTEGER tag");
|
|
607
506
|
let pos = block.position;
|
|
608
507
|
const nbBytes = block.length;
|
|
609
|
-
(0,
|
|
508
|
+
_assert2.default.call(void 0, nbBytes < 4);
|
|
610
509
|
let value = 0;
|
|
611
510
|
for (let i = 0; i < nbBytes; i++) {
|
|
612
511
|
value = value * 256 + buffer.readUInt8(pos);
|
|
@@ -615,10 +514,10 @@ function readIntegerValue(buffer, block) {
|
|
|
615
514
|
return value;
|
|
616
515
|
}
|
|
617
516
|
function readBooleanValue(buffer, block) {
|
|
618
|
-
(0,
|
|
517
|
+
_assert2.default.call(void 0, block.tag === 1 /* BOOLEAN */, `expecting a BOOLEAN tag. got ${TagType[block.tag]}`);
|
|
619
518
|
const pos = block.position;
|
|
620
519
|
const nbBytes = block.length;
|
|
621
|
-
(0,
|
|
520
|
+
_assert2.default.call(void 0, nbBytes < 4);
|
|
622
521
|
const value = !!buffer.readUInt8(pos);
|
|
623
522
|
return value;
|
|
624
523
|
}
|
|
@@ -686,10 +585,16 @@ function readTime(buffer, block) {
|
|
|
686
585
|
}
|
|
687
586
|
|
|
688
587
|
// source/crypto_utils.ts
|
|
689
|
-
|
|
690
|
-
var
|
|
691
|
-
|
|
692
|
-
|
|
588
|
+
|
|
589
|
+
var _constants = require('constants'); var _constants2 = _interopRequireDefault(_constants);
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
693
598
|
|
|
694
599
|
// source/buffer_utils.ts
|
|
695
600
|
var createFastUninitializedBuffer = Buffer.allocUnsafe ? Buffer.allocUnsafe : (size) => {
|
|
@@ -706,9 +611,9 @@ function hexy(buffer, { width, format } = {}) {
|
|
|
706
611
|
const regexTwos = new RegExp(`.{1,${2}}`, "g");
|
|
707
612
|
let fullHex = buffer.toString("hex");
|
|
708
613
|
if (format === "twos") {
|
|
709
|
-
fullHex = fullHex.match(regexTwos)
|
|
614
|
+
fullHex = _optionalChain([fullHex, 'access', _ => _.match, 'call', _2 => _2(regexTwos), 'optionalAccess', _3 => _3.join, 'call', _4 => _4(" ")]) || "";
|
|
710
615
|
}
|
|
711
|
-
return fullHex.match(regex)
|
|
616
|
+
return _optionalChain([fullHex, 'access', _5 => _5.match, 'call', _6 => _6(regex), 'optionalAccess', _7 => _7.join, 'call', _8 => _8("\n")]) || "";
|
|
712
617
|
}
|
|
713
618
|
|
|
714
619
|
// source/crypto_utils.ts
|
|
@@ -726,14 +631,14 @@ function removeTrailingLF(str) {
|
|
|
726
631
|
return tmp;
|
|
727
632
|
}
|
|
728
633
|
function toPem(raw_key, pem) {
|
|
729
|
-
(0,
|
|
730
|
-
(0,
|
|
634
|
+
_assert2.default.call(void 0, raw_key, "expecting a key");
|
|
635
|
+
_assert2.default.call(void 0, typeof pem === "string");
|
|
731
636
|
let pemType = identifyPemType(raw_key);
|
|
732
637
|
if (pemType) {
|
|
733
638
|
return Buffer.isBuffer(raw_key) ? removeTrailingLF(raw_key.toString("utf8")) : removeTrailingLF(raw_key);
|
|
734
639
|
} else {
|
|
735
640
|
pemType = pem;
|
|
736
|
-
(0,
|
|
641
|
+
_assert2.default.call(void 0, ["CERTIFICATE REQUEST", "CERTIFICATE", "RSA PRIVATE KEY", "PUBLIC KEY", "X509 CRL"].indexOf(pemType) >= 0);
|
|
737
642
|
let b = raw_key.toString("base64");
|
|
738
643
|
let str = `-----BEGIN ${pemType}-----
|
|
739
644
|
`;
|
|
@@ -775,34 +680,34 @@ function hexDump(buffer, width) {
|
|
|
775
680
|
}
|
|
776
681
|
}
|
|
777
682
|
function makeMessageChunkSignature(chunk, options) {
|
|
778
|
-
const signer = (0,
|
|
683
|
+
const signer = _crypto2.createSign.call(void 0, options.algorithm);
|
|
779
684
|
signer.update(chunk);
|
|
780
685
|
const signature = signer.sign(options.privateKey.hidden);
|
|
781
|
-
(0,
|
|
686
|
+
_assert2.default.call(void 0, !options.signatureLength || signature.length === options.signatureLength);
|
|
782
687
|
return signature;
|
|
783
688
|
}
|
|
784
689
|
function verifyMessageChunkSignature(blockToVerify, signature, options) {
|
|
785
|
-
const verify = (0,
|
|
690
|
+
const verify = _crypto2.createVerify.call(void 0, options.algorithm);
|
|
786
691
|
verify.update(blockToVerify);
|
|
787
692
|
return verify.verify(options.publicKey, signature);
|
|
788
693
|
}
|
|
789
694
|
function makeSHA1Thumbprint(buffer) {
|
|
790
|
-
return (0,
|
|
695
|
+
return _crypto2.createHash.call(void 0, "sha1").update(buffer).digest();
|
|
791
696
|
}
|
|
792
|
-
var RSA_PKCS1_OAEP_PADDING =
|
|
793
|
-
var RSA_PKCS1_PADDING =
|
|
697
|
+
var RSA_PKCS1_OAEP_PADDING = _constants2.default.RSA_PKCS1_OAEP_PADDING;
|
|
698
|
+
var RSA_PKCS1_PADDING = _constants2.default.RSA_PKCS1_PADDING;
|
|
794
699
|
var PaddingAlgorithm = /* @__PURE__ */ ((PaddingAlgorithm2) => {
|
|
795
700
|
PaddingAlgorithm2[PaddingAlgorithm2["RSA_PKCS1_OAEP_PADDING"] = 4] = "RSA_PKCS1_OAEP_PADDING";
|
|
796
701
|
PaddingAlgorithm2[PaddingAlgorithm2["RSA_PKCS1_PADDING"] = 1] = "RSA_PKCS1_PADDING";
|
|
797
702
|
return PaddingAlgorithm2;
|
|
798
703
|
})(PaddingAlgorithm || {});
|
|
799
|
-
(0,
|
|
800
|
-
(0,
|
|
704
|
+
_assert2.default.call(void 0, 4 /* RSA_PKCS1_OAEP_PADDING */ === _constants2.default.RSA_PKCS1_OAEP_PADDING);
|
|
705
|
+
_assert2.default.call(void 0, 1 /* RSA_PKCS1_PADDING */ === _constants2.default.RSA_PKCS1_PADDING);
|
|
801
706
|
function publicEncrypt_native(buffer, publicKey, algorithm) {
|
|
802
707
|
if (algorithm === void 0) {
|
|
803
708
|
algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
|
|
804
709
|
}
|
|
805
|
-
return (0,
|
|
710
|
+
return _crypto2.publicEncrypt.call(void 0,
|
|
806
711
|
{
|
|
807
712
|
key: publicKey,
|
|
808
713
|
padding: algorithm
|
|
@@ -815,7 +720,7 @@ function privateDecrypt_native(buffer, privateKey, algorithm) {
|
|
|
815
720
|
algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
|
|
816
721
|
}
|
|
817
722
|
try {
|
|
818
|
-
return (0,
|
|
723
|
+
return _crypto2.privateDecrypt.call(void 0,
|
|
819
724
|
{
|
|
820
725
|
key: privateKey.hidden,
|
|
821
726
|
padding: algorithm
|
|
@@ -874,14 +779,14 @@ function coerceCertificatePem(certificate) {
|
|
|
874
779
|
if (Buffer.isBuffer(certificate)) {
|
|
875
780
|
certificate = toPem(certificate, "CERTIFICATE");
|
|
876
781
|
}
|
|
877
|
-
(0,
|
|
782
|
+
_assert2.default.call(void 0, typeof certificate === "string");
|
|
878
783
|
return certificate;
|
|
879
784
|
}
|
|
880
785
|
function extractPublicKeyFromCertificateSync(certificate) {
|
|
881
786
|
certificate = coerceCertificatePem(certificate);
|
|
882
|
-
const
|
|
883
|
-
const publicKeyAsPem =
|
|
884
|
-
(0,
|
|
787
|
+
const publicKeyObject = _crypto2.createPublicKey.call(void 0, certificate);
|
|
788
|
+
const publicKeyAsPem = publicKeyObject.export({ format: "pem", type: "spki" }).toString();
|
|
789
|
+
_assert2.default.call(void 0, typeof publicKeyAsPem === "string");
|
|
885
790
|
return publicKeyAsPem;
|
|
886
791
|
}
|
|
887
792
|
function extractPublicKeyFromCertificate(certificate, callback) {
|
|
@@ -898,17 +803,17 @@ function extractPublicKeyFromCertificate(certificate, callback) {
|
|
|
898
803
|
}
|
|
899
804
|
|
|
900
805
|
// source/directory_name.ts
|
|
901
|
-
|
|
806
|
+
|
|
902
807
|
function readDirectoryName(buffer, block) {
|
|
903
808
|
const set_blocks = readStruct(buffer, block);
|
|
904
809
|
const names = {};
|
|
905
810
|
for (const set_block of set_blocks) {
|
|
906
|
-
(0,
|
|
811
|
+
_assert2.default.call(void 0, set_block.tag === 49);
|
|
907
812
|
const blocks = readStruct(buffer, set_block);
|
|
908
|
-
(0,
|
|
909
|
-
(0,
|
|
813
|
+
_assert2.default.call(void 0, blocks.length === 1);
|
|
814
|
+
_assert2.default.call(void 0, blocks[0].tag === 48);
|
|
910
815
|
const sequenceBlock = readStruct(buffer, blocks[0]);
|
|
911
|
-
(0,
|
|
816
|
+
_assert2.default.call(void 0, sequenceBlock.length === 2);
|
|
912
817
|
const type = readObjectIdentifier(buffer, sequenceBlock[0]);
|
|
913
818
|
names[type.name] = readValue(buffer, sequenceBlock[1]);
|
|
914
819
|
}
|
|
@@ -1033,7 +938,7 @@ function _readGeneralNames(buffer, block) {
|
|
|
1033
938
|
}
|
|
1034
939
|
const n = {};
|
|
1035
940
|
for (const block2 of blocks) {
|
|
1036
|
-
(0,
|
|
941
|
+
_assert2.default.call(void 0, (block2.tag & 128) === 128);
|
|
1037
942
|
const t2 = block2.tag & 127;
|
|
1038
943
|
const type = _data[t2];
|
|
1039
944
|
if (!type) {
|
|
@@ -1093,7 +998,7 @@ function readKeyUsage(_oid, buffer) {
|
|
|
1093
998
|
};
|
|
1094
999
|
}
|
|
1095
1000
|
function readExtKeyUsage(oid, buffer) {
|
|
1096
|
-
(0,
|
|
1001
|
+
_assert2.default.call(void 0, oid === "2.5.29.37");
|
|
1097
1002
|
const block_info = readTag(buffer, 0);
|
|
1098
1003
|
const inner_blocks = readStruct(buffer, block_info);
|
|
1099
1004
|
const extKeyUsage = {
|
|
@@ -1123,7 +1028,7 @@ function _readSubjectPublicKey(buffer) {
|
|
|
1123
1028
|
function readExtension(buffer, block) {
|
|
1124
1029
|
const inner_blocks = readStruct(buffer, block);
|
|
1125
1030
|
if (inner_blocks.length === 3) {
|
|
1126
|
-
(0,
|
|
1031
|
+
_assert2.default.call(void 0, inner_blocks[1].tag === 1 /* BOOLEAN */);
|
|
1127
1032
|
inner_blocks[1] = inner_blocks[2];
|
|
1128
1033
|
}
|
|
1129
1034
|
const identifier = readObjectIdentifier(buffer, inner_blocks[0]);
|
|
@@ -1160,7 +1065,7 @@ function readExtension(buffer, block) {
|
|
|
1160
1065
|
};
|
|
1161
1066
|
}
|
|
1162
1067
|
function _readExtensions(buffer, block) {
|
|
1163
|
-
(0,
|
|
1068
|
+
_assert2.default.call(void 0, block.tag === 163);
|
|
1164
1069
|
let inner_blocks = readStruct(buffer, block);
|
|
1165
1070
|
inner_blocks = readStruct(buffer, inner_blocks[0]);
|
|
1166
1071
|
const extensions = inner_blocks.map((block2) => readExtension(buffer, block2));
|
|
@@ -1238,7 +1143,7 @@ function readTbsCertificate(buffer, block) {
|
|
|
1238
1143
|
break;
|
|
1239
1144
|
}
|
|
1240
1145
|
default: {
|
|
1241
|
-
(0,
|
|
1146
|
+
_assert2.default.call(void 0, what_type === "ecPublicKey");
|
|
1242
1147
|
subjectPublicKeyInfo = _readSubjectECCPublicKeyInfo(buffer, blocks[6]);
|
|
1243
1148
|
break;
|
|
1244
1149
|
}
|
|
@@ -1264,7 +1169,7 @@ function readTbsCertificate(buffer, block) {
|
|
|
1264
1169
|
};
|
|
1265
1170
|
}
|
|
1266
1171
|
function exploreCertificate(certificate) {
|
|
1267
|
-
(0,
|
|
1172
|
+
_assert2.default.call(void 0, Buffer.isBuffer(certificate));
|
|
1268
1173
|
const certificate_priv = certificate;
|
|
1269
1174
|
if (!certificate_priv._exploreCertificate_cache) {
|
|
1270
1175
|
const block_info = readTag(certificate, 0);
|
|
@@ -1294,239 +1199,14 @@ function combine_der(certificates) {
|
|
|
1294
1199
|
let sum = 0;
|
|
1295
1200
|
b.forEach((block) => {
|
|
1296
1201
|
const block_info = readTag(block, 0);
|
|
1297
|
-
(0,
|
|
1202
|
+
_assert2.default.call(void 0, block_info.position + block_info.length === block.length);
|
|
1298
1203
|
sum += block.length;
|
|
1299
1204
|
});
|
|
1300
|
-
(0,
|
|
1205
|
+
_assert2.default.call(void 0, sum === cert.length);
|
|
1301
1206
|
}
|
|
1302
1207
|
return Buffer.concat(certificates);
|
|
1303
1208
|
}
|
|
1304
1209
|
|
|
1305
|
-
// source/crypto_utils2.ts
|
|
1306
|
-
var import_node_assert5 = __toESM(require("assert"));
|
|
1307
|
-
var import_jsrsasign2 = __toESM(require("jsrsasign"));
|
|
1308
|
-
function rsaLengthPrivateKey(key) {
|
|
1309
|
-
const keyPem = typeof key.hidden === "string" ? key.hidden : key.hidden.export({ type: "pkcs1", format: "pem" }).toString();
|
|
1310
|
-
const a = import_jsrsasign2.default.KEYUTIL.getKey(keyPem);
|
|
1311
|
-
return a.n.toString(16).length / 2;
|
|
1312
|
-
}
|
|
1313
|
-
function toPem2(raw_key, pem) {
|
|
1314
|
-
if (raw_key.hidden) {
|
|
1315
|
-
return toPem2(raw_key.hidden, pem);
|
|
1316
|
-
}
|
|
1317
|
-
(0, import_node_assert5.default)(raw_key, "expecting a key");
|
|
1318
|
-
(0, import_node_assert5.default)(typeof pem === "string");
|
|
1319
|
-
if (isKeyObject(raw_key)) {
|
|
1320
|
-
const _raw_key = raw_key;
|
|
1321
|
-
if (pem === "RSA PRIVATE KEY") {
|
|
1322
|
-
return removeTrailingLF(_raw_key.export({ format: "pem", type: "pkcs1" }).toString());
|
|
1323
|
-
} else if (pem === "PRIVATE KEY") {
|
|
1324
|
-
return removeTrailingLF(_raw_key.export({ format: "pem", type: "pkcs8" }).toString());
|
|
1325
|
-
} else {
|
|
1326
|
-
throw new Error("Unsupported case!");
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
return toPem(raw_key, pem);
|
|
1330
|
-
}
|
|
1331
|
-
function coercePrivateKeyPem(privateKey) {
|
|
1332
|
-
return toPem2(privateKey, "PRIVATE KEY");
|
|
1333
|
-
}
|
|
1334
|
-
function coercePublicKeyPem(publicKey) {
|
|
1335
|
-
if (isKeyObject(publicKey)) {
|
|
1336
|
-
return publicKey.export({ format: "pem", type: "spki" }).toString();
|
|
1337
|
-
}
|
|
1338
|
-
(0, import_node_assert5.default)(typeof publicKey === "string");
|
|
1339
|
-
return publicKey;
|
|
1340
|
-
}
|
|
1341
|
-
function coerceRsaPublicKeyPem(publicKey) {
|
|
1342
|
-
if (isKeyObject(publicKey)) {
|
|
1343
|
-
return publicKey.export({ format: "pem", type: "spki" }).toString();
|
|
1344
|
-
}
|
|
1345
|
-
(0, import_node_assert5.default)(typeof publicKey === "string");
|
|
1346
|
-
return publicKey;
|
|
1347
|
-
}
|
|
1348
|
-
function rsaLengthPublicKey(key) {
|
|
1349
|
-
key = coercePublicKeyPem(key);
|
|
1350
|
-
(0, import_node_assert5.default)(typeof key === "string");
|
|
1351
|
-
const a = import_jsrsasign2.default.KEYUTIL.getKey(key);
|
|
1352
|
-
return a.n.toString(16).length / 2;
|
|
1353
|
-
}
|
|
1354
|
-
function rsaLengthRsaPublicKey(key) {
|
|
1355
|
-
key = coerceRsaPublicKeyPem(key);
|
|
1356
|
-
(0, import_node_assert5.default)(typeof key === "string");
|
|
1357
|
-
const a = import_jsrsasign2.default.KEYUTIL.getKey(key);
|
|
1358
|
-
return a.n.toString(16).length / 2;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
// source/derived_keys.ts
|
|
1362
|
-
var import_node_assert7 = __toESM(require("assert"));
|
|
1363
|
-
var import_node_crypto3 = require("crypto");
|
|
1364
|
-
|
|
1365
|
-
// source/explore_certificate.ts
|
|
1366
|
-
var import_node_assert6 = __toESM(require("assert"));
|
|
1367
|
-
function coerceCertificate(certificate) {
|
|
1368
|
-
if (typeof certificate === "string") {
|
|
1369
|
-
certificate = convertPEMtoDER(certificate);
|
|
1370
|
-
}
|
|
1371
|
-
(0, import_node_assert6.default)(Buffer.isBuffer(certificate));
|
|
1372
|
-
return certificate;
|
|
1373
|
-
}
|
|
1374
|
-
function exploreCertificateInfo(certificate) {
|
|
1375
|
-
certificate = coerceCertificate(certificate);
|
|
1376
|
-
const certInfo = exploreCertificate(certificate);
|
|
1377
|
-
const data = {
|
|
1378
|
-
publicKeyLength: certInfo.tbsCertificate.subjectPublicKeyInfo.keyLength,
|
|
1379
|
-
notBefore: certInfo.tbsCertificate.validity.notBefore,
|
|
1380
|
-
notAfter: certInfo.tbsCertificate.validity.notAfter,
|
|
1381
|
-
publicKey: certInfo.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey,
|
|
1382
|
-
subject: certInfo.tbsCertificate.subject
|
|
1383
|
-
};
|
|
1384
|
-
if (!(data.publicKeyLength === 512 || data.publicKeyLength === 384 || data.publicKeyLength === 256 || data.publicKeyLength === 128)) {
|
|
1385
|
-
throw new Error(`Invalid public key length (expecting 128,256,384 or 512): ${data.publicKeyLength}`);
|
|
1386
|
-
}
|
|
1387
|
-
return data;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
// source/derived_keys.ts
|
|
1391
|
-
function HMAC_HASH(sha1or256, secret, message) {
|
|
1392
|
-
return (0, import_node_crypto3.createHmac)(sha1or256, secret).update(message).digest();
|
|
1393
|
-
}
|
|
1394
|
-
function plus(buf1, buf2) {
|
|
1395
|
-
return Buffer.concat([buf1, buf2]);
|
|
1396
|
-
}
|
|
1397
|
-
function makePseudoRandomBuffer(secret, seed, minLength, sha1or256) {
|
|
1398
|
-
(0, import_node_assert7.default)(Buffer.isBuffer(seed));
|
|
1399
|
-
(0, import_node_assert7.default)(sha1or256 === "SHA1" || sha1or256 === "SHA256");
|
|
1400
|
-
const a = [];
|
|
1401
|
-
a[0] = seed;
|
|
1402
|
-
let index = 1;
|
|
1403
|
-
let p_hash = createFastUninitializedBuffer(0);
|
|
1404
|
-
while (p_hash.length <= minLength) {
|
|
1405
|
-
a[index] = HMAC_HASH(sha1or256, secret, a[index - 1]);
|
|
1406
|
-
p_hash = plus(p_hash, HMAC_HASH(sha1or256, secret, plus(a[index], seed)));
|
|
1407
|
-
index += 1;
|
|
1408
|
-
}
|
|
1409
|
-
return p_hash.subarray(0, minLength);
|
|
1410
|
-
}
|
|
1411
|
-
function computeDerivedKeys(secret, seed, options) {
|
|
1412
|
-
(0, import_node_assert7.default)(Number.isFinite(options.signatureLength));
|
|
1413
|
-
(0, import_node_assert7.default)(Number.isFinite(options.encryptingKeyLength));
|
|
1414
|
-
(0, import_node_assert7.default)(Number.isFinite(options.encryptingBlockSize));
|
|
1415
|
-
(0, import_node_assert7.default)(typeof options.algorithm === "string");
|
|
1416
|
-
options.sha1or256 = options.sha1or256 || "SHA1";
|
|
1417
|
-
(0, import_node_assert7.default)(typeof options.sha1or256 === "string");
|
|
1418
|
-
const offset1 = options.signingKeyLength;
|
|
1419
|
-
const offset2 = offset1 + options.encryptingKeyLength;
|
|
1420
|
-
const minLength = offset2 + options.encryptingBlockSize;
|
|
1421
|
-
const buf = makePseudoRandomBuffer(secret, seed, minLength, options.sha1or256);
|
|
1422
|
-
return {
|
|
1423
|
-
signatureLength: options.signatureLength,
|
|
1424
|
-
signingKeyLength: options.signingKeyLength,
|
|
1425
|
-
encryptingKeyLength: options.encryptingKeyLength,
|
|
1426
|
-
encryptingBlockSize: options.encryptingBlockSize,
|
|
1427
|
-
algorithm: options.algorithm,
|
|
1428
|
-
sha1or256: options.sha1or256,
|
|
1429
|
-
signingKey: buf.subarray(0, offset1),
|
|
1430
|
-
encryptingKey: buf.subarray(offset1, offset2),
|
|
1431
|
-
initializationVector: buf.subarray(offset2, minLength)
|
|
1432
|
-
};
|
|
1433
|
-
}
|
|
1434
|
-
function reduceLength(buffer, byteToRemove) {
|
|
1435
|
-
return buffer.subarray(0, buffer.length - byteToRemove);
|
|
1436
|
-
}
|
|
1437
|
-
function removePadding(buffer) {
|
|
1438
|
-
const nbPaddingBytes = buffer.readUInt8(buffer.length - 1) + 1;
|
|
1439
|
-
return reduceLength(buffer, nbPaddingBytes);
|
|
1440
|
-
}
|
|
1441
|
-
function verifyChunkSignature(chunk, options) {
|
|
1442
|
-
(0, import_node_assert7.default)(Buffer.isBuffer(chunk));
|
|
1443
|
-
let signatureLength = options.signatureLength || 0;
|
|
1444
|
-
if (signatureLength === 0) {
|
|
1445
|
-
const cert = exploreCertificateInfo(options.publicKey);
|
|
1446
|
-
signatureLength = cert.publicKeyLength || 0;
|
|
1447
|
-
}
|
|
1448
|
-
const block_to_verify = chunk.subarray(0, chunk.length - signatureLength);
|
|
1449
|
-
const signature = chunk.subarray(chunk.length - signatureLength);
|
|
1450
|
-
return verifyMessageChunkSignature(block_to_verify, signature, options);
|
|
1451
|
-
}
|
|
1452
|
-
function computePaddingFooter(buffer, derivedKeys) {
|
|
1453
|
-
(0, import_node_assert7.default)(Object.hasOwn(derivedKeys, "encryptingBlockSize"));
|
|
1454
|
-
const paddingSize = derivedKeys.encryptingBlockSize - (buffer.length + 1) % derivedKeys.encryptingBlockSize;
|
|
1455
|
-
const padding = createFastUninitializedBuffer(paddingSize + 1);
|
|
1456
|
-
padding.fill(paddingSize);
|
|
1457
|
-
return padding;
|
|
1458
|
-
}
|
|
1459
|
-
function derivedKeys_algorithm(derivedKeys) {
|
|
1460
|
-
(0, import_node_assert7.default)(Object.hasOwn(derivedKeys, "algorithm"));
|
|
1461
|
-
const algorithm = derivedKeys.algorithm || "aes-128-cbc";
|
|
1462
|
-
(0, import_node_assert7.default)(algorithm === "aes-128-cbc" || algorithm === "aes-256-cbc");
|
|
1463
|
-
return algorithm;
|
|
1464
|
-
}
|
|
1465
|
-
function encryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
1466
|
-
const algorithm = derivedKeys_algorithm(derivedKeys);
|
|
1467
|
-
const key = derivedKeys.encryptingKey;
|
|
1468
|
-
const initVector = derivedKeys.initializationVector;
|
|
1469
|
-
const cipher = (0, import_node_crypto3.createCipheriv)(algorithm, key, initVector);
|
|
1470
|
-
cipher.setAutoPadding(false);
|
|
1471
|
-
const encrypted_chunks = [];
|
|
1472
|
-
encrypted_chunks.push(cipher.update(buffer));
|
|
1473
|
-
encrypted_chunks.push(cipher.final());
|
|
1474
|
-
return Buffer.concat(encrypted_chunks);
|
|
1475
|
-
}
|
|
1476
|
-
function decryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
1477
|
-
const algorithm = derivedKeys_algorithm(derivedKeys);
|
|
1478
|
-
const key = derivedKeys.encryptingKey;
|
|
1479
|
-
const initVector = derivedKeys.initializationVector;
|
|
1480
|
-
const cipher = (0, import_node_crypto3.createDecipheriv)(algorithm, key, initVector);
|
|
1481
|
-
cipher.setAutoPadding(false);
|
|
1482
|
-
const decrypted_chunks = [];
|
|
1483
|
-
decrypted_chunks.push(cipher.update(buffer));
|
|
1484
|
-
decrypted_chunks.push(cipher.final());
|
|
1485
|
-
return Buffer.concat(decrypted_chunks);
|
|
1486
|
-
}
|
|
1487
|
-
function makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys) {
|
|
1488
|
-
(0, import_node_assert7.default)(Buffer.isBuffer(message));
|
|
1489
|
-
(0, import_node_assert7.default)(Buffer.isBuffer(derivedKeys.signingKey));
|
|
1490
|
-
(0, import_node_assert7.default)(typeof derivedKeys.sha1or256 === "string");
|
|
1491
|
-
(0, import_node_assert7.default)(derivedKeys.sha1or256 === "SHA1" || derivedKeys.sha1or256 === "SHA256");
|
|
1492
|
-
const signature = (0, import_node_crypto3.createHmac)(derivedKeys.sha1or256, derivedKeys.signingKey).update(message).digest();
|
|
1493
|
-
(0, import_node_assert7.default)(signature.length === derivedKeys.signatureLength);
|
|
1494
|
-
return signature;
|
|
1495
|
-
}
|
|
1496
|
-
function verifyChunkSignatureWithDerivedKeys(chunk, derivedKeys) {
|
|
1497
|
-
const message = chunk.subarray(0, chunk.length - derivedKeys.signatureLength);
|
|
1498
|
-
const expectedSignature = chunk.subarray(chunk.length - derivedKeys.signatureLength);
|
|
1499
|
-
const computedSignature = makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys);
|
|
1500
|
-
return computedSignature.toString("hex") === expectedSignature.toString("hex");
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
// source/explore_asn1.ts
|
|
1504
|
-
function t(tag) {
|
|
1505
|
-
return TagType[tag];
|
|
1506
|
-
}
|
|
1507
|
-
function bi(blockInfo, depth) {
|
|
1508
|
-
const indent = " ".repeat(depth);
|
|
1509
|
-
const hl = blockInfo.position - blockInfo.start;
|
|
1510
|
-
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)}`;
|
|
1511
|
-
}
|
|
1512
|
-
function exploreAsn1(buffer) {
|
|
1513
|
-
console.log(hexDump(buffer));
|
|
1514
|
-
function dump(offset, depth) {
|
|
1515
|
-
const blockInfo = readTag(buffer, offset);
|
|
1516
|
-
dumpBlock(blockInfo, depth);
|
|
1517
|
-
function dumpBlock(blockInfo2, depth2) {
|
|
1518
|
-
console.log(bi(blockInfo2, depth2));
|
|
1519
|
-
if (blockInfo2.tag === 48 /* SEQUENCE */ || blockInfo2.tag === 49 /* SET */ || blockInfo2.tag >= 160 /* CONTEXT_SPECIFIC0 */) {
|
|
1520
|
-
const blocks = readStruct(buffer, blockInfo2);
|
|
1521
|
-
for (const block of blocks) {
|
|
1522
|
-
dumpBlock(block, depth2 + 1);
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
dump(0, 0);
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
1210
|
// source/explore_certificate_revocation_list.ts
|
|
1531
1211
|
function readNameForCrl(buffer, block) {
|
|
1532
1212
|
return readDirectoryName(buffer, block);
|
|
@@ -1587,6 +1267,137 @@ function exploreCertificateRevocationList(crl) {
|
|
|
1587
1267
|
return { tbsCertList, signatureAlgorithm, signatureValue };
|
|
1588
1268
|
}
|
|
1589
1269
|
|
|
1270
|
+
// source/verify_certificate_signature.ts
|
|
1271
|
+
|
|
1272
|
+
function verifyCertificateOrClrSignature(certificateOrCrl, parentCertificate) {
|
|
1273
|
+
const block_info = readTag(certificateOrCrl, 0);
|
|
1274
|
+
const blocks = readStruct(certificateOrCrl, block_info);
|
|
1275
|
+
const bufferToBeSigned = certificateOrCrl.subarray(block_info.position, blocks[1].position - 2);
|
|
1276
|
+
const signatureAlgorithm = readAlgorithmIdentifier(certificateOrCrl, blocks[1]);
|
|
1277
|
+
const signatureValue = readSignatureValueBin(certificateOrCrl, blocks[2]);
|
|
1278
|
+
const p = split_der(parentCertificate)[0];
|
|
1279
|
+
const certPem = toPem(p, "CERTIFICATE");
|
|
1280
|
+
const verify = _crypto2.createVerify.call(void 0, signatureAlgorithm.identifier);
|
|
1281
|
+
verify.update(bufferToBeSigned);
|
|
1282
|
+
verify.end();
|
|
1283
|
+
return verify.verify(certPem, signatureValue);
|
|
1284
|
+
}
|
|
1285
|
+
function verifyCertificateSignature(certificate, parentCertificate) {
|
|
1286
|
+
return verifyCertificateOrClrSignature(certificate, parentCertificate);
|
|
1287
|
+
}
|
|
1288
|
+
function verifyCertificateRevocationListSignature(certificateRevocationList, parentCertificate) {
|
|
1289
|
+
return verifyCertificateOrClrSignature(certificateRevocationList, parentCertificate);
|
|
1290
|
+
}
|
|
1291
|
+
async function verifyCertificateChain(certificateChain) {
|
|
1292
|
+
for (let index = 1; index < certificateChain.length; index++) {
|
|
1293
|
+
const cert = certificateChain[index - 1];
|
|
1294
|
+
const certParent = certificateChain[index];
|
|
1295
|
+
const certParentInfo = exploreCertificate(certParent);
|
|
1296
|
+
const keyUsage = _optionalChain([certParentInfo, 'access', _9 => _9.tbsCertificate, 'access', _10 => _10.extensions, 'optionalAccess', _11 => _11.keyUsage]);
|
|
1297
|
+
if (!keyUsage || !keyUsage.keyCertSign) {
|
|
1298
|
+
return {
|
|
1299
|
+
status: "BadCertificateIssuerUseNotAllowed",
|
|
1300
|
+
reason: "One of the certificate in the chain has not keyUsage set for Certificate Signing"
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
const parentSignChild = verifyCertificateSignature(cert, certParent);
|
|
1304
|
+
if (!parentSignChild) {
|
|
1305
|
+
return {
|
|
1306
|
+
status: "BadCertificateInvalid",
|
|
1307
|
+
reason: "One of the certificate in the chain is not signing the previous certificate"
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
const certInfo = exploreCertificate(cert);
|
|
1311
|
+
if (!certInfo.tbsCertificate.extensions) {
|
|
1312
|
+
return {
|
|
1313
|
+
status: "BadCertificateInvalid",
|
|
1314
|
+
reason: "Cannot find X409 Extension 3 in certificate"
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
if (!certParentInfo.tbsCertificate.extensions || !certInfo.tbsCertificate.extensions.authorityKeyIdentifier) {
|
|
1318
|
+
return {
|
|
1319
|
+
status: "BadCertificateInvalid",
|
|
1320
|
+
reason: "Cannot find X409 Extension 3 in certificate (parent)"
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
if (certParentInfo.tbsCertificate.extensions.subjectKeyIdentifier !== certInfo.tbsCertificate.extensions.authorityKeyIdentifier.keyIdentifier) {
|
|
1324
|
+
return {
|
|
1325
|
+
status: "BadCertificateInvalid",
|
|
1326
|
+
reason: "subjectKeyIdentifier authorityKeyIdentifier in child certificate do not match subjectKeyIdentifier of parent certificate"
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
return {
|
|
1331
|
+
status: "Good",
|
|
1332
|
+
reason: `certificate chain is valid(length = ${certificateChain.length})`
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
// source/crl_utils.ts
|
|
1337
|
+
function isCrlIssuedByCertificate(crl, certificate) {
|
|
1338
|
+
const crlInfo = exploreCertificateRevocationList(crl);
|
|
1339
|
+
const certInfo = exploreCertificate(certificate);
|
|
1340
|
+
return crlInfo.tbsCertList.issuerFingerprint === certInfo.tbsCertificate.subjectFingerPrint;
|
|
1341
|
+
}
|
|
1342
|
+
function verifyCrlIssuedByCertificate(crl, certificate) {
|
|
1343
|
+
if (!isCrlIssuedByCertificate(crl, certificate)) {
|
|
1344
|
+
return false;
|
|
1345
|
+
}
|
|
1346
|
+
return verifyCertificateRevocationListSignature(crl, certificate);
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// source/explore_asn1.ts
|
|
1350
|
+
function t(tag) {
|
|
1351
|
+
return TagType[tag];
|
|
1352
|
+
}
|
|
1353
|
+
function bi(blockInfo, depth) {
|
|
1354
|
+
const indent = " ".repeat(depth);
|
|
1355
|
+
const hl = blockInfo.position - blockInfo.start;
|
|
1356
|
+
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)}`;
|
|
1357
|
+
}
|
|
1358
|
+
function exploreAsn1(buffer) {
|
|
1359
|
+
console.log(hexDump(buffer));
|
|
1360
|
+
function dump(offset, depth) {
|
|
1361
|
+
const blockInfo = readTag(buffer, offset);
|
|
1362
|
+
dumpBlock(blockInfo, depth);
|
|
1363
|
+
function dumpBlock(blockInfo2, depth2) {
|
|
1364
|
+
console.log(bi(blockInfo2, depth2));
|
|
1365
|
+
if (blockInfo2.tag === 48 /* SEQUENCE */ || blockInfo2.tag === 49 /* SET */ || blockInfo2.tag >= 160 /* CONTEXT_SPECIFIC0 */) {
|
|
1366
|
+
const blocks = readStruct(buffer, blockInfo2);
|
|
1367
|
+
for (const block of blocks) {
|
|
1368
|
+
dumpBlock(block, depth2 + 1);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
dump(0, 0);
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// source/explore_certificate.ts
|
|
1377
|
+
|
|
1378
|
+
function coerceCertificate(certificate) {
|
|
1379
|
+
if (typeof certificate === "string") {
|
|
1380
|
+
certificate = convertPEMtoDER(certificate);
|
|
1381
|
+
}
|
|
1382
|
+
_assert2.default.call(void 0, Buffer.isBuffer(certificate));
|
|
1383
|
+
return certificate;
|
|
1384
|
+
}
|
|
1385
|
+
function exploreCertificateInfo(certificate) {
|
|
1386
|
+
certificate = coerceCertificate(certificate);
|
|
1387
|
+
const certInfo = exploreCertificate(certificate);
|
|
1388
|
+
const data = {
|
|
1389
|
+
publicKeyLength: certInfo.tbsCertificate.subjectPublicKeyInfo.keyLength,
|
|
1390
|
+
notBefore: certInfo.tbsCertificate.validity.notBefore,
|
|
1391
|
+
notAfter: certInfo.tbsCertificate.validity.notAfter,
|
|
1392
|
+
publicKey: certInfo.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey,
|
|
1393
|
+
subject: certInfo.tbsCertificate.subject
|
|
1394
|
+
};
|
|
1395
|
+
if (!(data.publicKeyLength === 512 || data.publicKeyLength === 384 || data.publicKeyLength === 256 || data.publicKeyLength === 128)) {
|
|
1396
|
+
throw new Error(`Invalid public key length (expecting 128,256,384 or 512): ${data.publicKeyLength}`);
|
|
1397
|
+
}
|
|
1398
|
+
return data;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1590
1401
|
// source/explore_certificate_signing_request.ts
|
|
1591
1402
|
function _readExtensionRequest(buffer) {
|
|
1592
1403
|
const block = readTag(buffer, 0);
|
|
@@ -1712,39 +1523,76 @@ function explorePrivateKey(privateKey2) {
|
|
|
1712
1523
|
};
|
|
1713
1524
|
}
|
|
1714
1525
|
|
|
1715
|
-
// source/
|
|
1716
|
-
function
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1526
|
+
// source/identify_der.ts
|
|
1527
|
+
function identifyDERContent(buffer) {
|
|
1528
|
+
if (!Buffer.isBuffer(buffer) || buffer.length < 2) {
|
|
1529
|
+
return "Unknown";
|
|
1530
|
+
}
|
|
1531
|
+
try {
|
|
1532
|
+
const outer = readTag(buffer, 0);
|
|
1533
|
+
if (outer.tag !== 48 /* SEQUENCE */) {
|
|
1534
|
+
return "Unknown";
|
|
1535
|
+
}
|
|
1536
|
+
const outerEnd = outer.position + outer.length;
|
|
1537
|
+
if (outerEnd < buffer.length) {
|
|
1538
|
+
const next = readTag(buffer, outerEnd);
|
|
1539
|
+
if (next.tag === 48 /* SEQUENCE */) {
|
|
1540
|
+
return "X509CertificateChain";
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
const blocks = readStruct(buffer, outer);
|
|
1544
|
+
if (blocks.length < 2) {
|
|
1545
|
+
return "Unknown";
|
|
1546
|
+
}
|
|
1547
|
+
if (blocks[0].tag === 2 /* INTEGER */) {
|
|
1548
|
+
const versionByte = buffer[blocks[0].position];
|
|
1549
|
+
if (blocks[0].length === 1 && versionByte === 3) {
|
|
1550
|
+
return "PKCS12";
|
|
1551
|
+
}
|
|
1552
|
+
if (blocks[0].length === 1 && versionByte === 0) {
|
|
1553
|
+
return "PrivateKey";
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
if (blocks[0].tag !== 48 /* SEQUENCE */) {
|
|
1557
|
+
return "Unknown";
|
|
1558
|
+
}
|
|
1559
|
+
const tbsBlocks = readStruct(buffer, blocks[0]);
|
|
1560
|
+
if (tbsBlocks.length === 0) {
|
|
1561
|
+
return "Unknown";
|
|
1562
|
+
}
|
|
1563
|
+
if (tbsBlocks[0].tag === 160 /* CONTEXT_SPECIFIC0 */) {
|
|
1564
|
+
return "X509Certificate";
|
|
1565
|
+
}
|
|
1566
|
+
if (tbsBlocks[0].tag === 2 /* INTEGER */) {
|
|
1567
|
+
const intLen = tbsBlocks[0].length;
|
|
1568
|
+
const intVal = intLen === 1 ? buffer[tbsBlocks[0].position] : -1;
|
|
1569
|
+
if (intVal === 0 && tbsBlocks.length >= 4) {
|
|
1570
|
+
if (tbsBlocks[3].tag === 160 /* CONTEXT_SPECIFIC0 */) {
|
|
1571
|
+
return "CertificateSigningRequest";
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
if (intVal === 1 && tbsBlocks.length >= 4) {
|
|
1575
|
+
const tag3 = tbsBlocks[3].tag;
|
|
1576
|
+
if (tag3 === 23 /* UTCTime */ || tag3 === 24 /* GeneralizedTime */) {
|
|
1577
|
+
return "CertificateRevocationList";
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
if (tbsBlocks.length >= 6) {
|
|
1581
|
+
if (tbsBlocks[3].tag === 48 /* SEQUENCE */) {
|
|
1582
|
+
return "X509Certificate";
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
if (tbsBlocks[0].tag === 48 /* SEQUENCE */ && tbsBlocks.length >= 3) {
|
|
1587
|
+
const tag2 = tbsBlocks[2].tag;
|
|
1588
|
+
if (tag2 === 23 /* UTCTime */ || tag2 === 24 /* GeneralizedTime */) {
|
|
1589
|
+
return "CertificateRevocationList";
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
return "Unknown";
|
|
1593
|
+
} catch (e2) {
|
|
1594
|
+
return "Unknown";
|
|
1733
1595
|
}
|
|
1734
|
-
return modulus1.toString("hex") === modulus2.toString("hex");
|
|
1735
|
-
}
|
|
1736
|
-
function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
|
|
1737
|
-
const initialBuffer = Buffer.from("Lorem Ipsum");
|
|
1738
|
-
const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
|
|
1739
|
-
const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
|
|
1740
|
-
const finalString = decryptedBuffer.toString("utf-8");
|
|
1741
|
-
return initialBuffer.toString("utf-8") === finalString;
|
|
1742
|
-
}
|
|
1743
|
-
function certificateMatchesPrivateKey(certificate, privateKey) {
|
|
1744
|
-
const e = explorePrivateKey(privateKey);
|
|
1745
|
-
const blockSize = e.modulus.length;
|
|
1746
|
-
const certificatePEM = toPem(certificate, "CERTIFICATE");
|
|
1747
|
-
return certificateMatchesPrivateKeyPEM(certificatePEM, privateKey, blockSize);
|
|
1748
1596
|
}
|
|
1749
1597
|
|
|
1750
1598
|
// source/subject.ts
|
|
@@ -1768,6 +1616,13 @@ var unquote2 = (str) => {
|
|
|
1768
1616
|
return m ? m[1] : str;
|
|
1769
1617
|
};
|
|
1770
1618
|
var Subject = class _Subject {
|
|
1619
|
+
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1771
1626
|
constructor(options) {
|
|
1772
1627
|
if (typeof options === "string") {
|
|
1773
1628
|
options = _Subject.parse(options);
|
|
@@ -1831,87 +1686,21 @@ var Subject = class _Subject {
|
|
|
1831
1686
|
toString() {
|
|
1832
1687
|
const t2 = this.toStringForOPCUA();
|
|
1833
1688
|
return t2 ? `/${t2}` : t2;
|
|
1834
|
-
}
|
|
1835
|
-
};
|
|
1836
|
-
|
|
1837
|
-
// source/verify_certificate_signature.ts
|
|
1838
|
-
var import_node_crypto4 = require("crypto");
|
|
1839
|
-
function verifyCertificateOrClrSignature(certificateOrCrl, parentCertificate) {
|
|
1840
|
-
const block_info = readTag(certificateOrCrl, 0);
|
|
1841
|
-
const blocks = readStruct(certificateOrCrl, block_info);
|
|
1842
|
-
const bufferToBeSigned = certificateOrCrl.subarray(block_info.position, blocks[1].position - 2);
|
|
1843
|
-
const signatureAlgorithm = readAlgorithmIdentifier(certificateOrCrl, blocks[1]);
|
|
1844
|
-
const signatureValue = readSignatureValueBin(certificateOrCrl, blocks[2]);
|
|
1845
|
-
const p = split_der(parentCertificate)[0];
|
|
1846
|
-
const certPem = toPem(p, "CERTIFICATE");
|
|
1847
|
-
const verify = (0, import_node_crypto4.createVerify)(signatureAlgorithm.identifier);
|
|
1848
|
-
verify.update(bufferToBeSigned);
|
|
1849
|
-
verify.end();
|
|
1850
|
-
return verify.verify(certPem, signatureValue);
|
|
1851
|
-
}
|
|
1852
|
-
function verifyCertificateSignature(certificate, parentCertificate) {
|
|
1853
|
-
return verifyCertificateOrClrSignature(certificate, parentCertificate);
|
|
1854
|
-
}
|
|
1855
|
-
function verifyCertificateRevocationListSignature(certificateRevocationList, parentCertificate) {
|
|
1856
|
-
return verifyCertificateOrClrSignature(certificateRevocationList, parentCertificate);
|
|
1857
|
-
}
|
|
1858
|
-
async function verifyCertificateChain(certificateChain) {
|
|
1859
|
-
for (let index = 1; index < certificateChain.length; index++) {
|
|
1860
|
-
const cert = certificateChain[index - 1];
|
|
1861
|
-
const certParent = certificateChain[index];
|
|
1862
|
-
const certParentInfo = exploreCertificate(certParent);
|
|
1863
|
-
const keyUsage = certParentInfo.tbsCertificate.extensions?.keyUsage;
|
|
1864
|
-
if (!keyUsage || !keyUsage.keyCertSign) {
|
|
1865
|
-
return {
|
|
1866
|
-
status: "BadCertificateIssuerUseNotAllowed",
|
|
1867
|
-
reason: "One of the certificate in the chain has not keyUsage set for Certificate Signing"
|
|
1868
|
-
};
|
|
1869
|
-
}
|
|
1870
|
-
const parentSignChild = verifyCertificateSignature(cert, certParent);
|
|
1871
|
-
if (!parentSignChild) {
|
|
1872
|
-
return {
|
|
1873
|
-
status: "BadCertificateInvalid",
|
|
1874
|
-
reason: "One of the certificate in the chain is not signing the previous certificate"
|
|
1875
|
-
};
|
|
1876
|
-
}
|
|
1877
|
-
const certInfo = exploreCertificate(cert);
|
|
1878
|
-
if (!certInfo.tbsCertificate.extensions) {
|
|
1879
|
-
return {
|
|
1880
|
-
status: "BadCertificateInvalid",
|
|
1881
|
-
reason: "Cannot find X409 Extension 3 in certificate"
|
|
1882
|
-
};
|
|
1883
|
-
}
|
|
1884
|
-
if (!certParentInfo.tbsCertificate.extensions || !certInfo.tbsCertificate.extensions.authorityKeyIdentifier) {
|
|
1885
|
-
return {
|
|
1886
|
-
status: "BadCertificateInvalid",
|
|
1887
|
-
reason: "Cannot find X409 Extension 3 in certificate (parent)"
|
|
1888
|
-
};
|
|
1889
|
-
}
|
|
1890
|
-
if (certParentInfo.tbsCertificate.extensions.subjectKeyIdentifier !== certInfo.tbsCertificate.extensions.authorityKeyIdentifier.keyIdentifier) {
|
|
1891
|
-
return {
|
|
1892
|
-
status: "BadCertificateInvalid",
|
|
1893
|
-
reason: "subjectKeyIdentifier authorityKeyIdentifier in child certificate do not match subjectKeyIdentifier of parent certificate"
|
|
1894
|
-
};
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
return {
|
|
1898
|
-
status: "Good",
|
|
1899
|
-
reason: `certificate chain is valid(length = ${certificateChain.length})`
|
|
1900
|
-
};
|
|
1901
|
-
}
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1902
1691
|
|
|
1903
1692
|
// source/x509/_crypto.ts
|
|
1904
|
-
|
|
1905
|
-
var
|
|
1906
|
-
var
|
|
1907
|
-
|
|
1693
|
+
|
|
1694
|
+
var _webcrypto = require('@peculiar/webcrypto');
|
|
1695
|
+
var _x509 = require('@peculiar/x509'); var x509 = _interopRequireWildcard(_x509); var x5092 = _interopRequireWildcard(_x509);
|
|
1696
|
+
|
|
1908
1697
|
var doDebug3 = false;
|
|
1909
1698
|
var _crypto;
|
|
1910
1699
|
var ignoreCrypto = process.env.IGNORE_SUBTLE_FROM_CRYPTO;
|
|
1911
1700
|
if (typeof window === "undefined") {
|
|
1912
|
-
_crypto =
|
|
1913
|
-
if (!_crypto
|
|
1914
|
-
_crypto = new
|
|
1701
|
+
_crypto = _crypto3.default;
|
|
1702
|
+
if (!_optionalChain([_crypto, 'optionalAccess', _12 => _12.subtle]) || ignoreCrypto) {
|
|
1703
|
+
_crypto = new (0, _webcrypto.Crypto)();
|
|
1915
1704
|
doDebug3 && console.warn("using @peculiar/webcrypto");
|
|
1916
1705
|
} else {
|
|
1917
1706
|
doDebug3 && console.warn("using nodejs crypto (native)");
|
|
@@ -1923,7 +1712,7 @@ if (typeof window === "undefined") {
|
|
|
1923
1712
|
x509.cryptoProvider.set(crypto);
|
|
1924
1713
|
}
|
|
1925
1714
|
function getCrypto() {
|
|
1926
|
-
return _crypto || crypto ||
|
|
1715
|
+
return _crypto || crypto || _crypto3.default;
|
|
1927
1716
|
}
|
|
1928
1717
|
|
|
1929
1718
|
// source/x509/create_key_pair.ts
|
|
@@ -2079,10 +1868,10 @@ async function createCertificateSigningRequest({
|
|
|
2079
1868
|
publicKey
|
|
2080
1869
|
};
|
|
2081
1870
|
const alternativeNameExtensions = [];
|
|
2082
|
-
for (const d of dns
|
|
1871
|
+
for (const d of _nullishCoalesce(dns, () => ( []))) {
|
|
2083
1872
|
alternativeNameExtensions.push({ type: "dns", value: d });
|
|
2084
1873
|
}
|
|
2085
|
-
for (const d of ip
|
|
1874
|
+
for (const d of _nullishCoalesce(ip, () => ( []))) {
|
|
2086
1875
|
alternativeNameExtensions.push({ type: "ip", value: d });
|
|
2087
1876
|
}
|
|
2088
1877
|
if (applicationUri) {
|
|
@@ -3723,7 +3512,7 @@ var OctetString = class extends BaseBlock {
|
|
|
3723
3512
|
this.valueBlock.value = [asn.result];
|
|
3724
3513
|
}
|
|
3725
3514
|
}
|
|
3726
|
-
} catch {
|
|
3515
|
+
} catch (e3) {
|
|
3727
3516
|
}
|
|
3728
3517
|
}
|
|
3729
3518
|
return super.fromBER(inputBuffer, inputOffset, inputLength);
|
|
@@ -3812,7 +3601,7 @@ var LocalBitStringValueBlock = class extends HexBlock(LocalConstructedValueBlock
|
|
|
3812
3601
|
this.value = [asn.result];
|
|
3813
3602
|
}
|
|
3814
3603
|
}
|
|
3815
|
-
} catch {
|
|
3604
|
+
} catch (e4) {
|
|
3816
3605
|
}
|
|
3817
3606
|
}
|
|
3818
3607
|
this.valueHexView = intBuffer.subarray(1);
|
|
@@ -6033,7 +5822,7 @@ var AsnParser = class {
|
|
|
6033
5822
|
return elementsToProcess.filter((el) => el && el.valueBlock).map((el) => {
|
|
6034
5823
|
try {
|
|
6035
5824
|
return converter.fromASN(el);
|
|
6036
|
-
} catch {
|
|
5825
|
+
} catch (e5) {
|
|
6037
5826
|
return void 0;
|
|
6038
5827
|
}
|
|
6039
5828
|
}).filter((v) => v !== void 0);
|
|
@@ -6041,7 +5830,7 @@ var AsnParser = class {
|
|
|
6041
5830
|
return elementsToProcess.filter((el) => el && el.valueBlock).map((el) => {
|
|
6042
5831
|
try {
|
|
6043
5832
|
return this.fromASN(el, schemaItem.type);
|
|
6044
|
-
} catch {
|
|
5833
|
+
} catch (e6) {
|
|
6045
5834
|
return void 0;
|
|
6046
5835
|
}
|
|
6047
5836
|
}).filter((v) => v !== void 0);
|
|
@@ -6422,83 +6211,298 @@ async function createSelfSignedCertificate({
|
|
|
6422
6211
|
return { cert: cert.toString("pem"), der: cert };
|
|
6423
6212
|
}
|
|
6424
6213
|
|
|
6214
|
+
// source/crypto_utils2.ts
|
|
6215
|
+
|
|
6216
|
+
|
|
6217
|
+
function rsaLengthPrivateKey(key) {
|
|
6218
|
+
const keyPem = typeof key.hidden === "string" ? key.hidden : key.hidden.export({ type: "pkcs1", format: "pem" }).toString();
|
|
6219
|
+
const keyObject = _crypto2.createPrivateKey.call(void 0, keyPem);
|
|
6220
|
+
const modulusLength = _optionalChain([keyObject, 'access', _13 => _13.asymmetricKeyDetails, 'optionalAccess', _14 => _14.modulusLength]);
|
|
6221
|
+
_assert2.default.call(void 0, modulusLength, "Cannot determine modulus length from private key");
|
|
6222
|
+
return modulusLength / 8;
|
|
6223
|
+
}
|
|
6224
|
+
function toPem2(raw_key, pem) {
|
|
6225
|
+
if (raw_key.hidden) {
|
|
6226
|
+
return toPem2(raw_key.hidden, pem);
|
|
6227
|
+
}
|
|
6228
|
+
_assert2.default.call(void 0, raw_key, "expecting a key");
|
|
6229
|
+
_assert2.default.call(void 0, typeof pem === "string");
|
|
6230
|
+
if (isKeyObject(raw_key)) {
|
|
6231
|
+
const _raw_key = raw_key;
|
|
6232
|
+
if (pem === "RSA PRIVATE KEY") {
|
|
6233
|
+
return removeTrailingLF(_raw_key.export({ format: "pem", type: "pkcs1" }).toString());
|
|
6234
|
+
} else if (pem === "PRIVATE KEY") {
|
|
6235
|
+
return removeTrailingLF(_raw_key.export({ format: "pem", type: "pkcs8" }).toString());
|
|
6236
|
+
} else {
|
|
6237
|
+
throw new Error("Unsupported case!");
|
|
6238
|
+
}
|
|
6239
|
+
}
|
|
6240
|
+
return toPem(raw_key, pem);
|
|
6241
|
+
}
|
|
6242
|
+
function coercePrivateKeyPem(privateKey) {
|
|
6243
|
+
return toPem2(privateKey, "PRIVATE KEY");
|
|
6244
|
+
}
|
|
6245
|
+
function coercePublicKeyPem(publicKey) {
|
|
6246
|
+
if (isKeyObject(publicKey)) {
|
|
6247
|
+
return publicKey.export({ format: "pem", type: "spki" }).toString();
|
|
6248
|
+
}
|
|
6249
|
+
_assert2.default.call(void 0, typeof publicKey === "string");
|
|
6250
|
+
return publicKey;
|
|
6251
|
+
}
|
|
6252
|
+
function coerceRsaPublicKeyPem(publicKey) {
|
|
6253
|
+
if (isKeyObject(publicKey)) {
|
|
6254
|
+
return publicKey.export({ format: "pem", type: "spki" }).toString();
|
|
6255
|
+
}
|
|
6256
|
+
_assert2.default.call(void 0, typeof publicKey === "string");
|
|
6257
|
+
return publicKey;
|
|
6258
|
+
}
|
|
6259
|
+
function rsaLengthPublicKey(key) {
|
|
6260
|
+
key = coercePublicKeyPem(key);
|
|
6261
|
+
_assert2.default.call(void 0, typeof key === "string");
|
|
6262
|
+
const keyObject = _crypto2.createPublicKey.call(void 0, key);
|
|
6263
|
+
const modulusLength = _optionalChain([keyObject, 'access', _15 => _15.asymmetricKeyDetails, 'optionalAccess', _16 => _16.modulusLength]);
|
|
6264
|
+
_assert2.default.call(void 0, modulusLength, "Cannot determine modulus length from public key");
|
|
6265
|
+
return modulusLength / 8;
|
|
6266
|
+
}
|
|
6267
|
+
function rsaLengthRsaPublicKey(key) {
|
|
6268
|
+
key = coerceRsaPublicKeyPem(key);
|
|
6269
|
+
_assert2.default.call(void 0, typeof key === "string");
|
|
6270
|
+
const keyObject = _crypto2.createPublicKey.call(void 0, key);
|
|
6271
|
+
const modulusLength = _optionalChain([keyObject, 'access', _17 => _17.asymmetricKeyDetails, 'optionalAccess', _18 => _18.modulusLength]);
|
|
6272
|
+
_assert2.default.call(void 0, modulusLength, "Cannot determine modulus length from public key");
|
|
6273
|
+
return modulusLength / 8;
|
|
6274
|
+
}
|
|
6275
|
+
|
|
6276
|
+
// source/derived_keys.ts
|
|
6277
|
+
|
|
6278
|
+
|
|
6279
|
+
function HMAC_HASH(sha1or256, secret, message) {
|
|
6280
|
+
return _crypto2.createHmac.call(void 0, sha1or256, secret).update(message).digest();
|
|
6281
|
+
}
|
|
6282
|
+
function plus(buf1, buf2) {
|
|
6283
|
+
return Buffer.concat([buf1, buf2]);
|
|
6284
|
+
}
|
|
6285
|
+
function makePseudoRandomBuffer(secret, seed, minLength, sha1or256) {
|
|
6286
|
+
_assert2.default.call(void 0, Buffer.isBuffer(seed));
|
|
6287
|
+
_assert2.default.call(void 0, sha1or256 === "SHA1" || sha1or256 === "SHA256");
|
|
6288
|
+
const a = [];
|
|
6289
|
+
a[0] = seed;
|
|
6290
|
+
let index = 1;
|
|
6291
|
+
let p_hash = createFastUninitializedBuffer(0);
|
|
6292
|
+
while (p_hash.length <= minLength) {
|
|
6293
|
+
a[index] = HMAC_HASH(sha1or256, secret, a[index - 1]);
|
|
6294
|
+
p_hash = plus(p_hash, HMAC_HASH(sha1or256, secret, plus(a[index], seed)));
|
|
6295
|
+
index += 1;
|
|
6296
|
+
}
|
|
6297
|
+
return p_hash.subarray(0, minLength);
|
|
6298
|
+
}
|
|
6299
|
+
function computeDerivedKeys(secret, seed, options) {
|
|
6300
|
+
_assert2.default.call(void 0, Number.isFinite(options.signatureLength));
|
|
6301
|
+
_assert2.default.call(void 0, Number.isFinite(options.encryptingKeyLength));
|
|
6302
|
+
_assert2.default.call(void 0, Number.isFinite(options.encryptingBlockSize));
|
|
6303
|
+
_assert2.default.call(void 0, typeof options.algorithm === "string");
|
|
6304
|
+
options.sha1or256 = options.sha1or256 || "SHA1";
|
|
6305
|
+
_assert2.default.call(void 0, typeof options.sha1or256 === "string");
|
|
6306
|
+
const offset1 = options.signingKeyLength;
|
|
6307
|
+
const offset2 = offset1 + options.encryptingKeyLength;
|
|
6308
|
+
const minLength = offset2 + options.encryptingBlockSize;
|
|
6309
|
+
const buf = makePseudoRandomBuffer(secret, seed, minLength, options.sha1or256);
|
|
6310
|
+
return {
|
|
6311
|
+
signatureLength: options.signatureLength,
|
|
6312
|
+
signingKeyLength: options.signingKeyLength,
|
|
6313
|
+
encryptingKeyLength: options.encryptingKeyLength,
|
|
6314
|
+
encryptingBlockSize: options.encryptingBlockSize,
|
|
6315
|
+
algorithm: options.algorithm,
|
|
6316
|
+
sha1or256: options.sha1or256,
|
|
6317
|
+
signingKey: buf.subarray(0, offset1),
|
|
6318
|
+
encryptingKey: buf.subarray(offset1, offset2),
|
|
6319
|
+
initializationVector: buf.subarray(offset2, minLength)
|
|
6320
|
+
};
|
|
6321
|
+
}
|
|
6322
|
+
function reduceLength(buffer, byteToRemove) {
|
|
6323
|
+
return buffer.subarray(0, buffer.length - byteToRemove);
|
|
6324
|
+
}
|
|
6325
|
+
function removePadding(buffer) {
|
|
6326
|
+
const nbPaddingBytes = buffer.readUInt8(buffer.length - 1) + 1;
|
|
6327
|
+
return reduceLength(buffer, nbPaddingBytes);
|
|
6328
|
+
}
|
|
6329
|
+
function verifyChunkSignature(chunk, options) {
|
|
6330
|
+
_assert2.default.call(void 0, Buffer.isBuffer(chunk));
|
|
6331
|
+
let signatureLength = options.signatureLength || 0;
|
|
6332
|
+
if (signatureLength === 0) {
|
|
6333
|
+
const cert = exploreCertificateInfo(options.publicKey);
|
|
6334
|
+
signatureLength = cert.publicKeyLength || 0;
|
|
6335
|
+
}
|
|
6336
|
+
const block_to_verify = chunk.subarray(0, chunk.length - signatureLength);
|
|
6337
|
+
const signature = chunk.subarray(chunk.length - signatureLength);
|
|
6338
|
+
return verifyMessageChunkSignature(block_to_verify, signature, options);
|
|
6339
|
+
}
|
|
6340
|
+
function computePaddingFooter(buffer, derivedKeys) {
|
|
6341
|
+
_assert2.default.call(void 0, Object.hasOwn(derivedKeys, "encryptingBlockSize"));
|
|
6342
|
+
const paddingSize = derivedKeys.encryptingBlockSize - (buffer.length + 1) % derivedKeys.encryptingBlockSize;
|
|
6343
|
+
const padding = createFastUninitializedBuffer(paddingSize + 1);
|
|
6344
|
+
padding.fill(paddingSize);
|
|
6345
|
+
return padding;
|
|
6346
|
+
}
|
|
6347
|
+
function derivedKeys_algorithm(derivedKeys) {
|
|
6348
|
+
_assert2.default.call(void 0, Object.hasOwn(derivedKeys, "algorithm"));
|
|
6349
|
+
const algorithm = derivedKeys.algorithm || "aes-128-cbc";
|
|
6350
|
+
_assert2.default.call(void 0, algorithm === "aes-128-cbc" || algorithm === "aes-256-cbc");
|
|
6351
|
+
return algorithm;
|
|
6352
|
+
}
|
|
6353
|
+
function encryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
6354
|
+
const algorithm = derivedKeys_algorithm(derivedKeys);
|
|
6355
|
+
const key = derivedKeys.encryptingKey;
|
|
6356
|
+
const initVector = derivedKeys.initializationVector;
|
|
6357
|
+
const cipher = _crypto2.createCipheriv.call(void 0, algorithm, key, initVector);
|
|
6358
|
+
cipher.setAutoPadding(false);
|
|
6359
|
+
const encrypted_chunks = [];
|
|
6360
|
+
encrypted_chunks.push(cipher.update(buffer));
|
|
6361
|
+
encrypted_chunks.push(cipher.final());
|
|
6362
|
+
return Buffer.concat(encrypted_chunks);
|
|
6363
|
+
}
|
|
6364
|
+
function decryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
6365
|
+
const algorithm = derivedKeys_algorithm(derivedKeys);
|
|
6366
|
+
const key = derivedKeys.encryptingKey;
|
|
6367
|
+
const initVector = derivedKeys.initializationVector;
|
|
6368
|
+
const cipher = _crypto2.createDecipheriv.call(void 0, algorithm, key, initVector);
|
|
6369
|
+
cipher.setAutoPadding(false);
|
|
6370
|
+
const decrypted_chunks = [];
|
|
6371
|
+
decrypted_chunks.push(cipher.update(buffer));
|
|
6372
|
+
decrypted_chunks.push(cipher.final());
|
|
6373
|
+
return Buffer.concat(decrypted_chunks);
|
|
6374
|
+
}
|
|
6375
|
+
function makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys) {
|
|
6376
|
+
_assert2.default.call(void 0, Buffer.isBuffer(message));
|
|
6377
|
+
_assert2.default.call(void 0, Buffer.isBuffer(derivedKeys.signingKey));
|
|
6378
|
+
_assert2.default.call(void 0, typeof derivedKeys.sha1or256 === "string");
|
|
6379
|
+
_assert2.default.call(void 0, derivedKeys.sha1or256 === "SHA1" || derivedKeys.sha1or256 === "SHA256");
|
|
6380
|
+
const signature = _crypto2.createHmac.call(void 0, derivedKeys.sha1or256, derivedKeys.signingKey).update(message).digest();
|
|
6381
|
+
_assert2.default.call(void 0, signature.length === derivedKeys.signatureLength);
|
|
6382
|
+
return signature;
|
|
6383
|
+
}
|
|
6384
|
+
function verifyChunkSignatureWithDerivedKeys(chunk, derivedKeys) {
|
|
6385
|
+
const message = chunk.subarray(0, chunk.length - derivedKeys.signatureLength);
|
|
6386
|
+
const expectedSignature = chunk.subarray(chunk.length - derivedKeys.signatureLength);
|
|
6387
|
+
const computedSignature = makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys);
|
|
6388
|
+
return computedSignature.toString("hex") === expectedSignature.toString("hex");
|
|
6389
|
+
}
|
|
6390
|
+
|
|
6391
|
+
// source/make_private_key_from_pem.ts
|
|
6392
|
+
function makePrivateKeyFromPem(privateKeyInPem) {
|
|
6393
|
+
return { hidden: privateKeyInPem };
|
|
6394
|
+
}
|
|
6395
|
+
|
|
6396
|
+
// source/make_private_key_thumbprint.ts
|
|
6397
|
+
function makePrivateKeyThumbPrint(_privateKey) {
|
|
6398
|
+
return Buffer.alloc(0);
|
|
6399
|
+
}
|
|
6400
|
+
|
|
6401
|
+
// source/public_private_match.ts
|
|
6402
|
+
function publicKeyAndPrivateKeyMatches(certificate, privateKey) {
|
|
6403
|
+
const i = exploreCertificate(certificate);
|
|
6404
|
+
const j = explorePrivateKey(privateKey);
|
|
6405
|
+
const modulus1 = i.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey.modulus;
|
|
6406
|
+
const modulus2 = j.modulus;
|
|
6407
|
+
if (modulus1.length !== modulus2.length) {
|
|
6408
|
+
return false;
|
|
6409
|
+
}
|
|
6410
|
+
return modulus1.toString("hex") === modulus2.toString("hex");
|
|
6411
|
+
}
|
|
6412
|
+
function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
|
|
6413
|
+
const initialBuffer = Buffer.from("Lorem Ipsum");
|
|
6414
|
+
const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
|
|
6415
|
+
const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
|
|
6416
|
+
const finalString = decryptedBuffer.toString("utf-8");
|
|
6417
|
+
return initialBuffer.toString("utf-8") === finalString;
|
|
6418
|
+
}
|
|
6419
|
+
function certificateMatchesPrivateKey(certificate, privateKey) {
|
|
6420
|
+
const e = explorePrivateKey(privateKey);
|
|
6421
|
+
const blockSize = e.modulus.length;
|
|
6422
|
+
const certificatePEM = toPem(certificate, "CERTIFICATE");
|
|
6423
|
+
return certificateMatchesPrivateKeyPEM(certificatePEM, privateKey, blockSize);
|
|
6424
|
+
}
|
|
6425
|
+
|
|
6425
6426
|
// source/index_web.ts
|
|
6426
6427
|
var asn1 = { readDirectoryName, readTag, readStruct, readAlgorithmIdentifier, readSignatureValueBin };
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6428
|
+
|
|
6429
|
+
|
|
6430
|
+
|
|
6431
|
+
|
|
6432
|
+
|
|
6433
|
+
|
|
6434
|
+
|
|
6435
|
+
|
|
6436
|
+
|
|
6437
|
+
|
|
6438
|
+
|
|
6439
|
+
|
|
6440
|
+
|
|
6441
|
+
|
|
6442
|
+
|
|
6443
|
+
|
|
6444
|
+
|
|
6445
|
+
|
|
6446
|
+
|
|
6447
|
+
|
|
6448
|
+
|
|
6449
|
+
|
|
6450
|
+
|
|
6451
|
+
|
|
6452
|
+
|
|
6453
|
+
|
|
6454
|
+
|
|
6455
|
+
|
|
6456
|
+
|
|
6457
|
+
|
|
6458
|
+
|
|
6459
|
+
|
|
6460
|
+
|
|
6461
|
+
|
|
6462
|
+
|
|
6463
|
+
|
|
6464
|
+
|
|
6465
|
+
|
|
6466
|
+
|
|
6467
|
+
|
|
6468
|
+
|
|
6469
|
+
|
|
6470
|
+
|
|
6471
|
+
|
|
6472
|
+
|
|
6473
|
+
|
|
6474
|
+
|
|
6475
|
+
|
|
6476
|
+
|
|
6477
|
+
|
|
6478
|
+
|
|
6479
|
+
|
|
6480
|
+
|
|
6481
|
+
|
|
6482
|
+
|
|
6483
|
+
|
|
6484
|
+
|
|
6485
|
+
|
|
6486
|
+
|
|
6487
|
+
|
|
6488
|
+
|
|
6489
|
+
|
|
6490
|
+
|
|
6491
|
+
|
|
6492
|
+
|
|
6493
|
+
|
|
6494
|
+
|
|
6495
|
+
|
|
6496
|
+
|
|
6497
|
+
|
|
6498
|
+
|
|
6499
|
+
|
|
6500
|
+
|
|
6501
|
+
|
|
6502
|
+
|
|
6503
|
+
|
|
6504
|
+
|
|
6505
|
+
exports.createPrivateKeyFromNodeJSCrypto = createPrivateKeyFromNodeJSCrypto; exports.isKeyObject = isKeyObject; exports.CertificatePurpose = CertificatePurpose; exports.identifyPemType = identifyPemType; exports.removeTrailingLF = removeTrailingLF; exports.toPem = toPem; exports.convertPEMtoDER = convertPEMtoDER; exports.hexDump = hexDump; exports.makeMessageChunkSignature = makeMessageChunkSignature; exports.verifyMessageChunkSignature = verifyMessageChunkSignature; exports.makeSHA1Thumbprint = makeSHA1Thumbprint; exports.RSA_PKCS1_OAEP_PADDING = RSA_PKCS1_OAEP_PADDING; exports.RSA_PKCS1_PADDING = RSA_PKCS1_PADDING; exports.PaddingAlgorithm = PaddingAlgorithm; exports.publicEncrypt_native = publicEncrypt_native; exports.privateDecrypt_native = privateDecrypt_native; exports.publicEncrypt = publicEncrypt; exports.privateDecrypt = privateDecrypt; exports.publicEncrypt_long = publicEncrypt_long; exports.privateDecrypt_long = privateDecrypt_long; exports.coerceCertificatePem = coerceCertificatePem; exports.extractPublicKeyFromCertificateSync = extractPublicKeyFromCertificateSync; exports.extractPublicKeyFromCertificate = extractPublicKeyFromCertificate; exports.readExtension = readExtension; exports.readTbsCertificate = readTbsCertificate; exports.exploreCertificate = exploreCertificate; exports.split_der = split_der; exports.combine_der = combine_der; exports.readNameForCrl = readNameForCrl; exports.exploreCertificateRevocationList = exploreCertificateRevocationList; exports.verifyCertificateOrClrSignature = verifyCertificateOrClrSignature; exports.verifyCertificateSignature = verifyCertificateSignature; exports.verifyCertificateRevocationListSignature = verifyCertificateRevocationListSignature; exports.verifyCertificateChain = verifyCertificateChain; exports.isCrlIssuedByCertificate = isCrlIssuedByCertificate; exports.verifyCrlIssuedByCertificate = verifyCrlIssuedByCertificate; exports.exploreAsn1 = exploreAsn1; exports.coerceCertificate = coerceCertificate; exports.exploreCertificateInfo = exploreCertificateInfo; exports.readCertificationRequestInfo = readCertificationRequestInfo; exports.exploreCertificateSigningRequest = exploreCertificateSigningRequest; exports.explorePrivateKey = explorePrivateKey; exports.identifyDERContent = identifyDERContent; exports.Subject = Subject; exports.generateKeyPair = generateKeyPair; exports.generatePrivateKey = generatePrivateKey; exports.privateKeyToPEM = privateKeyToPEM; exports.derToPrivateKey = derToPrivateKey; exports.pemToPrivateKey = pemToPrivateKey; exports.coercePEMorDerToPrivateKey = coercePEMorDerToPrivateKey; exports._coercePrivateKey = _coercePrivateKey; exports.createCertificateSigningRequest = createCertificateSigningRequest; exports.createSelfSignedCertificate = createSelfSignedCertificate; exports.rsaLengthPrivateKey = rsaLengthPrivateKey; exports.toPem2 = toPem2; exports.coercePrivateKeyPem = coercePrivateKeyPem; exports.coercePublicKeyPem = coercePublicKeyPem; exports.coerceRsaPublicKeyPem = coerceRsaPublicKeyPem; exports.rsaLengthPublicKey = rsaLengthPublicKey; exports.rsaLengthRsaPublicKey = rsaLengthRsaPublicKey; exports.makePseudoRandomBuffer = makePseudoRandomBuffer; exports.computeDerivedKeys = computeDerivedKeys; exports.reduceLength = reduceLength; exports.removePadding = removePadding; exports.verifyChunkSignature = verifyChunkSignature; exports.computePaddingFooter = computePaddingFooter; exports.encryptBufferWithDerivedKeys = encryptBufferWithDerivedKeys; exports.decryptBufferWithDerivedKeys = decryptBufferWithDerivedKeys; exports.makeMessageChunkSignatureWithDerivedKeys = makeMessageChunkSignatureWithDerivedKeys; exports.verifyChunkSignatureWithDerivedKeys = verifyChunkSignatureWithDerivedKeys; exports.makePrivateKeyFromPem = makePrivateKeyFromPem; exports.makePrivateKeyThumbPrint = makePrivateKeyThumbPrint; exports.publicKeyAndPrivateKeyMatches = publicKeyAndPrivateKeyMatches; exports.certificateMatchesPrivateKey = certificateMatchesPrivateKey; exports.asn1 = asn1;
|
|
6502
6506
|
/*! Bundled license information:
|
|
6503
6507
|
|
|
6504
6508
|
pvtsutils/build/index.es.js:
|
|
@@ -6567,4 +6571,4 @@ asn1js/build/index.es.js:
|
|
|
6567
6571
|
*
|
|
6568
6572
|
*)
|
|
6569
6573
|
*/
|
|
6570
|
-
//# sourceMappingURL=
|
|
6574
|
+
//# sourceMappingURL=chunk-ERHE4VFS.cjs.map
|