@protontech/openpgp 5.4.0 → 5.5.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/lightweight/bn.interface.min.mjs +1 -1
- package/dist/lightweight/bn.interface.mjs +1 -1
- package/dist/lightweight/bn.min.mjs +1 -1
- package/dist/lightweight/bn.mjs +1 -1
- package/dist/lightweight/elliptic.min.mjs +1 -1
- package/dist/lightweight/elliptic.mjs +1 -1
- package/dist/lightweight/openpgp.min.mjs +2 -2
- package/dist/lightweight/openpgp.min.mjs.map +1 -1
- package/dist/lightweight/openpgp.mjs +33 -26
- package/dist/lightweight/ponyfill.es6.min.mjs +1 -1
- package/dist/lightweight/ponyfill.es6.mjs +1 -1
- package/dist/lightweight/web-streams-adapter.min.mjs +1 -1
- package/dist/lightweight/web-streams-adapter.mjs +1 -1
- package/dist/node/openpgp.js +33 -26
- package/dist/node/openpgp.min.js +2 -2
- package/dist/node/openpgp.min.js.map +1 -1
- package/dist/node/openpgp.min.mjs +2 -2
- package/dist/node/openpgp.min.mjs.map +1 -1
- package/dist/node/openpgp.mjs +33 -26
- package/dist/openpgp.js +33 -26
- package/dist/openpgp.min.js +2 -2
- package/dist/openpgp.min.js.map +1 -1
- package/dist/openpgp.min.mjs +2 -2
- package/dist/openpgp.min.mjs.map +1 -1
- package/dist/openpgp.mjs +33 -26
- package/package.json +1 -1
package/dist/openpgp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.
|
|
1
|
+
/*! OpenPGP.js v5.5.0 - 2022-10-31 - 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');
|
|
@@ -1770,7 +1770,7 @@ const util = {
|
|
|
1770
1770
|
*/
|
|
1771
1771
|
printDebug: function (str) {
|
|
1772
1772
|
if (debugMode) {
|
|
1773
|
-
console.log(str);
|
|
1773
|
+
console.log('[OpenPGP.js debug]', str);
|
|
1774
1774
|
}
|
|
1775
1775
|
},
|
|
1776
1776
|
|
|
@@ -1781,7 +1781,7 @@ const util = {
|
|
|
1781
1781
|
*/
|
|
1782
1782
|
printDebugError: function (error) {
|
|
1783
1783
|
if (debugMode) {
|
|
1784
|
-
console.error(error);
|
|
1784
|
+
console.error('[OpenPGP.js debug]', error);
|
|
1785
1785
|
}
|
|
1786
1786
|
},
|
|
1787
1787
|
|
|
@@ -2884,7 +2884,7 @@ var defaultConfig = {
|
|
|
2884
2884
|
* @memberof module:config
|
|
2885
2885
|
* @property {String} versionString A version string to be included in armored messages
|
|
2886
2886
|
*/
|
|
2887
|
-
versionString: 'OpenPGP.js 5.
|
|
2887
|
+
versionString: 'OpenPGP.js 5.5.0',
|
|
2888
2888
|
/**
|
|
2889
2889
|
* @memberof module:config
|
|
2890
2890
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -3101,15 +3101,17 @@ function createcrc24(input) {
|
|
|
3101
3101
|
}
|
|
3102
3102
|
|
|
3103
3103
|
/**
|
|
3104
|
-
* Verify armored headers.
|
|
3105
|
-
*
|
|
3104
|
+
* Verify armored headers. crypto-refresh-06, section 6.2:
|
|
3105
|
+
* "An OpenPGP implementation may consider improperly formatted Armor
|
|
3106
|
+
* Headers to be corruption of the ASCII Armor, but SHOULD make an
|
|
3107
|
+
* effort to recover."
|
|
3106
3108
|
* @private
|
|
3107
3109
|
* @param {Array<String>} headers - Armor headers
|
|
3108
3110
|
*/
|
|
3109
3111
|
function verifyHeaders(headers) {
|
|
3110
3112
|
for (let i = 0; i < headers.length; i++) {
|
|
3111
3113
|
if (!/^([^\s:]|[^\s:][^:]*[^\s:]): .+$/.test(headers[i])) {
|
|
3112
|
-
|
|
3114
|
+
util.printDebugError(new Error('Improperly formatted armor header: ' + headers[i]));
|
|
3113
3115
|
}
|
|
3114
3116
|
if (!/^(Version|Comment|MessageID|Hash|Charset): .+$/.test(headers[i])) {
|
|
3115
3117
|
util.printDebugError(new Error('Unknown header: ' + headers[i]));
|
|
@@ -3303,7 +3305,7 @@ function armor(messageType, body, partIndex, partTotal, customComment, config =
|
|
|
3303
3305
|
result.push('-----END PGP MESSAGE, PART ' + partIndex + '-----\n');
|
|
3304
3306
|
break;
|
|
3305
3307
|
case enums.armor.signed:
|
|
3306
|
-
result.push('
|
|
3308
|
+
result.push('-----BEGIN PGP SIGNED MESSAGE-----\n');
|
|
3307
3309
|
result.push('Hash: ' + hash + '\n\n');
|
|
3308
3310
|
result.push(text.replace(/^-/mg, '- -'));
|
|
3309
3311
|
result.push('\n-----BEGIN PGP SIGNATURE-----\n');
|
|
@@ -23254,6 +23256,11 @@ class SignaturePacket {
|
|
|
23254
23256
|
// Add hashed subpackets
|
|
23255
23257
|
arr.push(this.writeHashedSubPackets());
|
|
23256
23258
|
|
|
23259
|
+
// Remove unhashed subpackets, in case some allowed unhashed
|
|
23260
|
+
// subpackets existed, in order not to duplicate them (in both
|
|
23261
|
+
// the hashed and unhashed subpackets) when re-signing.
|
|
23262
|
+
this.unhashedSubpackets = [];
|
|
23263
|
+
|
|
23257
23264
|
this.signatureData = util.concat(arr);
|
|
23258
23265
|
|
|
23259
23266
|
const toHash = this.toHash(this.signatureType, data, detached);
|
|
@@ -23316,6 +23323,11 @@ class SignaturePacket {
|
|
|
23316
23323
|
bytes = util.concat([bytes, this.revocationKeyFingerprint]);
|
|
23317
23324
|
arr.push(writeSubPacket(sub.revocationKey, bytes));
|
|
23318
23325
|
}
|
|
23326
|
+
if (!this.issuerKeyID.isNull() && this.issuerKeyVersion !== 5) {
|
|
23327
|
+
// If the version of [the] key is greater than 4, this subpacket
|
|
23328
|
+
// MUST NOT be included in the signature.
|
|
23329
|
+
arr.push(writeSubPacket(sub.issuer, this.issuerKeyID.write()));
|
|
23330
|
+
}
|
|
23319
23331
|
this.rawNotations.forEach(([{ name, value, humanReadable }]) => {
|
|
23320
23332
|
bytes = [new Uint8Array([humanReadable ? 0x80 : 0, 0, 0, 0])];
|
|
23321
23333
|
// 2 octets of name length
|
|
@@ -23369,6 +23381,14 @@ class SignaturePacket {
|
|
|
23369
23381
|
bytes = util.concat(bytes);
|
|
23370
23382
|
arr.push(writeSubPacket(sub.signatureTarget, bytes));
|
|
23371
23383
|
}
|
|
23384
|
+
if (this.embeddedSignature !== null) {
|
|
23385
|
+
arr.push(writeSubPacket(sub.embeddedSignature, this.embeddedSignature.write()));
|
|
23386
|
+
}
|
|
23387
|
+
if (this.issuerFingerprint !== null) {
|
|
23388
|
+
bytes = [new Uint8Array([this.issuerKeyVersion]), this.issuerFingerprint];
|
|
23389
|
+
bytes = util.concat(bytes);
|
|
23390
|
+
arr.push(writeSubPacket(sub.issuerFingerprint, bytes));
|
|
23391
|
+
}
|
|
23372
23392
|
if (this.preferredAEADAlgorithms !== null) {
|
|
23373
23393
|
bytes = util.stringToUint8Array(util.uint8ArrayToString(this.preferredAEADAlgorithms));
|
|
23374
23394
|
arr.push(writeSubPacket(sub.preferredAEADAlgorithms, bytes));
|
|
@@ -23381,26 +23401,11 @@ class SignaturePacket {
|
|
|
23381
23401
|
}
|
|
23382
23402
|
|
|
23383
23403
|
/**
|
|
23384
|
-
* Creates Uint8Array
|
|
23404
|
+
* Creates an Uint8Array containing the unhashed subpackets
|
|
23385
23405
|
* @returns {Uint8Array} Subpacket data.
|
|
23386
23406
|
*/
|
|
23387
23407
|
writeUnhashedSubPackets() {
|
|
23388
|
-
const sub = enums.signatureSubpacket;
|
|
23389
23408
|
const arr = [];
|
|
23390
|
-
let bytes;
|
|
23391
|
-
if (!this.issuerKeyID.isNull() && this.issuerKeyVersion !== 5) {
|
|
23392
|
-
// If the version of [the] key is greater than 4, this subpacket
|
|
23393
|
-
// MUST NOT be included in the signature.
|
|
23394
|
-
arr.push(writeSubPacket(sub.issuer, this.issuerKeyID.write()));
|
|
23395
|
-
}
|
|
23396
|
-
if (this.embeddedSignature !== null) {
|
|
23397
|
-
arr.push(writeSubPacket(sub.embeddedSignature, this.embeddedSignature.write()));
|
|
23398
|
-
}
|
|
23399
|
-
if (this.issuerFingerprint !== null) {
|
|
23400
|
-
bytes = [new Uint8Array([this.issuerKeyVersion]), this.issuerFingerprint];
|
|
23401
|
-
bytes = util.concat(bytes);
|
|
23402
|
-
arr.push(writeSubPacket(sub.issuerFingerprint, bytes));
|
|
23403
|
-
}
|
|
23404
23409
|
this.unhashedSubpackets.forEach(data => {
|
|
23405
23410
|
arr.push(writeSimpleLength(data.length));
|
|
23406
23411
|
arr.push(data);
|
|
@@ -23420,9 +23425,11 @@ class SignaturePacket {
|
|
|
23420
23425
|
const critical = bytes[mypos] & 0x80;
|
|
23421
23426
|
const type = bytes[mypos] & 0x7F;
|
|
23422
23427
|
|
|
23423
|
-
if (!hashed
|
|
23428
|
+
if (!hashed) {
|
|
23424
23429
|
this.unhashedSubpackets.push(bytes.subarray(mypos, bytes.length));
|
|
23425
|
-
|
|
23430
|
+
if (!allowedUnhashedSubpackets.has(type)) {
|
|
23431
|
+
return;
|
|
23432
|
+
}
|
|
23426
23433
|
}
|
|
23427
23434
|
|
|
23428
23435
|
mypos++;
|
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.
|
|
4
|
+
"version": "5.5.0",
|
|
5
5
|
"license": "LGPL-3.0+",
|
|
6
6
|
"homepage": "https://openpgpjs.org/",
|
|
7
7
|
"engines": {
|