node-opcua-crypto 4.7.0 → 4.8.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.
@@ -6,7 +6,7 @@ import {
6
6
  privateKeyToPEM,
7
7
  removeTrailingLF,
8
8
  toPem
9
- } from "./chunk-PET55CDS.mjs";
9
+ } from "./chunk-XIYZLEAS.mjs";
10
10
 
11
11
  // source_nodejs/read.ts
12
12
  import assert from "assert";
@@ -170,4 +170,4 @@ export {
170
170
  generatePrivateKeyFile,
171
171
  generatePrivateKeyFileAlternate
172
172
  };
173
- //# sourceMappingURL=chunk-2LYR7MB3.mjs.map
173
+ //# sourceMappingURL=chunk-AKMXF5ZH.mjs.map
@@ -714,7 +714,7 @@ assert2(4 /* RSA_PKCS1_OAEP_PADDING */ === constants.RSA_PKCS1_OAEP_PADDING);
714
714
  assert2(1 /* RSA_PKCS1_PADDING */ === constants.RSA_PKCS1_PADDING);
715
715
  function publicEncrypt_native(buffer, publicKey, algorithm) {
716
716
  if (algorithm === void 0) {
717
- algorithm = 1 /* RSA_PKCS1_PADDING */;
717
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
718
718
  }
719
719
  return publicEncrypt1(
720
720
  {
@@ -726,7 +726,7 @@ function publicEncrypt_native(buffer, publicKey, algorithm) {
726
726
  }
727
727
  function privateDecrypt_native(buffer, privateKey, algorithm) {
728
728
  if (algorithm === void 0) {
729
- algorithm = 1 /* RSA_PKCS1_PADDING */;
729
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
730
730
  }
731
731
  try {
732
732
  return privateDecrypt1(
@@ -744,9 +744,17 @@ var publicEncrypt = publicEncrypt_native;
744
744
  var privateDecrypt = privateDecrypt_native;
745
745
  function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgorithm) {
746
746
  if (paddingAlgorithm === void 0) {
747
- paddingAlgorithm = 1 /* RSA_PKCS1_PADDING */;
748
- }
749
- if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
747
+ paddingAlgorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
748
+ }
749
+ if (paddingAlgorithm === RSA_PKCS1_PADDING) {
750
+ padding = padding || 11;
751
+ if (padding !== 11)
752
+ throw new Error("padding should be 11");
753
+ } else if (paddingAlgorithm === RSA_PKCS1_OAEP_PADDING) {
754
+ padding = padding || 42;
755
+ if (padding !== 42)
756
+ throw new Error("padding should be 42");
757
+ } else {
750
758
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
751
759
  }
752
760
  const chunk_size = blockSize - padding;
@@ -763,7 +771,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
763
771
  return outputBuffer;
764
772
  }
765
773
  function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
766
- paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_PADDING;
774
+ paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_OAEP_PADDING;
767
775
  if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
768
776
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
769
777
  }
@@ -1617,7 +1625,7 @@ function publicKeyAndPrivateKeyMatches(certificate, privateKey) {
1617
1625
  }
1618
1626
  function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
1619
1627
  const initialBuffer = Buffer.from("Lorem Ipsum");
1620
- const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize, 11);
1628
+ const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
1621
1629
  const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
1622
1630
  const finalString = decryptedBuffer.toString("utf-8");
1623
1631
  return initialBuffer.toString("utf-8") === finalString;
@@ -6253,4 +6261,4 @@ asn1js/build/index.es.js:
6253
6261
  *
6254
6262
  *)
6255
6263
  */
6256
- //# sourceMappingURL=chunk-PET55CDS.mjs.map
6264
+ //# sourceMappingURL=chunk-XIYZLEAS.mjs.map
package/dist/index.js CHANGED
@@ -1198,7 +1198,7 @@ var PaddingAlgorithm = /* @__PURE__ */ ((PaddingAlgorithm2) => {
1198
1198
  (0, import_assert3.default)(1 /* RSA_PKCS1_PADDING */ === import_constants.default.RSA_PKCS1_PADDING);
1199
1199
  function publicEncrypt_native(buffer, publicKey, algorithm) {
1200
1200
  if (algorithm === void 0) {
1201
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1201
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1202
1202
  }
1203
1203
  return (0, import_crypto2.publicEncrypt)(
1204
1204
  {
@@ -1210,7 +1210,7 @@ function publicEncrypt_native(buffer, publicKey, algorithm) {
1210
1210
  }
1211
1211
  function privateDecrypt_native(buffer, privateKey, algorithm) {
1212
1212
  if (algorithm === void 0) {
1213
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1213
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1214
1214
  }
1215
1215
  try {
1216
1216
  return (0, import_crypto2.privateDecrypt)(
@@ -1228,9 +1228,17 @@ var publicEncrypt = publicEncrypt_native;
1228
1228
  var privateDecrypt = privateDecrypt_native;
1229
1229
  function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgorithm) {
1230
1230
  if (paddingAlgorithm === void 0) {
1231
- paddingAlgorithm = 1 /* RSA_PKCS1_PADDING */;
1232
- }
1233
- if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1231
+ paddingAlgorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1232
+ }
1233
+ if (paddingAlgorithm === RSA_PKCS1_PADDING) {
1234
+ padding = padding || 11;
1235
+ if (padding !== 11)
1236
+ throw new Error("padding should be 11");
1237
+ } else if (paddingAlgorithm === RSA_PKCS1_OAEP_PADDING) {
1238
+ padding = padding || 42;
1239
+ if (padding !== 42)
1240
+ throw new Error("padding should be 42");
1241
+ } else {
1234
1242
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1235
1243
  }
1236
1244
  const chunk_size = blockSize - padding;
@@ -1247,7 +1255,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
1247
1255
  return outputBuffer;
1248
1256
  }
1249
1257
  function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
1250
- paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_PADDING;
1258
+ paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_OAEP_PADDING;
1251
1259
  if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1252
1260
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1253
1261
  }
@@ -1736,7 +1744,7 @@ function publicKeyAndPrivateKeyMatches(certificate, privateKey) {
1736
1744
  }
1737
1745
  function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
1738
1746
  const initialBuffer = Buffer.from("Lorem Ipsum");
1739
- const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize, 11);
1747
+ const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
1740
1748
  const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
1741
1749
  const finalString = decryptedBuffer.toString("utf-8");
1742
1750
  return initialBuffer.toString("utf-8") === finalString;
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  readPublicKeyPEM,
15
15
  readPublicRsaKey,
16
16
  setCertificateStore
17
- } from "./chunk-2LYR7MB3.mjs";
17
+ } from "./chunk-AKMXF5ZH.mjs";
18
18
  import "./chunk-5NV4OKIV.mjs";
19
19
  import {
20
20
  CertificatePurpose,
@@ -110,7 +110,7 @@ import {
110
110
  verifyChunkSignature,
111
111
  verifyChunkSignatureWithDerivedKeys,
112
112
  verifyMessageChunkSignature
113
- } from "./chunk-PET55CDS.mjs";
113
+ } from "./chunk-XIYZLEAS.mjs";
114
114
  export {
115
115
  CertificatePurpose,
116
116
  PaddingAlgorithm,
package/dist/index_web.js CHANGED
@@ -1183,7 +1183,7 @@ var PaddingAlgorithm = /* @__PURE__ */ ((PaddingAlgorithm2) => {
1183
1183
  (0, import_assert3.default)(1 /* RSA_PKCS1_PADDING */ === import_constants.default.RSA_PKCS1_PADDING);
1184
1184
  function publicEncrypt_native(buffer, publicKey, algorithm) {
1185
1185
  if (algorithm === void 0) {
1186
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1186
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1187
1187
  }
1188
1188
  return (0, import_crypto2.publicEncrypt)(
1189
1189
  {
@@ -1195,7 +1195,7 @@ function publicEncrypt_native(buffer, publicKey, algorithm) {
1195
1195
  }
1196
1196
  function privateDecrypt_native(buffer, privateKey, algorithm) {
1197
1197
  if (algorithm === void 0) {
1198
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1198
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1199
1199
  }
1200
1200
  try {
1201
1201
  return (0, import_crypto2.privateDecrypt)(
@@ -1213,9 +1213,17 @@ var publicEncrypt = publicEncrypt_native;
1213
1213
  var privateDecrypt = privateDecrypt_native;
1214
1214
  function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgorithm) {
1215
1215
  if (paddingAlgorithm === void 0) {
1216
- paddingAlgorithm = 1 /* RSA_PKCS1_PADDING */;
1217
- }
1218
- if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1216
+ paddingAlgorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1217
+ }
1218
+ if (paddingAlgorithm === RSA_PKCS1_PADDING) {
1219
+ padding = padding || 11;
1220
+ if (padding !== 11)
1221
+ throw new Error("padding should be 11");
1222
+ } else if (paddingAlgorithm === RSA_PKCS1_OAEP_PADDING) {
1223
+ padding = padding || 42;
1224
+ if (padding !== 42)
1225
+ throw new Error("padding should be 42");
1226
+ } else {
1219
1227
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1220
1228
  }
1221
1229
  const chunk_size = blockSize - padding;
@@ -1232,7 +1240,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
1232
1240
  return outputBuffer;
1233
1241
  }
1234
1242
  function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
1235
- paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_PADDING;
1243
+ paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_OAEP_PADDING;
1236
1244
  if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1237
1245
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1238
1246
  }
@@ -1721,7 +1729,7 @@ function publicKeyAndPrivateKeyMatches(certificate, privateKey) {
1721
1729
  }
1722
1730
  function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
1723
1731
  const initialBuffer = Buffer.from("Lorem Ipsum");
1724
- const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize, 11);
1732
+ const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
1725
1733
  const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
1726
1734
  const finalString = decryptedBuffer.toString("utf-8");
1727
1735
  return initialBuffer.toString("utf-8") === finalString;
@@ -93,7 +93,7 @@ import {
93
93
  verifyChunkSignature,
94
94
  verifyChunkSignatureWithDerivedKeys,
95
95
  verifyMessageChunkSignature
96
- } from "./chunk-PET55CDS.mjs";
96
+ } from "./chunk-XIYZLEAS.mjs";
97
97
  export {
98
98
  CertificatePurpose,
99
99
  PaddingAlgorithm,
@@ -47,7 +47,7 @@ declare function publicEncrypt_native(buffer: Buffer, publicKey: KeyLike, algori
47
47
  declare function privateDecrypt_native(buffer: Buffer, privateKey: PrivateKey, algorithm?: PaddingAlgorithm): Buffer;
48
48
  declare const publicEncrypt: typeof publicEncrypt_native;
49
49
  declare const privateDecrypt: typeof privateDecrypt_native;
50
- declare function publicEncrypt_long(buffer: Buffer, publicKey: KeyLike, blockSize: number, padding: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
50
+ declare function publicEncrypt_long(buffer: Buffer, publicKey: KeyLike, blockSize: number, padding?: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
51
51
  declare function privateDecrypt_long(buffer: Buffer, privateKey: PrivateKey, blockSize: number, paddingAlgorithm?: number): Buffer;
52
52
  declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
53
53
  declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
@@ -47,7 +47,7 @@ declare function publicEncrypt_native(buffer: Buffer, publicKey: KeyLike, algori
47
47
  declare function privateDecrypt_native(buffer: Buffer, privateKey: PrivateKey, algorithm?: PaddingAlgorithm): Buffer;
48
48
  declare const publicEncrypt: typeof publicEncrypt_native;
49
49
  declare const privateDecrypt: typeof privateDecrypt_native;
50
- declare function publicEncrypt_long(buffer: Buffer, publicKey: KeyLike, blockSize: number, padding: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
50
+ declare function publicEncrypt_long(buffer: Buffer, publicKey: KeyLike, blockSize: number, padding?: number, paddingAlgorithm?: PaddingAlgorithm): Buffer;
51
51
  declare function privateDecrypt_long(buffer: Buffer, privateKey: PrivateKey, blockSize: number, paddingAlgorithm?: number): Buffer;
52
52
  declare function coerceCertificatePem(certificate: Certificate | CertificatePEM): CertificatePEM;
53
53
  declare function extractPublicKeyFromCertificateSync(certificate: Certificate | CertificatePEM): PublicKeyPEM;
@@ -1183,7 +1183,7 @@ var PaddingAlgorithm = /* @__PURE__ */ ((PaddingAlgorithm2) => {
1183
1183
  (0, import_assert3.default)(1 /* RSA_PKCS1_PADDING */ === import_constants.default.RSA_PKCS1_PADDING);
1184
1184
  function publicEncrypt_native(buffer, publicKey, algorithm) {
1185
1185
  if (algorithm === void 0) {
1186
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1186
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1187
1187
  }
1188
1188
  return (0, import_crypto2.publicEncrypt)(
1189
1189
  {
@@ -1195,7 +1195,7 @@ function publicEncrypt_native(buffer, publicKey, algorithm) {
1195
1195
  }
1196
1196
  function privateDecrypt_native(buffer, privateKey, algorithm) {
1197
1197
  if (algorithm === void 0) {
1198
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1198
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1199
1199
  }
1200
1200
  try {
1201
1201
  return (0, import_crypto2.privateDecrypt)(
@@ -1213,9 +1213,17 @@ var publicEncrypt = publicEncrypt_native;
1213
1213
  var privateDecrypt = privateDecrypt_native;
1214
1214
  function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgorithm) {
1215
1215
  if (paddingAlgorithm === void 0) {
1216
- paddingAlgorithm = 1 /* RSA_PKCS1_PADDING */;
1217
- }
1218
- if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1216
+ paddingAlgorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1217
+ }
1218
+ if (paddingAlgorithm === RSA_PKCS1_PADDING) {
1219
+ padding = padding || 11;
1220
+ if (padding !== 11)
1221
+ throw new Error("padding should be 11");
1222
+ } else if (paddingAlgorithm === RSA_PKCS1_OAEP_PADDING) {
1223
+ padding = padding || 42;
1224
+ if (padding !== 42)
1225
+ throw new Error("padding should be 42");
1226
+ } else {
1219
1227
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1220
1228
  }
1221
1229
  const chunk_size = blockSize - padding;
@@ -1232,7 +1240,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
1232
1240
  return outputBuffer;
1233
1241
  }
1234
1242
  function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
1235
- paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_PADDING;
1243
+ paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_OAEP_PADDING;
1236
1244
  if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1237
1245
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1238
1246
  }
@@ -1721,7 +1729,7 @@ function publicKeyAndPrivateKeyMatches(certificate, privateKey) {
1721
1729
  }
1722
1730
  function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
1723
1731
  const initialBuffer = Buffer.from("Lorem Ipsum");
1724
- const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize, 11);
1732
+ const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
1725
1733
  const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
1726
1734
  const finalString = decryptedBuffer.toString("utf-8");
1727
1735
  return initialBuffer.toString("utf-8") === finalString;
@@ -93,7 +93,7 @@ import {
93
93
  verifyChunkSignature,
94
94
  verifyChunkSignatureWithDerivedKeys,
95
95
  verifyMessageChunkSignature
96
- } from "../chunk-PET55CDS.mjs";
96
+ } from "../chunk-XIYZLEAS.mjs";
97
97
  export {
98
98
  CertificatePurpose,
99
99
  PaddingAlgorithm,
@@ -1183,7 +1183,7 @@ var PaddingAlgorithm = /* @__PURE__ */ ((PaddingAlgorithm2) => {
1183
1183
  (0, import_assert3.default)(1 /* RSA_PKCS1_PADDING */ === import_constants.default.RSA_PKCS1_PADDING);
1184
1184
  function publicEncrypt_native(buffer, publicKey, algorithm) {
1185
1185
  if (algorithm === void 0) {
1186
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1186
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1187
1187
  }
1188
1188
  return (0, import_crypto2.publicEncrypt)(
1189
1189
  {
@@ -1195,7 +1195,7 @@ function publicEncrypt_native(buffer, publicKey, algorithm) {
1195
1195
  }
1196
1196
  function privateDecrypt_native(buffer, privateKey, algorithm) {
1197
1197
  if (algorithm === void 0) {
1198
- algorithm = 1 /* RSA_PKCS1_PADDING */;
1198
+ algorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1199
1199
  }
1200
1200
  try {
1201
1201
  return (0, import_crypto2.privateDecrypt)(
@@ -1213,9 +1213,17 @@ var publicEncrypt = publicEncrypt_native;
1213
1213
  var privateDecrypt = privateDecrypt_native;
1214
1214
  function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgorithm) {
1215
1215
  if (paddingAlgorithm === void 0) {
1216
- paddingAlgorithm = 1 /* RSA_PKCS1_PADDING */;
1217
- }
1218
- if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1216
+ paddingAlgorithm = 4 /* RSA_PKCS1_OAEP_PADDING */;
1217
+ }
1218
+ if (paddingAlgorithm === RSA_PKCS1_PADDING) {
1219
+ padding = padding || 11;
1220
+ if (padding !== 11)
1221
+ throw new Error("padding should be 11");
1222
+ } else if (paddingAlgorithm === RSA_PKCS1_OAEP_PADDING) {
1223
+ padding = padding || 42;
1224
+ if (padding !== 42)
1225
+ throw new Error("padding should be 42");
1226
+ } else {
1219
1227
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1220
1228
  }
1221
1229
  const chunk_size = blockSize - padding;
@@ -1232,7 +1240,7 @@ function publicEncrypt_long(buffer, publicKey, blockSize, padding, paddingAlgori
1232
1240
  return outputBuffer;
1233
1241
  }
1234
1242
  function privateDecrypt_long(buffer, privateKey, blockSize, paddingAlgorithm) {
1235
- paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_PADDING;
1243
+ paddingAlgorithm = paddingAlgorithm || RSA_PKCS1_OAEP_PADDING;
1236
1244
  if (paddingAlgorithm !== RSA_PKCS1_PADDING && paddingAlgorithm !== RSA_PKCS1_OAEP_PADDING) {
1237
1245
  throw new Error("Invalid padding algorithm " + paddingAlgorithm);
1238
1246
  }
@@ -1721,7 +1729,7 @@ function publicKeyAndPrivateKeyMatches(certificate, privateKey) {
1721
1729
  }
1722
1730
  function certificateMatchesPrivateKeyPEM(certificate, privateKey, blockSize) {
1723
1731
  const initialBuffer = Buffer.from("Lorem Ipsum");
1724
- const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize, 11);
1732
+ const encryptedBuffer = publicEncrypt_long(initialBuffer, certificate, blockSize);
1725
1733
  const decryptedBuffer = privateDecrypt_long(encryptedBuffer, privateKey, blockSize);
1726
1734
  const finalString = decryptedBuffer.toString("utf-8");
1727
1735
  return initialBuffer.toString("utf-8") === finalString;
@@ -92,7 +92,7 @@ import {
92
92
  verifyChunkSignature,
93
93
  verifyChunkSignatureWithDerivedKeys,
94
94
  verifyMessageChunkSignature
95
- } from "../chunk-PET55CDS.mjs";
95
+ } from "../chunk-XIYZLEAS.mjs";
96
96
  export {
97
97
  CertificatePurpose,
98
98
  PaddingAlgorithm,
@@ -14,9 +14,9 @@ import {
14
14
  readPublicKeyPEM,
15
15
  readPublicRsaKey,
16
16
  setCertificateStore
17
- } from "../chunk-2LYR7MB3.mjs";
17
+ } from "../chunk-AKMXF5ZH.mjs";
18
18
  import "../chunk-5NV4OKIV.mjs";
19
- import "../chunk-PET55CDS.mjs";
19
+ import "../chunk-XIYZLEAS.mjs";
20
20
  export {
21
21
  generatePrivateKeyFile,
22
22
  generatePrivateKeyFileAlternate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-crypto",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "Crypto tools for Node-OPCUA",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -46,18 +46,18 @@
46
46
  "node": ">15.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "^20.11.5",
49
+ "@types/node": "^20.11.20",
50
50
  "lorem-ipsum": "^2.0.8"
51
51
  },
52
52
  "dependencies": {
53
- "@peculiar/webcrypto": "^1.4.4",
54
- "@peculiar/x509": "^1.9.6",
53
+ "@peculiar/webcrypto": "^1.4.5",
54
+ "@peculiar/x509": "^1.9.7",
55
55
  "@types/jsrsasign": "^10.5.12",
56
56
  "@types/sshpk": "^1.17.4",
57
57
  "assert": "^2.1.0",
58
58
  "chalk": "^4.1.2",
59
59
  "hexy": "0.3.5",
60
- "jsrsasign": "^11.0.0",
60
+ "jsrsasign": "^11.1.0",
61
61
  "sshpk": "^1.18.0"
62
62
  },
63
63
  "repository": {
@@ -67,5 +67,5 @@
67
67
  "bugs": {
68
68
  "url": "https://github.com/node-opcua/node-opcua-crypto/issues"
69
69
  },
70
- "gitHead": "24f9357d755a84a70fee9e516ff682f4bbb66c3c"
70
+ "gitHead": "59d6b1116200df0831dd67c9d4a80f5069747e53"
71
71
  }