node-opcua-crypto 4.17.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-EURHGMEG.mjs → chunk-ULG5CYBT.mjs} +164 -143
- package/dist/chunk-ULG5CYBT.mjs.map +1 -0
- package/dist/{chunk-CQ5JIXZF.mjs → chunk-UXPULF3W.mjs} +9 -8
- package/dist/chunk-UXPULF3W.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +181 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/source/index.d.mts +1 -1
- package/dist/source/index.d.ts +1 -1
- package/dist/source/index.js +166 -144
- package/dist/source/index.js.map +1 -1
- package/dist/source/index.mjs +5 -1
- package/dist/source/index_web.d.mts +38 -4
- package/dist/source/index_web.d.ts +38 -4
- package/dist/source/index_web.js +166 -144
- package/dist/source/index_web.js.map +1 -1
- package/dist/source/index_web.mjs +5 -1
- package/dist/source_nodejs/index.d.mts +2 -1
- package/dist/source_nodejs/index.d.ts +2 -1
- package/dist/source_nodejs/index.js +23 -23
- package/dist/source_nodejs/index.js.map +1 -1
- package/dist/source_nodejs/index.mjs +2 -2
- package/package.json +4 -8
- package/dist/chunk-CQ5JIXZF.mjs.map +0 -1
- package/dist/chunk-EURHGMEG.mjs.map +0 -1
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
generatePrivateKey,
|
|
36
36
|
hexDump,
|
|
37
37
|
identifyPemType,
|
|
38
|
+
isCrlIssuedByCertificate,
|
|
38
39
|
isKeyObject,
|
|
39
40
|
makeMessageChunkSignature,
|
|
40
41
|
makeMessageChunkSignatureWithDerivedKeys,
|
|
@@ -70,8 +71,9 @@ import {
|
|
|
70
71
|
verifyCertificateSignature,
|
|
71
72
|
verifyChunkSignature,
|
|
72
73
|
verifyChunkSignatureWithDerivedKeys,
|
|
74
|
+
verifyCrlIssuedByCertificate,
|
|
73
75
|
verifyMessageChunkSignature
|
|
74
|
-
} from "../chunk-
|
|
76
|
+
} from "../chunk-ULG5CYBT.mjs";
|
|
75
77
|
export {
|
|
76
78
|
CertificatePurpose,
|
|
77
79
|
PaddingAlgorithm,
|
|
@@ -109,6 +111,7 @@ export {
|
|
|
109
111
|
generatePrivateKey,
|
|
110
112
|
hexDump,
|
|
111
113
|
identifyPemType,
|
|
114
|
+
isCrlIssuedByCertificate,
|
|
112
115
|
isKeyObject,
|
|
113
116
|
makeMessageChunkSignature,
|
|
114
117
|
makeMessageChunkSignatureWithDerivedKeys,
|
|
@@ -144,6 +147,7 @@ export {
|
|
|
144
147
|
verifyCertificateSignature,
|
|
145
148
|
verifyChunkSignature,
|
|
146
149
|
verifyChunkSignatureWithDerivedKeys,
|
|
150
|
+
verifyCrlIssuedByCertificate,
|
|
147
151
|
verifyMessageChunkSignature
|
|
148
152
|
};
|
|
149
153
|
//# sourceMappingURL=index_web.mjs.map
|
|
@@ -3,7 +3,8 @@ import 'node:crypto';
|
|
|
3
3
|
|
|
4
4
|
declare function generatePrivateKeyFile(privateKeyFilename: string, modulusLength: 1024 | 2048 | 3072 | 4096): Promise<void>;
|
|
5
5
|
/**
|
|
6
|
-
* alternate function to generate PrivateKeyFile, using
|
|
6
|
+
* alternate function to generate PrivateKeyFile, using native
|
|
7
|
+
* node:crypto.
|
|
7
8
|
*
|
|
8
9
|
* This function is slower than generatePrivateKeyFile
|
|
9
10
|
*/
|
|
@@ -3,7 +3,8 @@ import 'node:crypto';
|
|
|
3
3
|
|
|
4
4
|
declare function generatePrivateKeyFile(privateKeyFilename: string, modulusLength: 1024 | 2048 | 3072 | 4096): Promise<void>;
|
|
5
5
|
/**
|
|
6
|
-
* alternate function to generate PrivateKeyFile, using
|
|
6
|
+
* alternate function to generate PrivateKeyFile, using native
|
|
7
|
+
* node:crypto.
|
|
7
8
|
*
|
|
8
9
|
* This function is slower than generatePrivateKeyFile
|
|
9
10
|
*/
|
|
@@ -48,8 +48,8 @@ __export(source_nodejs_exports, {
|
|
|
48
48
|
module.exports = __toCommonJS(source_nodejs_exports);
|
|
49
49
|
|
|
50
50
|
// source_nodejs/generate_private_key_filename.ts
|
|
51
|
+
var import_node_crypto7 = require("crypto");
|
|
51
52
|
var import_node_fs = __toESM(require("fs"));
|
|
52
|
-
var import_jsrsasign3 = __toESM(require("jsrsasign"));
|
|
53
53
|
|
|
54
54
|
// source/common.ts
|
|
55
55
|
var import_node_crypto = __toESM(require("crypto"));
|
|
@@ -85,7 +85,6 @@ function readTag(buf, pos) {
|
|
|
85
85
|
var import_node_assert2 = __toESM(require("assert"));
|
|
86
86
|
var import_node_constants = __toESM(require("constants"));
|
|
87
87
|
var import_node_crypto2 = require("crypto");
|
|
88
|
-
var import_jsrsasign = __toESM(require("jsrsasign"));
|
|
89
88
|
|
|
90
89
|
// source/buffer_utils.ts
|
|
91
90
|
var createFastUninitializedBuffer = Buffer.allocUnsafe ? Buffer.allocUnsafe : (size) => {
|
|
@@ -177,13 +176,16 @@ function combine_der(certificates) {
|
|
|
177
176
|
return Buffer.concat(certificates);
|
|
178
177
|
}
|
|
179
178
|
|
|
179
|
+
// source/verify_certificate_signature.ts
|
|
180
|
+
var import_node_crypto3 = require("crypto");
|
|
181
|
+
|
|
180
182
|
// source/crypto_utils2.ts
|
|
181
183
|
var import_node_assert5 = __toESM(require("assert"));
|
|
182
|
-
var
|
|
184
|
+
var import_node_crypto4 = require("crypto");
|
|
183
185
|
|
|
184
186
|
// source/derived_keys.ts
|
|
185
187
|
var import_node_assert7 = __toESM(require("assert"));
|
|
186
|
-
var
|
|
188
|
+
var import_node_crypto5 = require("crypto");
|
|
187
189
|
|
|
188
190
|
// source/explore_certificate.ts
|
|
189
191
|
var import_node_assert6 = __toESM(require("assert"));
|
|
@@ -191,11 +193,8 @@ var import_node_assert6 = __toESM(require("assert"));
|
|
|
191
193
|
// source/explore_private_key.ts
|
|
192
194
|
var doDebug = !!process.env.DEBUG;
|
|
193
195
|
|
|
194
|
-
// source/verify_certificate_signature.ts
|
|
195
|
-
var import_node_crypto4 = require("crypto");
|
|
196
|
-
|
|
197
196
|
// source/x509/_crypto.ts
|
|
198
|
-
var
|
|
197
|
+
var import_node_crypto6 = __toESM(require("crypto"));
|
|
199
198
|
var import_webcrypto = require("@peculiar/webcrypto");
|
|
200
199
|
var x509 = __toESM(require("@peculiar/x509"));
|
|
201
200
|
var x5092 = __toESM(require("@peculiar/x509"));
|
|
@@ -203,7 +202,7 @@ var doDebug2 = false;
|
|
|
203
202
|
var _crypto;
|
|
204
203
|
var ignoreCrypto = process.env.IGNORE_SUBTLE_FROM_CRYPTO;
|
|
205
204
|
if (typeof window === "undefined") {
|
|
206
|
-
_crypto =
|
|
205
|
+
_crypto = import_node_crypto6.default;
|
|
207
206
|
if (!_crypto?.subtle || ignoreCrypto) {
|
|
208
207
|
_crypto = new import_webcrypto.Crypto();
|
|
209
208
|
doDebug2 && console.warn("using @peculiar/webcrypto");
|
|
@@ -217,7 +216,7 @@ if (typeof window === "undefined") {
|
|
|
217
216
|
x509.cryptoProvider.set(crypto);
|
|
218
217
|
}
|
|
219
218
|
function getCrypto() {
|
|
220
|
-
return _crypto || crypto ||
|
|
219
|
+
return _crypto || crypto || import_node_crypto6.default;
|
|
221
220
|
}
|
|
222
221
|
|
|
223
222
|
// source/x509/create_key_pair.ts
|
|
@@ -3939,16 +3938,17 @@ async function generatePrivateKeyFile(privateKeyFilename, modulusLength) {
|
|
|
3939
3938
|
privateKeyPem.privDer = new ArrayBuffer(0);
|
|
3940
3939
|
}
|
|
3941
3940
|
async function generatePrivateKeyFileAlternate(privateKeyFilename, modulusLength) {
|
|
3942
|
-
const
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3941
|
+
const { privateKey } = (0, import_node_crypto7.generateKeyPairSync)("rsa", {
|
|
3942
|
+
modulusLength,
|
|
3943
|
+
privateKeyEncoding: { type: "pkcs8", format: "pem" },
|
|
3944
|
+
publicKeyEncoding: { type: "spki", format: "pem" }
|
|
3945
|
+
});
|
|
3946
|
+
await import_node_fs.default.promises.writeFile(privateKeyFilename, privateKey, "utf-8");
|
|
3947
3947
|
}
|
|
3948
3948
|
|
|
3949
3949
|
// source_nodejs/read.ts
|
|
3950
3950
|
var import_node_assert8 = __toESM(require("assert"));
|
|
3951
|
-
var
|
|
3951
|
+
var import_node_crypto8 = require("crypto");
|
|
3952
3952
|
var import_node_fs2 = __toESM(require("fs"));
|
|
3953
3953
|
var import_node_path = __toESM(require("path"));
|
|
3954
3954
|
var import_sshpk = __toESM(require("sshpk"));
|
|
@@ -3969,14 +3969,14 @@ function readCertificate(filename) {
|
|
|
3969
3969
|
function readPublicKey(filename) {
|
|
3970
3970
|
if (filename.match(/.*\.der/)) {
|
|
3971
3971
|
const der = import_node_fs2.default.readFileSync(filename);
|
|
3972
|
-
return (0,
|
|
3972
|
+
return (0, import_node_crypto8.createPublicKey)(der);
|
|
3973
3973
|
} else {
|
|
3974
3974
|
const raw_key = _readPemFile(filename);
|
|
3975
|
-
return (0,
|
|
3975
|
+
return (0, import_node_crypto8.createPublicKey)(raw_key);
|
|
3976
3976
|
}
|
|
3977
3977
|
}
|
|
3978
3978
|
function myCreatePrivateKey(rawKey) {
|
|
3979
|
-
if (!
|
|
3979
|
+
if (!import_node_crypto8.createPrivateKey || process.env.NO_CREATE_PRIVATEKEY) {
|
|
3980
3980
|
if (Buffer.isBuffer(rawKey)) {
|
|
3981
3981
|
const pemKey = toPem(rawKey, "PRIVATE KEY");
|
|
3982
3982
|
(0, import_node_assert8.default)(["RSA PRIVATE KEY", "PRIVATE KEY"].indexOf(identifyPemType(pemKey)) >= 0);
|
|
@@ -3986,7 +3986,7 @@ function myCreatePrivateKey(rawKey) {
|
|
|
3986
3986
|
}
|
|
3987
3987
|
const backup = process.env.OPENSSL_CONF;
|
|
3988
3988
|
process.env.OPENSSL_CONF = "/dev/null";
|
|
3989
|
-
const retValue = (0,
|
|
3989
|
+
const retValue = (0, import_node_crypto8.createPrivateKey)(rawKey);
|
|
3990
3990
|
process.env.OPENSSL_CONF = backup;
|
|
3991
3991
|
return { hidden: retValue };
|
|
3992
3992
|
}
|
|
@@ -4025,7 +4025,7 @@ function getCertificateStore() {
|
|
|
4025
4025
|
return _g_certificate_store;
|
|
4026
4026
|
}
|
|
4027
4027
|
function readPrivateRsaKey(filename) {
|
|
4028
|
-
if (!
|
|
4028
|
+
if (!import_node_crypto8.createPrivateKey) {
|
|
4029
4029
|
throw new Error("createPrivateKey is not supported in this environment");
|
|
4030
4030
|
}
|
|
4031
4031
|
if (filename.substring(0, 1) !== "." && !import_node_fs2.default.existsSync(filename)) {
|
|
@@ -4034,7 +4034,7 @@ function readPrivateRsaKey(filename) {
|
|
|
4034
4034
|
const content = import_node_fs2.default.readFileSync(filename, "utf8");
|
|
4035
4035
|
const sshKey = import_sshpk.default.parsePrivateKey(content, "auto");
|
|
4036
4036
|
const key = sshKey.toString("pkcs1");
|
|
4037
|
-
const hidden = (0,
|
|
4037
|
+
const hidden = (0, import_node_crypto8.createPrivateKey)({ format: "pem", type: "pkcs1", key });
|
|
4038
4038
|
return { hidden };
|
|
4039
4039
|
}
|
|
4040
4040
|
function readPublicRsaKey(filename) {
|
|
@@ -4044,7 +4044,7 @@ function readPublicRsaKey(filename) {
|
|
|
4044
4044
|
const content = import_node_fs2.default.readFileSync(filename, "utf-8");
|
|
4045
4045
|
const sshKey = import_sshpk.default.parseKey(content, "ssh");
|
|
4046
4046
|
const key = sshKey.toString("pkcs1");
|
|
4047
|
-
return (0,
|
|
4047
|
+
return (0, import_node_crypto8.createPublicKey)({ format: "pem", type: "pkcs1", key });
|
|
4048
4048
|
}
|
|
4049
4049
|
|
|
4050
4050
|
// source_nodejs/read_certificate_revocation_list.ts
|