node-opcua-crypto 4.9.4 → 4.11.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/LICENSE +23 -23
- package/README.md +119 -114
- package/dist/{chunk-WLW5XUML.mjs → chunk-2RCYFHGG.mjs} +755 -724
- package/dist/chunk-2RCYFHGG.mjs.map +1 -0
- package/dist/chunk-C7PROBPE.mjs +14 -0
- package/dist/chunk-C7PROBPE.mjs.map +1 -0
- package/dist/{chunk-UEV3YRUV.mjs → chunk-UH5AT3JE.mjs} +9 -15
- package/dist/chunk-UH5AT3JE.mjs.map +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +553 -552
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -52
- package/dist/index_web-C5Oeu9mq.d.mts +503 -0
- package/dist/index_web-D1qc4UN2.d.ts +503 -0
- package/dist/source/index.d.mts +11 -516
- package/dist/source/index.d.ts +11 -516
- package/dist/source/index.js +537 -529
- package/dist/source/index.js.map +1 -1
- package/dist/source/index.mjs +9 -50
- package/dist/source/index_web.d.mts +1 -1
- package/dist/source/index_web.d.ts +1 -1
- package/dist/source/index_web.js +525 -522
- package/dist/source/index_web.js.map +1 -1
- package/dist/source/index_web.mjs +5 -49
- package/dist/source_nodejs/index.d.mts +1 -2
- package/dist/source_nodejs/index.d.ts +1 -2
- package/dist/source_nodejs/index.js +33 -41
- package/dist/source_nodejs/index.js.map +1 -1
- package/dist/source_nodejs/index.mjs +3 -5
- package/package.json +9 -4
- package/dist/chunk-5NV4OKIV.mjs +0 -1
- package/dist/chunk-5NV4OKIV.mjs.map +0 -1
- package/dist/chunk-UEV3YRUV.mjs.map +0 -1
- package/dist/chunk-WLW5XUML.mjs.map +0 -1
- package/dist/index_web.d.mts +0 -4
- package/dist/index_web.d.ts +0 -4
- package/dist/index_web.js +0 -6365
- package/dist/index_web.js.map +0 -1
- package/dist/index_web.mjs +0 -192
- package/dist/index_web.mjs.map +0 -1
- package/index.mjs +0 -1
- package/index_web.ts +0 -1
- package/web.d.ts +0 -1
- package/web.mjs +0 -1
|
@@ -4,28 +4,8 @@ import {
|
|
|
4
4
|
RSA_PKCS1_OAEP_PADDING,
|
|
5
5
|
RSA_PKCS1_PADDING,
|
|
6
6
|
Subject,
|
|
7
|
-
TagType,
|
|
8
7
|
_coercePrivateKey,
|
|
9
|
-
_findBlockAtIndex,
|
|
10
|
-
_getBlock,
|
|
11
|
-
_readAlgorithmIdentifier,
|
|
12
|
-
_readBitString,
|
|
13
|
-
_readBooleanValue,
|
|
14
|
-
_readDirectoryName,
|
|
15
|
-
_readECCAlgorithmIdentifier,
|
|
16
8
|
_readExtension,
|
|
17
|
-
_readIntegerAsByteString,
|
|
18
|
-
_readIntegerValue,
|
|
19
|
-
_readListOfInteger,
|
|
20
|
-
_readLongIntegerValue,
|
|
21
|
-
_readObjectIdentifier,
|
|
22
|
-
_readOctetString,
|
|
23
|
-
_readSignatureValue,
|
|
24
|
-
_readSignatureValueBin,
|
|
25
|
-
_readStruct,
|
|
26
|
-
_readTime,
|
|
27
|
-
_readValue,
|
|
28
|
-
_readVersionValue,
|
|
29
9
|
certificateMatchesPrivateKey,
|
|
30
10
|
coerceCertificate,
|
|
31
11
|
coerceCertificatePem,
|
|
@@ -34,7 +14,6 @@ import {
|
|
|
34
14
|
coercePublicKeyPem,
|
|
35
15
|
coerceRsaPublicKeyPem,
|
|
36
16
|
combine_der,
|
|
37
|
-
compactDirectoryName,
|
|
38
17
|
computeDerivedKeys,
|
|
39
18
|
computePaddingFooter,
|
|
40
19
|
convertPEMtoDER,
|
|
@@ -44,6 +23,7 @@ import {
|
|
|
44
23
|
decryptBufferWithDerivedKeys,
|
|
45
24
|
derToPrivateKey,
|
|
46
25
|
encryptBufferWithDerivedKeys,
|
|
26
|
+
exploreAsn1,
|
|
47
27
|
exploreCertificate,
|
|
48
28
|
exploreCertificateInfo,
|
|
49
29
|
exploreCertificateRevocationList,
|
|
@@ -51,7 +31,6 @@ import {
|
|
|
51
31
|
explorePrivateKey,
|
|
52
32
|
extractPublicKeyFromCertificate,
|
|
53
33
|
extractPublicKeyFromCertificateSync,
|
|
54
|
-
formatBuffer2DigitHexWithColum,
|
|
55
34
|
generateKeyPair,
|
|
56
35
|
generatePrivateKey,
|
|
57
36
|
hexDump,
|
|
@@ -60,9 +39,9 @@ import {
|
|
|
60
39
|
makeMessageChunkSignature,
|
|
61
40
|
makeMessageChunkSignatureWithDerivedKeys,
|
|
62
41
|
makePrivateKeyFromPem,
|
|
42
|
+
makePrivateKeyThumbPrint,
|
|
63
43
|
makePseudoRandomBuffer,
|
|
64
44
|
makeSHA1Thumbprint,
|
|
65
|
-
parseBitString,
|
|
66
45
|
pemToPrivateKey,
|
|
67
46
|
privateDecrypt,
|
|
68
47
|
privateDecrypt_long,
|
|
@@ -74,7 +53,6 @@ import {
|
|
|
74
53
|
publicKeyAndPrivateKeyMatches,
|
|
75
54
|
readCertificationRequestInfo,
|
|
76
55
|
readNameForCrl,
|
|
77
|
-
readTag,
|
|
78
56
|
readTbsCertificate,
|
|
79
57
|
reduceLength,
|
|
80
58
|
removePadding,
|
|
@@ -92,35 +70,15 @@ import {
|
|
|
92
70
|
verifyChunkSignature,
|
|
93
71
|
verifyChunkSignatureWithDerivedKeys,
|
|
94
72
|
verifyMessageChunkSignature
|
|
95
|
-
} from "../chunk-
|
|
73
|
+
} from "../chunk-2RCYFHGG.mjs";
|
|
96
74
|
export {
|
|
97
75
|
CertificatePurpose,
|
|
98
76
|
PaddingAlgorithm,
|
|
99
77
|
RSA_PKCS1_OAEP_PADDING,
|
|
100
78
|
RSA_PKCS1_PADDING,
|
|
101
79
|
Subject,
|
|
102
|
-
TagType,
|
|
103
80
|
_coercePrivateKey,
|
|
104
|
-
_findBlockAtIndex,
|
|
105
|
-
_getBlock,
|
|
106
|
-
_readAlgorithmIdentifier,
|
|
107
|
-
_readBitString,
|
|
108
|
-
_readBooleanValue,
|
|
109
|
-
_readDirectoryName,
|
|
110
|
-
_readECCAlgorithmIdentifier,
|
|
111
81
|
_readExtension,
|
|
112
|
-
_readIntegerAsByteString,
|
|
113
|
-
_readIntegerValue,
|
|
114
|
-
_readListOfInteger,
|
|
115
|
-
_readLongIntegerValue,
|
|
116
|
-
_readObjectIdentifier,
|
|
117
|
-
_readOctetString,
|
|
118
|
-
_readSignatureValue,
|
|
119
|
-
_readSignatureValueBin,
|
|
120
|
-
_readStruct,
|
|
121
|
-
_readTime,
|
|
122
|
-
_readValue,
|
|
123
|
-
_readVersionValue,
|
|
124
82
|
certificateMatchesPrivateKey,
|
|
125
83
|
coerceCertificate,
|
|
126
84
|
coerceCertificatePem,
|
|
@@ -129,7 +87,6 @@ export {
|
|
|
129
87
|
coercePublicKeyPem,
|
|
130
88
|
coerceRsaPublicKeyPem,
|
|
131
89
|
combine_der,
|
|
132
|
-
compactDirectoryName,
|
|
133
90
|
computeDerivedKeys,
|
|
134
91
|
computePaddingFooter,
|
|
135
92
|
convertPEMtoDER,
|
|
@@ -139,6 +96,7 @@ export {
|
|
|
139
96
|
decryptBufferWithDerivedKeys,
|
|
140
97
|
derToPrivateKey,
|
|
141
98
|
encryptBufferWithDerivedKeys,
|
|
99
|
+
exploreAsn1,
|
|
142
100
|
exploreCertificate,
|
|
143
101
|
exploreCertificateInfo,
|
|
144
102
|
exploreCertificateRevocationList,
|
|
@@ -146,7 +104,6 @@ export {
|
|
|
146
104
|
explorePrivateKey,
|
|
147
105
|
extractPublicKeyFromCertificate,
|
|
148
106
|
extractPublicKeyFromCertificateSync,
|
|
149
|
-
formatBuffer2DigitHexWithColum,
|
|
150
107
|
generateKeyPair,
|
|
151
108
|
generatePrivateKey,
|
|
152
109
|
hexDump,
|
|
@@ -155,9 +112,9 @@ export {
|
|
|
155
112
|
makeMessageChunkSignature,
|
|
156
113
|
makeMessageChunkSignatureWithDerivedKeys,
|
|
157
114
|
makePrivateKeyFromPem,
|
|
115
|
+
makePrivateKeyThumbPrint,
|
|
158
116
|
makePseudoRandomBuffer,
|
|
159
117
|
makeSHA1Thumbprint,
|
|
160
|
-
parseBitString,
|
|
161
118
|
pemToPrivateKey,
|
|
162
119
|
privateDecrypt,
|
|
163
120
|
privateDecrypt_long,
|
|
@@ -169,7 +126,6 @@ export {
|
|
|
169
126
|
publicKeyAndPrivateKeyMatches,
|
|
170
127
|
readCertificationRequestInfo,
|
|
171
128
|
readNameForCrl,
|
|
172
|
-
readTag,
|
|
173
129
|
readTbsCertificate,
|
|
174
130
|
reduceLength,
|
|
175
131
|
removePadding,
|
|
@@ -9,7 +9,6 @@ declare function readCertificate(filename: string): Certificate;
|
|
|
9
9
|
* read a DER or PEM certificate from file
|
|
10
10
|
*/
|
|
11
11
|
declare function readPublicKey(filename: string): PublicKey;
|
|
12
|
-
declare function makePrivateKeyThumbPrint(privateKey: PrivateKey): Buffer;
|
|
13
12
|
/**
|
|
14
13
|
* read a DER or PEM certificate from file
|
|
15
14
|
*/
|
|
@@ -43,4 +42,4 @@ declare function generatePrivateKeyFile(privateKeyFilename: string, modulusLengt
|
|
|
43
42
|
*/
|
|
44
43
|
declare function generatePrivateKeyFileAlternate(privateKeyFilename: string, modulusLength: 2048 | 3072 | 4096): Promise<void>;
|
|
45
44
|
|
|
46
|
-
export { type CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore,
|
|
45
|
+
export { type CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore, readCertificate, readCertificatePEM, readCertificateRevocationList, readCertificateSigningRequest, readPrivateKey, readPrivateKeyPEM, readPrivateRsaKey, readPublicKey, readPublicKeyPEM, readPublicRsaKey, setCertificateStore };
|
|
@@ -9,7 +9,6 @@ declare function readCertificate(filename: string): Certificate;
|
|
|
9
9
|
* read a DER or PEM certificate from file
|
|
10
10
|
*/
|
|
11
11
|
declare function readPublicKey(filename: string): PublicKey;
|
|
12
|
-
declare function makePrivateKeyThumbPrint(privateKey: PrivateKey): Buffer;
|
|
13
12
|
/**
|
|
14
13
|
* read a DER or PEM certificate from file
|
|
15
14
|
*/
|
|
@@ -43,4 +42,4 @@ declare function generatePrivateKeyFile(privateKeyFilename: string, modulusLengt
|
|
|
43
42
|
*/
|
|
44
43
|
declare function generatePrivateKeyFileAlternate(privateKeyFilename: string, modulusLength: 2048 | 3072 | 4096): Promise<void>;
|
|
45
44
|
|
|
46
|
-
export { type CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore,
|
|
45
|
+
export { type CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore, readCertificate, readCertificatePEM, readCertificateRevocationList, readCertificateSigningRequest, readPrivateKey, readPrivateKeyPEM, readPrivateRsaKey, readPublicKey, readPublicKeyPEM, readPublicRsaKey, setCertificateStore };
|
|
@@ -33,7 +33,6 @@ __export(source_nodejs_exports, {
|
|
|
33
33
|
generatePrivateKeyFile: () => generatePrivateKeyFile,
|
|
34
34
|
generatePrivateKeyFileAlternate: () => generatePrivateKeyFileAlternate,
|
|
35
35
|
getCertificateStore: () => getCertificateStore,
|
|
36
|
-
makePrivateKeyThumbPrint: () => makePrivateKeyThumbPrint,
|
|
37
36
|
readCertificate: () => readCertificate,
|
|
38
37
|
readCertificatePEM: () => readCertificatePEM,
|
|
39
38
|
readCertificateRevocationList: () => readCertificateRevocationList,
|
|
@@ -50,8 +49,8 @@ module.exports = __toCommonJS(source_nodejs_exports);
|
|
|
50
49
|
|
|
51
50
|
// source_nodejs/read.ts
|
|
52
51
|
var import_assert4 = __toESM(require("assert"));
|
|
53
|
-
var
|
|
54
|
-
var
|
|
52
|
+
var import_node_fs = __toESM(require("fs"));
|
|
53
|
+
var import_node_path = __toESM(require("path"));
|
|
55
54
|
var import_crypto = require("crypto");
|
|
56
55
|
|
|
57
56
|
// source/crypto_utils.ts
|
|
@@ -70,8 +69,7 @@ var import_assert2 = __toESM(require("assert"));
|
|
|
70
69
|
// source/asn1.ts
|
|
71
70
|
var import_assert = __toESM(require("assert"));
|
|
72
71
|
function readTag(buf, pos) {
|
|
73
|
-
|
|
74
|
-
(0, import_assert.default)(Number.isFinite(pos) && pos >= 0);
|
|
72
|
+
const start = pos;
|
|
75
73
|
if (buf.length <= pos) {
|
|
76
74
|
throw new Error("Invalid position : buf.length=" + buf.length + " pos =" + pos);
|
|
77
75
|
}
|
|
@@ -87,7 +85,7 @@ function readTag(buf, pos) {
|
|
|
87
85
|
pos += 1;
|
|
88
86
|
}
|
|
89
87
|
}
|
|
90
|
-
return { tag, position: pos, length };
|
|
88
|
+
return { start, tag, position: pos, length };
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
// source/crypto_explore_certificate.ts
|
|
@@ -174,11 +172,11 @@ var RSA_PKCS1_PADDING = import_constants.default.RSA_PKCS1_PADDING;
|
|
|
174
172
|
var import_sshpk = __toESM(require("sshpk"));
|
|
175
173
|
function _readPemFile(filename) {
|
|
176
174
|
(0, import_assert4.default)(typeof filename === "string");
|
|
177
|
-
return removeTrailingLF(
|
|
175
|
+
return removeTrailingLF(import_node_fs.default.readFileSync(filename, "utf-8"));
|
|
178
176
|
}
|
|
179
177
|
function _readPemOrDerFileAsDER(filename) {
|
|
180
178
|
if (filename.match(/.*\.der/)) {
|
|
181
|
-
return
|
|
179
|
+
return import_node_fs.default.readFileSync(filename);
|
|
182
180
|
}
|
|
183
181
|
const raw_key = _readPemFile(filename);
|
|
184
182
|
return convertPEMtoDER(raw_key);
|
|
@@ -188,7 +186,7 @@ function readCertificate(filename) {
|
|
|
188
186
|
}
|
|
189
187
|
function readPublicKey(filename) {
|
|
190
188
|
if (filename.match(/.*\.der/)) {
|
|
191
|
-
const der =
|
|
189
|
+
const der = import_node_fs.default.readFileSync(filename);
|
|
192
190
|
return (0, import_crypto.createPublicKey)(der);
|
|
193
191
|
} else {
|
|
194
192
|
const raw_key = _readPemFile(filename);
|
|
@@ -210,15 +208,12 @@ function myCreatePrivateKey(rawKey) {
|
|
|
210
208
|
process.env.OPENSSL_CONF = backup;
|
|
211
209
|
return { hidden: retValue };
|
|
212
210
|
}
|
|
213
|
-
function makePrivateKeyThumbPrint(privateKey) {
|
|
214
|
-
return Buffer.alloc(0);
|
|
215
|
-
}
|
|
216
211
|
function ensureTrailingLF(str) {
|
|
217
212
|
return str.match(/\n$/) ? str : str + "\n";
|
|
218
213
|
}
|
|
219
214
|
function readPrivateKey(filename) {
|
|
220
215
|
if (filename.match(/.*\.der/)) {
|
|
221
|
-
const der =
|
|
216
|
+
const der = import_node_fs.default.readFileSync(filename);
|
|
222
217
|
return myCreatePrivateKey(der);
|
|
223
218
|
} else {
|
|
224
219
|
const raw_key = _readPemFile(filename);
|
|
@@ -242,7 +237,7 @@ function setCertificateStore(store) {
|
|
|
242
237
|
}
|
|
243
238
|
function getCertificateStore() {
|
|
244
239
|
if (!_g_certificate_store) {
|
|
245
|
-
_g_certificate_store =
|
|
240
|
+
_g_certificate_store = import_node_path.default.join(__dirname, "../../certificates/");
|
|
246
241
|
}
|
|
247
242
|
return _g_certificate_store;
|
|
248
243
|
}
|
|
@@ -250,30 +245,29 @@ function readPrivateRsaKey(filename) {
|
|
|
250
245
|
if (!import_crypto.createPrivateKey) {
|
|
251
246
|
throw new Error("createPrivateKey is not supported in this environment");
|
|
252
247
|
}
|
|
253
|
-
if (filename.substring(0, 1) !== "." && !
|
|
254
|
-
filename =
|
|
248
|
+
if (filename.substring(0, 1) !== "." && !import_node_fs.default.existsSync(filename)) {
|
|
249
|
+
filename = import_node_path.default.join(getCertificateStore(), filename);
|
|
255
250
|
}
|
|
256
|
-
const content =
|
|
251
|
+
const content = import_node_fs.default.readFileSync(filename, "utf8");
|
|
257
252
|
const sshKey = import_sshpk.default.parsePrivateKey(content, "auto");
|
|
258
253
|
const key = sshKey.toString("pkcs1");
|
|
259
254
|
const hidden = (0, import_crypto.createPrivateKey)({ format: "pem", type: "pkcs1", key });
|
|
260
255
|
return { hidden };
|
|
261
256
|
}
|
|
262
257
|
function readPublicRsaKey(filename) {
|
|
263
|
-
if (filename.substring(0, 1) !== "." && !
|
|
264
|
-
filename =
|
|
258
|
+
if (filename.substring(0, 1) !== "." && !import_node_fs.default.existsSync(filename)) {
|
|
259
|
+
filename = import_node_path.default.join(getCertificateStore(), filename);
|
|
265
260
|
}
|
|
266
|
-
const content =
|
|
261
|
+
const content = import_node_fs.default.readFileSync(filename, "utf-8");
|
|
267
262
|
const sshKey = import_sshpk.default.parseKey(content, "ssh");
|
|
268
263
|
const key = sshKey.toString("pkcs1");
|
|
269
264
|
return (0, import_crypto.createPublicKey)({ format: "pem", type: "pkcs1", key });
|
|
270
265
|
}
|
|
271
266
|
|
|
272
267
|
// source_nodejs/read_certificate_revocation_list.ts
|
|
273
|
-
var
|
|
274
|
-
var import_util = require("util");
|
|
268
|
+
var import_node_fs2 = __toESM(require("fs"));
|
|
275
269
|
async function readCertificateRevocationList(filename) {
|
|
276
|
-
const crl = await
|
|
270
|
+
const crl = await import_node_fs2.default.promises.readFile(filename);
|
|
277
271
|
if (crl[0] === 48 && crl[1] === 130) {
|
|
278
272
|
return crl;
|
|
279
273
|
}
|
|
@@ -282,10 +276,9 @@ async function readCertificateRevocationList(filename) {
|
|
|
282
276
|
}
|
|
283
277
|
|
|
284
278
|
// source_nodejs/read_certificate_signing_request.ts
|
|
285
|
-
var
|
|
286
|
-
var import_util2 = require("util");
|
|
279
|
+
var import_node_fs3 = __toESM(require("fs"));
|
|
287
280
|
async function readCertificateSigningRequest(filename) {
|
|
288
|
-
const csr = await
|
|
281
|
+
const csr = await import_node_fs3.default.promises.readFile(filename);
|
|
289
282
|
if (csr[0] === 48 && csr[1] === 130) {
|
|
290
283
|
return csr;
|
|
291
284
|
}
|
|
@@ -294,25 +287,25 @@ async function readCertificateSigningRequest(filename) {
|
|
|
294
287
|
}
|
|
295
288
|
|
|
296
289
|
// source_nodejs/generate_private_key_filename.ts
|
|
297
|
-
var
|
|
290
|
+
var import_node_fs4 = __toESM(require("fs"));
|
|
291
|
+
|
|
292
|
+
// source/explore_private_key.ts
|
|
293
|
+
var doDebug = !!process.env.DEBUG;
|
|
298
294
|
|
|
299
295
|
// source/common.ts
|
|
300
296
|
var import_crypto2 = __toESM(require("crypto"));
|
|
301
297
|
var KeyObjectOrig = import_crypto2.default.KeyObject;
|
|
302
298
|
var { createPrivateKey: createPrivateKeyFromNodeJSCrypto } = import_crypto2.default;
|
|
303
299
|
|
|
304
|
-
// source/
|
|
305
|
-
var import_assert6 = __toESM(require("assert"));
|
|
306
|
-
|
|
307
|
-
// source/explore_certificate.ts
|
|
300
|
+
// source/crypto_utils2.ts
|
|
308
301
|
var import_assert5 = __toESM(require("assert"));
|
|
302
|
+
var import_jsrsasign2 = __toESM(require("jsrsasign"));
|
|
309
303
|
|
|
310
|
-
// source/
|
|
304
|
+
// source/derived_keys.ts
|
|
311
305
|
var import_assert7 = __toESM(require("assert"));
|
|
312
|
-
var import_jsrsasign2 = __toESM(require("jsrsasign"));
|
|
313
306
|
|
|
314
|
-
// source/
|
|
315
|
-
var
|
|
307
|
+
// source/explore_certificate.ts
|
|
308
|
+
var import_assert6 = __toESM(require("assert"));
|
|
316
309
|
|
|
317
310
|
// source/x509/_crypto.ts
|
|
318
311
|
var x509 = __toESM(require("@peculiar/x509"));
|
|
@@ -359,6 +352,9 @@ async function privateKeyToPEM(privateKey) {
|
|
|
359
352
|
return { privPem, privDer };
|
|
360
353
|
}
|
|
361
354
|
|
|
355
|
+
// source/x509/coerce_private_key.ts
|
|
356
|
+
var crypto2 = getCrypto();
|
|
357
|
+
|
|
362
358
|
// source/x509/_get_attributes.ts
|
|
363
359
|
var keyUsageApplication = x5092.KeyUsageFlags.keyEncipherment | x5092.KeyUsageFlags.nonRepudiation | x5092.KeyUsageFlags.dataEncipherment | x5092.KeyUsageFlags.keyCertSign | x5092.KeyUsageFlags.digitalSignature;
|
|
364
360
|
var keyUsageCA = x5092.KeyUsageFlags.keyCertSign | x5092.KeyUsageFlags.cRLSign;
|
|
@@ -4064,15 +4060,12 @@ var AsnSchemaStorage = class {
|
|
|
4064
4060
|
// ../../node_modules/@peculiar/asn1-schema/build/es2015/storage.js
|
|
4065
4061
|
var schemaStorage = new AsnSchemaStorage();
|
|
4066
4062
|
|
|
4067
|
-
// source/x509/coerce_private_key.ts
|
|
4068
|
-
var crypto2 = getCrypto();
|
|
4069
|
-
|
|
4070
4063
|
// source_nodejs/generate_private_key_filename.ts
|
|
4071
4064
|
var import_jsrsasign3 = __toESM(require("jsrsasign"));
|
|
4072
4065
|
async function generatePrivateKeyFile(privateKeyFilename, modulusLength) {
|
|
4073
4066
|
const keys = await generateKeyPair(modulusLength);
|
|
4074
4067
|
const privateKeyPem = await privateKeyToPEM(keys.privateKey);
|
|
4075
|
-
await
|
|
4068
|
+
await import_node_fs4.default.promises.writeFile(privateKeyFilename, privateKeyPem.privPem, "utf-8");
|
|
4076
4069
|
privateKeyPem.privPem = "";
|
|
4077
4070
|
privateKeyPem.privDer = new Uint8Array(0);
|
|
4078
4071
|
}
|
|
@@ -4081,14 +4074,13 @@ async function generatePrivateKeyFileAlternate(privateKeyFilename, modulusLength
|
|
|
4081
4074
|
const prv = kp.prvKeyObj;
|
|
4082
4075
|
const pub = kp.pubKeyObj;
|
|
4083
4076
|
const prvpem = import_jsrsasign3.default.KEYUTIL.getPEM(prv, "PKCS8PRV");
|
|
4084
|
-
await
|
|
4077
|
+
await import_node_fs4.default.promises.writeFile(privateKeyFilename, prvpem, "utf-8");
|
|
4085
4078
|
}
|
|
4086
4079
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4087
4080
|
0 && (module.exports = {
|
|
4088
4081
|
generatePrivateKeyFile,
|
|
4089
4082
|
generatePrivateKeyFileAlternate,
|
|
4090
4083
|
getCertificateStore,
|
|
4091
|
-
makePrivateKeyThumbPrint,
|
|
4092
4084
|
readCertificate,
|
|
4093
4085
|
readCertificatePEM,
|
|
4094
4086
|
readCertificateRevocationList,
|