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
package/dist/source/index.mjs
CHANGED
package/dist/source/index_web.js
CHANGED
|
@@ -1037,7 +1037,7 @@ function readTbsCertificate(buffer, block) {
|
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
1039
|
function exploreCertificate(certificate) {
|
|
1040
|
-
(0, import_assert3.default)(certificate
|
|
1040
|
+
(0, import_assert3.default)(Buffer.isBuffer(certificate));
|
|
1041
1041
|
if (!certificate._exploreCertificate_cache) {
|
|
1042
1042
|
const block_info = readTag(certificate, 0);
|
|
1043
1043
|
const blocks = readStruct(certificate, block_info);
|
|
@@ -1080,7 +1080,7 @@ var { hexy } = import_hexy.default;
|
|
|
1080
1080
|
var PEM_REGEX = /^(-----BEGIN (.*)-----\r?\n([/+=a-zA-Z0-9\r\n]*)\r?\n-----END \2-----\r?\n?)/gm;
|
|
1081
1081
|
var PEM_TYPE_REGEX = /^(-----BEGIN (.*)-----)/m;
|
|
1082
1082
|
function identifyPemType(rawKey) {
|
|
1083
|
-
if (rawKey
|
|
1083
|
+
if (Buffer.isBuffer(rawKey)) {
|
|
1084
1084
|
rawKey = rawKey.toString("utf8");
|
|
1085
1085
|
}
|
|
1086
1086
|
const match = PEM_TYPE_REGEX.exec(rawKey);
|
|
@@ -1095,7 +1095,7 @@ function toPem(raw_key, pem) {
|
|
|
1095
1095
|
(0, import_assert4.default)(typeof pem === "string");
|
|
1096
1096
|
let pemType = identifyPemType(raw_key);
|
|
1097
1097
|
if (pemType) {
|
|
1098
|
-
return raw_key
|
|
1098
|
+
return Buffer.isBuffer(raw_key) ? removeTrailingLF(raw_key.toString("utf8")) : removeTrailingLF(raw_key);
|
|
1099
1099
|
} else {
|
|
1100
1100
|
pemType = pem;
|
|
1101
1101
|
(0, import_assert4.default)(["CERTIFICATE REQUEST", "CERTIFICATE", "RSA PRIVATE KEY", "PUBLIC KEY", "X509 CRL"].indexOf(pemType) >= 0);
|
|
@@ -1231,7 +1231,7 @@ function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
|
|
|
1231
1231
|
return outputBuffer.subarray(0, total_length);
|
|
1232
1232
|
}
|
|
1233
1233
|
function coerceCertificatePem(certificate) {
|
|
1234
|
-
if (certificate
|
|
1234
|
+
if (Buffer.isBuffer(certificate)) {
|
|
1235
1235
|
certificate = toPem(certificate, "CERTIFICATE");
|
|
1236
1236
|
}
|
|
1237
1237
|
(0, import_assert4.default)(typeof certificate === "string");
|
|
@@ -1442,7 +1442,7 @@ function coerceCertificate(certificate) {
|
|
|
1442
1442
|
if (typeof certificate === "string") {
|
|
1443
1443
|
certificate = convertPEMtoDER(certificate);
|
|
1444
1444
|
}
|
|
1445
|
-
(0, import_assert6.default)(certificate
|
|
1445
|
+
(0, import_assert6.default)(Buffer.isBuffer(certificate));
|
|
1446
1446
|
return certificate;
|
|
1447
1447
|
}
|
|
1448
1448
|
function exploreCertificateInfo(certificate) {
|
|
@@ -1469,7 +1469,7 @@ function plus(buf1, buf2) {
|
|
|
1469
1469
|
return Buffer.concat([buf1, buf2]);
|
|
1470
1470
|
}
|
|
1471
1471
|
function makePseudoRandomBuffer(secret, seed, minLength, sha1or256) {
|
|
1472
|
-
(0, import_assert7.default)(seed
|
|
1472
|
+
(0, import_assert7.default)(Buffer.isBuffer(seed));
|
|
1473
1473
|
(0, import_assert7.default)(sha1or256 === "SHA1" || sha1or256 === "SHA256");
|
|
1474
1474
|
const a = [];
|
|
1475
1475
|
a[0] = seed;
|
|
@@ -1513,7 +1513,7 @@ function removePadding(buffer) {
|
|
|
1513
1513
|
return reduceLength(buffer, nbPaddingBytes);
|
|
1514
1514
|
}
|
|
1515
1515
|
function verifyChunkSignature(chunk, options) {
|
|
1516
|
-
(0, import_assert7.default)(chunk
|
|
1516
|
+
(0, import_assert7.default)(Buffer.isBuffer(chunk));
|
|
1517
1517
|
let signatureLength = options.signatureLength || 0;
|
|
1518
1518
|
if (signatureLength === 0) {
|
|
1519
1519
|
const cert = exploreCertificateInfo(options.publicKey);
|
|
@@ -1559,8 +1559,8 @@ function decryptBufferWithDerivedKeys(buffer, derivedKeys) {
|
|
|
1559
1559
|
return Buffer.concat(decrypted_chunks);
|
|
1560
1560
|
}
|
|
1561
1561
|
function makeMessageChunkSignatureWithDerivedKeys(message, derivedKeys) {
|
|
1562
|
-
(0, import_assert7.default)(message
|
|
1563
|
-
(0, import_assert7.default)(derivedKeys.signingKey
|
|
1562
|
+
(0, import_assert7.default)(Buffer.isBuffer(message));
|
|
1563
|
+
(0, import_assert7.default)(Buffer.isBuffer(derivedKeys.signingKey));
|
|
1564
1564
|
(0, import_assert7.default)(typeof derivedKeys.sha1or256 === "string");
|
|
1565
1565
|
(0, import_assert7.default)(derivedKeys.sha1or256 === "SHA1" || derivedKeys.sha1or256 === "SHA256");
|
|
1566
1566
|
const signature = (0, import_crypto3.createHmac)(derivedKeys.sha1or256, derivedKeys.signingKey).update(message).digest();
|
|
@@ -1948,7 +1948,7 @@ function coercePEMorDerToPrivateKey(privateKeyInDerOrPem) {
|
|
|
1948
1948
|
}
|
|
1949
1949
|
async function _coercePrivateKey(privateKey) {
|
|
1950
1950
|
const KeyObject4 = crypto2.KeyObject;
|
|
1951
|
-
if (privateKey
|
|
1951
|
+
if (Buffer.isBuffer(privateKey)) {
|
|
1952
1952
|
const privateKey1 = await derToPrivateKey(privateKey);
|
|
1953
1953
|
return KeyObject4.from(privateKey1);
|
|
1954
1954
|
} else if (typeof privateKey === "string") {
|