node-opcua-crypto 4.12.0 → 4.16.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/README.md +15 -20
- package/dist/{chunk-LHUQUHQQ.mjs → chunk-F5EAPW2U.mjs} +11 -11
- package/dist/chunk-F5EAPW2U.mjs.map +1 -0
- package/dist/{chunk-AXAFLVME.mjs → chunk-XPM4YIBT.mjs} +4 -4
- package/dist/chunk-XPM4YIBT.mjs.map +1 -0
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/source/index.js +10 -10
- package/dist/source/index.js.map +1 -1
- package/dist/source/index.mjs +1 -1
- package/dist/source/index_web.js +10 -10
- package/dist/source/index_web.js.map +1 -1
- package/dist/source/index_web.mjs +1 -1
- package/dist/source_nodejs/index.js +4 -4
- package/dist/source_nodejs/index.js.map +1 -1
- package/dist/source_nodejs/index.mjs +2 -2
- package/package.json +4 -4
- package/dist/chunk-AXAFLVME.mjs.map +0 -1
- package/dist/chunk-LHUQUHQQ.mjs.map +0 -1
|
@@ -123,7 +123,7 @@ var { hexy } = import_hexy.default;
|
|
|
123
123
|
var PEM_REGEX = /^(-----BEGIN (.*)-----\r?\n([/+=a-zA-Z0-9\r\n]*)\r?\n-----END \2-----\r?\n?)/gm;
|
|
124
124
|
var PEM_TYPE_REGEX = /^(-----BEGIN (.*)-----)/m;
|
|
125
125
|
function identifyPemType(rawKey) {
|
|
126
|
-
if (rawKey
|
|
126
|
+
if (Buffer.isBuffer(rawKey)) {
|
|
127
127
|
rawKey = rawKey.toString("utf8");
|
|
128
128
|
}
|
|
129
129
|
const match = PEM_TYPE_REGEX.exec(rawKey);
|
|
@@ -138,7 +138,7 @@ function toPem(raw_key, pem) {
|
|
|
138
138
|
(0, import_assert4.default)(typeof pem === "string");
|
|
139
139
|
let pemType = identifyPemType(raw_key);
|
|
140
140
|
if (pemType) {
|
|
141
|
-
return raw_key
|
|
141
|
+
return Buffer.isBuffer(raw_key) ? removeTrailingLF(raw_key.toString("utf8")) : removeTrailingLF(raw_key);
|
|
142
142
|
} else {
|
|
143
143
|
pemType = pem;
|
|
144
144
|
(0, import_assert4.default)(["CERTIFICATE REQUEST", "CERTIFICATE", "RSA PRIVATE KEY", "PUBLIC KEY", "X509 CRL"].indexOf(pemType) >= 0);
|
|
@@ -198,7 +198,7 @@ function readPublicKey(filename) {
|
|
|
198
198
|
}
|
|
199
199
|
function myCreatePrivateKey(rawKey) {
|
|
200
200
|
if (!import_crypto.createPrivateKey || process.env.NO_CREATE_PRIVATEKEY) {
|
|
201
|
-
if (rawKey
|
|
201
|
+
if (Buffer.isBuffer(rawKey)) {
|
|
202
202
|
const pemKey = toPem(rawKey, "PRIVATE KEY");
|
|
203
203
|
(0, import_assert5.default)(["RSA PRIVATE KEY", "PRIVATE KEY"].indexOf(identifyPemType(pemKey)) >= 0);
|
|
204
204
|
return { hidden: pemKey };
|
|
@@ -4070,7 +4070,7 @@ async function generatePrivateKeyFile(privateKeyFilename, modulusLength) {
|
|
|
4070
4070
|
const privateKeyPem = await privateKeyToPEM(keys.privateKey);
|
|
4071
4071
|
await import_node_fs4.default.promises.writeFile(privateKeyFilename, privateKeyPem.privPem, "utf-8");
|
|
4072
4072
|
privateKeyPem.privPem = "";
|
|
4073
|
-
privateKeyPem.privDer = new
|
|
4073
|
+
privateKeyPem.privDer = new ArrayBuffer(0);
|
|
4074
4074
|
}
|
|
4075
4075
|
async function generatePrivateKeyFileAlternate(privateKeyFilename, modulusLength) {
|
|
4076
4076
|
const kp = import_jsrsasign3.default.KEYUTIL.generateKeypair("RSA", modulusLength);
|