@protontech/openpgp 5.11.1-0 → 5.11.1

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/openpgp.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! OpenPGP.js v5.11.1-0 - 2024-02-14 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
1
+ /*! OpenPGP.js v5.11.1 - 2024-04-10 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
2
2
  const globalThis = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3
3
 
4
4
  const doneWritingPromise = Symbol('doneWritingPromise');
@@ -2950,7 +2950,7 @@ var config = {
2950
2950
  * @memberof module:config
2951
2951
  * @property {String} versionString A version string to be included in armored messages
2952
2952
  */
2953
- versionString: 'OpenPGP.js 5.11.1-0',
2953
+ versionString: 'OpenPGP.js 5.11.1',
2954
2954
  /**
2955
2955
  * @memberof module:config
2956
2956
  * @property {String} commentString A comment string to be included in armored messages
@@ -12570,8 +12570,15 @@ async function encrypt$1(data, n, e) {
12570
12570
  * @async
12571
12571
  */
12572
12572
  async function decrypt$1(data, n, e, d, p, q, u, randomPayload) {
12573
- if (util.getNodeCrypto()) {
12574
- return nodeDecrypt$1(data, n, e, d, p, q, u, randomPayload);
12573
+ // Node v18.19.1, 20.11.1 and 21.6.2 have disabled support for PKCS#1 decryption,
12574
+ // and we want to avoid checking the error type to decide if the random payload
12575
+ // should indeed be returned.
12576
+ if (util.getNodeCrypto() && !randomPayload) {
12577
+ try {
12578
+ return await nodeDecrypt$1(data, n, e, d, p, q, u);
12579
+ } catch (err) {
12580
+ util.printDebugError(err);
12581
+ }
12575
12582
  }
12576
12583
  return bnDecrypt(data, n, e, d, p, q, u, randomPayload);
12577
12584
  }
@@ -12873,7 +12880,7 @@ async function bnEncrypt(data, n, e) {
12873
12880
  return data.modExp(e, n).toUint8Array('be', n.byteLength());
12874
12881
  }
12875
12882
 
12876
- async function nodeDecrypt$1(data, n, e, d, p, q, u, randomPayload) {
12883
+ async function nodeDecrypt$1(data, n, e, d, p, q, u) {
12877
12884
  const { default: BN } = await Promise.resolve().then(function () { return bn$1; });
12878
12885
 
12879
12886
  const pBNum = new BN(p);
@@ -12907,9 +12914,6 @@ async function nodeDecrypt$1(data, n, e, d, p, q, u, randomPayload) {
12907
12914
  try {
12908
12915
  return new Uint8Array(nodeCrypto$6.privateDecrypt(key, data));
12909
12916
  } catch (err) {
12910
- if (randomPayload) {
12911
- return randomPayload;
12912
- }
12913
12917
  throw new Error('Decryption error');
12914
12918
  }
12915
12919
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@protontech/openpgp",
3
3
  "description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
4
- "version": "5.11.1-0",
4
+ "version": "5.11.1",
5
5
  "license": "LGPL-3.0+",
6
6
  "homepage": "https://openpgpjs.org/",
7
7
  "engines": {