@protontech/openpgp 5.8.0-0 → 5.9.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/argon2id.min.mjs +1 -1
- package/dist/lightweight/argon2id.mjs +1 -1
- 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 +51 -36
- 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 +51 -35
- package/dist/node/openpgp.min.js +3 -3
- package/dist/node/openpgp.min.js.map +1 -1
- package/dist/node/openpgp.min.mjs +3 -3
- package/dist/node/openpgp.min.mjs.map +1 -1
- package/dist/node/openpgp.mjs +51 -36
- package/dist/openpgp.js +51 -35
- package/dist/openpgp.min.js +3 -3
- package/dist/openpgp.min.js.map +1 -1
- package/dist/openpgp.min.mjs +3 -3
- package/dist/openpgp.min.mjs.map +1 -1
- package/dist/openpgp.mjs +51 -36
- package/openpgp.d.ts +21 -8
- package/package.json +1 -1
package/dist/node/openpgp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.
|
|
1
|
+
/*! OpenPGP.js v5.9.0 - 2023-05-15 - 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
|
import buffer from 'buffer';
|
|
@@ -1913,7 +1913,7 @@ const util = {
|
|
|
1913
1913
|
if (!util.isString(data)) {
|
|
1914
1914
|
return false;
|
|
1915
1915
|
}
|
|
1916
|
-
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}
|
|
1916
|
+
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/;
|
|
1917
1917
|
return re.test(data);
|
|
1918
1918
|
},
|
|
1919
1919
|
|
|
@@ -2624,6 +2624,8 @@ var enums = {
|
|
|
2624
2624
|
splitPrivateKey: 16,
|
|
2625
2625
|
/** 0x20 - This key may be used for authentication. */
|
|
2626
2626
|
authentication: 32,
|
|
2627
|
+
/** This key may be used for forwarded communications */
|
|
2628
|
+
forwardedCommunication: 64,
|
|
2627
2629
|
/** 0x80 - The private component of this key may be in the
|
|
2628
2630
|
* possession of more than one person. */
|
|
2629
2631
|
sharedPrivateKey: 128
|
|
@@ -2828,6 +2830,13 @@ var config = {
|
|
|
2828
2830
|
* @property {Boolean} allowUnauthenticatedStream
|
|
2829
2831
|
*/
|
|
2830
2832
|
allowUnauthenticatedStream: false,
|
|
2833
|
+
/**
|
|
2834
|
+
* Allow decrypting forwarded messages, using keys with 0x40 ('forwarded communication') flag.
|
|
2835
|
+
* Note: this is related to a **non-standard feature**.
|
|
2836
|
+
* @memberof module:config
|
|
2837
|
+
* @property {Boolean} allowForwardedMessages
|
|
2838
|
+
*/
|
|
2839
|
+
allowForwardedMessages: false,
|
|
2831
2840
|
/**
|
|
2832
2841
|
* @memberof module:config
|
|
2833
2842
|
* @property {Boolean} checksumRequired Do not throw error when armor is missing a checksum
|
|
@@ -2904,6 +2913,14 @@ var config = {
|
|
|
2904
2913
|
* @property {Boolean} ignoreMalformedPackets Ignore malformed packets on parsing instead of throwing an error
|
|
2905
2914
|
*/
|
|
2906
2915
|
ignoreMalformedPackets: false,
|
|
2916
|
+
/**
|
|
2917
|
+
* Parsing of packets is normally restricted to a predefined set of packets. For example a Sym. Encrypted Integrity Protected Data Packet can only
|
|
2918
|
+
* contain a certain set of packets including LiteralDataPacket. With this setting we can allow additional packets, which is probably not advisable
|
|
2919
|
+
* as a global config setting, but can be used for specific function calls (e.g. decrypt method of Message).
|
|
2920
|
+
* @memberof module:config
|
|
2921
|
+
* @property {Array} additionalAllowedPackets Allow additional packets on parsing. Defined as array of packet classes, e.g. [PublicKeyPacket]
|
|
2922
|
+
*/
|
|
2923
|
+
additionalAllowedPackets: [],
|
|
2907
2924
|
/**
|
|
2908
2925
|
* @memberof module:config
|
|
2909
2926
|
* @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
|
|
@@ -2918,7 +2935,7 @@ var config = {
|
|
|
2918
2935
|
* @memberof module:config
|
|
2919
2936
|
* @property {String} versionString A version string to be included in armored messages
|
|
2920
2937
|
*/
|
|
2921
|
-
versionString: 'OpenPGP.js 5.
|
|
2938
|
+
versionString: 'OpenPGP.js 5.9.0',
|
|
2922
2939
|
/**
|
|
2923
2940
|
* @memberof module:config
|
|
2924
2941
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -14414,7 +14431,7 @@ function buildEcdhParam(public_algo, oid, kdfParams, fingerprint) {
|
|
|
14414
14431
|
return util.concatUint8Array([
|
|
14415
14432
|
oid.write(),
|
|
14416
14433
|
new Uint8Array([public_algo]),
|
|
14417
|
-
kdfParams.
|
|
14434
|
+
kdfParams.write(true),
|
|
14418
14435
|
util.stringToUint8Array('Anonymous Sender '),
|
|
14419
14436
|
kdfParams.replacementFingerprint || fingerprint.subarray(0, 20)
|
|
14420
14437
|
]);
|
|
@@ -15256,32 +15273,28 @@ class ECDHSymmetricKey {
|
|
|
15256
15273
|
|
|
15257
15274
|
// OpenPGP.js - An OpenPGP implementation in javascript
|
|
15258
15275
|
|
|
15276
|
+
const VERSION_FORWARDING = 0xFF;
|
|
15277
|
+
|
|
15259
15278
|
class KDFParams {
|
|
15260
15279
|
/**
|
|
15261
15280
|
* @param {Integer} version Version, defaults to 1
|
|
15262
15281
|
* @param {enums.hash} hash Hash algorithm
|
|
15263
15282
|
* @param {enums.symmetric} cipher Symmetric algorithm
|
|
15264
|
-
* @param {
|
|
15265
|
-
* @param {Uint8Array} replacementFingerprint (v2 only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15266
|
-
* @param {Uint8Array} replacementKDFParams (v2 only) serialized KDF params to use in KDF digest computation
|
|
15283
|
+
* @param {Uint8Array} replacementFingerprint (forwarding only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15267
15284
|
*/
|
|
15268
15285
|
constructor(data) {
|
|
15269
15286
|
if (data) {
|
|
15270
|
-
const { version, hash, cipher,
|
|
15287
|
+
const { version, hash, cipher, replacementFingerprint } = data;
|
|
15271
15288
|
this.version = version || 1;
|
|
15272
15289
|
this.hash = hash;
|
|
15273
15290
|
this.cipher = cipher;
|
|
15274
15291
|
|
|
15275
|
-
this.flags = flags;
|
|
15276
15292
|
this.replacementFingerprint = replacementFingerprint;
|
|
15277
|
-
this.replacementKDFParams = replacementKDFParams;
|
|
15278
15293
|
} else {
|
|
15279
15294
|
this.version = null;
|
|
15280
15295
|
this.hash = null;
|
|
15281
15296
|
this.cipher = null;
|
|
15282
|
-
this.flags = null;
|
|
15283
15297
|
this.replacementFingerprint = null;
|
|
15284
|
-
this.replacementKDFParams = null;
|
|
15285
15298
|
}
|
|
15286
15299
|
}
|
|
15287
15300
|
|
|
@@ -15291,44 +15304,41 @@ class KDFParams {
|
|
|
15291
15304
|
* @returns {Number} Number of read bytes.
|
|
15292
15305
|
*/
|
|
15293
15306
|
read(input) {
|
|
15307
|
+
const totalBytes = input[0];
|
|
15294
15308
|
this.version = input[1];
|
|
15295
15309
|
this.hash = input[2];
|
|
15296
15310
|
this.cipher = input[3];
|
|
15297
15311
|
let readBytes = 4;
|
|
15298
15312
|
|
|
15299
|
-
if (this.version ===
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
readBytes += 20;
|
|
15304
|
-
}
|
|
15305
|
-
if (this.flags & enums.kdfFlags.replace_kdf_params) {
|
|
15306
|
-
const fieldLength = input[readBytes] + 1; // account for length
|
|
15307
|
-
this.replacementKDFParams = input.slice(readBytes, readBytes + fieldLength);
|
|
15308
|
-
readBytes += fieldLength;
|
|
15309
|
-
}
|
|
15313
|
+
if (this.version === VERSION_FORWARDING) {
|
|
15314
|
+
const fingerprintLength = totalBytes - readBytes + 1; // acount for length byte
|
|
15315
|
+
this.replacementFingerprint = input.slice(readBytes, readBytes + fingerprintLength);
|
|
15316
|
+
readBytes += fingerprintLength;
|
|
15310
15317
|
}
|
|
15311
15318
|
return readBytes;
|
|
15312
15319
|
}
|
|
15313
15320
|
|
|
15314
15321
|
/**
|
|
15315
15322
|
* Write KDFParams to an Uint8Array
|
|
15323
|
+
* @param {Boolean} [forReplacementParams] - forwarding only: whether to serialize data to use for replacement params
|
|
15316
15324
|
* @returns {Uint8Array} Array with the KDFParams value
|
|
15317
15325
|
*/
|
|
15318
|
-
write() {
|
|
15319
|
-
if (!this.version || this.version === 1) {
|
|
15326
|
+
write(forReplacementParams) {
|
|
15327
|
+
if (!this.version || this.version === 1 || forReplacementParams) {
|
|
15320
15328
|
return new Uint8Array([3, 1, this.hash, this.cipher]);
|
|
15321
15329
|
}
|
|
15322
15330
|
|
|
15323
|
-
const
|
|
15324
|
-
new Uint8Array([
|
|
15325
|
-
|
|
15326
|
-
|
|
15331
|
+
const forwardingFields = util.concatUint8Array([
|
|
15332
|
+
new Uint8Array([
|
|
15333
|
+
3 + this.replacementFingerprint.length,
|
|
15334
|
+
this.version,
|
|
15335
|
+
this.hash,
|
|
15336
|
+
this.cipher
|
|
15337
|
+
]),
|
|
15338
|
+
this.replacementFingerprint
|
|
15327
15339
|
]);
|
|
15328
15340
|
|
|
15329
|
-
|
|
15330
|
-
v2Fields[0] = v2Fields.length - 1;
|
|
15331
|
-
return new Uint8Array(v2Fields);
|
|
15341
|
+
return forwardingFields;
|
|
15332
15342
|
}
|
|
15333
15343
|
}
|
|
15334
15344
|
|
|
@@ -24298,6 +24308,9 @@ class PacketList extends Array {
|
|
|
24298
24308
|
* @async
|
|
24299
24309
|
*/
|
|
24300
24310
|
async read(bytes, allowedPackets, config$1 = config) {
|
|
24311
|
+
if (config$1.additionalAllowedPackets.length) {
|
|
24312
|
+
allowedPackets = { ...allowedPackets, ...util.constructAllowedPackets(config$1.additionalAllowedPackets) };
|
|
24313
|
+
}
|
|
24301
24314
|
this.stream = transformPair(bytes, async (readable, writable) => {
|
|
24302
24315
|
const writer = getWriter(writable);
|
|
24303
24316
|
try {
|
|
@@ -27851,7 +27864,8 @@ function isValidDecryptionKeyPacket(signature, config) {
|
|
|
27851
27864
|
|
|
27852
27865
|
return !signature.keyFlags ||
|
|
27853
27866
|
(signature.keyFlags[0] & enums.keyFlags.encryptCommunication) !== 0 ||
|
|
27854
|
-
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0
|
|
27867
|
+
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0 ||
|
|
27868
|
+
(config.allowForwardedMessages && (signature.keyFlags[0] & enums.keyFlags.forwardedCommunication) !== 0);
|
|
27855
27869
|
}
|
|
27856
27870
|
|
|
27857
27871
|
/**
|
|
@@ -28799,7 +28813,7 @@ class Key {
|
|
|
28799
28813
|
throw exception || new Error('Could not find primary user');
|
|
28800
28814
|
}
|
|
28801
28815
|
await Promise.all(users.map(async function (a) {
|
|
28802
|
-
return a.
|
|
28816
|
+
return a.selfCertification.revoked || a.user.isRevoked(a.selfCertification, null, date, config$1);
|
|
28803
28817
|
}));
|
|
28804
28818
|
// sort by primary user flag and signature creation time
|
|
28805
28819
|
const primaryUser = users.sort(function(a, b) {
|
|
@@ -29022,7 +29036,8 @@ class Key {
|
|
|
29022
29036
|
|
|
29023
29037
|
results.push(...signatures.map(
|
|
29024
29038
|
signature => ({
|
|
29025
|
-
userID: user.userID.userID,
|
|
29039
|
+
userID: user.userID ? user.userID.userID : null,
|
|
29040
|
+
userAttribute: user.userAttribute,
|
|
29026
29041
|
keyID: signature.keyID,
|
|
29027
29042
|
valid: signature.valid
|
|
29028
29043
|
}))
|
|
@@ -44760,4 +44775,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
44760
44775
|
'default': loadWasm
|
|
44761
44776
|
});
|
|
44762
44777
|
|
|
44763
|
-
export { AEADEncryptedDataPacket, CleartextMessage, CompressedDataPacket, LiteralDataPacket, MarkerPacket, Message, OnePassSignaturePacket, PacketList, PrivateKey, PublicKey, PublicKeyEncryptedSessionKeyPacket, PublicKeyPacket, PublicSubkeyPacket, SecretKeyPacket, SecretSubkeyPacket, Signature, SignaturePacket, Subkey, SymEncryptedIntegrityProtectedDataPacket, SymEncryptedSessionKeyPacket, SymmetricallyEncryptedDataPacket, TrustPacket, UnparseablePacket, UserAttributePacket, UserIDPacket, armor, config, createCleartextMessage, createMessage, decrypt$4 as decrypt, decryptKey, decryptSessionKeys, encrypt$4 as encrypt, encryptKey, encryptSessionKey, enums, generateKey, generateSessionKey$1 as generateSessionKey, readCleartextMessage, readKey, readKeys, readMessage, readPrivateKey, readPrivateKeys, readSignature, reformatKey, revokeKey, sign$5 as sign, unarmor, verify$5 as verify };
|
|
44778
|
+
export { AEADEncryptedDataPacket, CleartextMessage, CompressedDataPacket, KDFParams, LiteralDataPacket, MarkerPacket, Message, OnePassSignaturePacket, PacketList, PrivateKey, PublicKey, PublicKeyEncryptedSessionKeyPacket, PublicKeyPacket, PublicSubkeyPacket, SecretKeyPacket, SecretSubkeyPacket, Signature, SignaturePacket, Subkey, SymEncryptedIntegrityProtectedDataPacket, SymEncryptedSessionKeyPacket, SymmetricallyEncryptedDataPacket, TrustPacket, UnparseablePacket, UserAttributePacket, UserIDPacket, armor, config, createCleartextMessage, createMessage, decrypt$4 as decrypt, decryptKey, decryptSessionKeys, encrypt$4 as encrypt, encryptKey, encryptSessionKey, enums, generateKey, generateSessionKey$1 as generateSessionKey, readCleartextMessage, readKey, readKeys, readMessage, readPrivateKey, readPrivateKeys, readSignature, reformatKey, revokeKey, sign$5 as sign, unarmor, verify$5 as verify };
|
package/dist/openpgp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.
|
|
1
|
+
/*! OpenPGP.js v5.9.0 - 2023-05-15 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
|
2
2
|
var openpgp = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -1910,7 +1910,7 @@ var openpgp = (function (exports) {
|
|
|
1910
1910
|
if (!util.isString(data)) {
|
|
1911
1911
|
return false;
|
|
1912
1912
|
}
|
|
1913
|
-
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}
|
|
1913
|
+
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}[0-9]*|xn--[a-zA-Z\-0-9]+)))$/;
|
|
1914
1914
|
return re.test(data);
|
|
1915
1915
|
},
|
|
1916
1916
|
|
|
@@ -2621,6 +2621,8 @@ var openpgp = (function (exports) {
|
|
|
2621
2621
|
splitPrivateKey: 16,
|
|
2622
2622
|
/** 0x20 - This key may be used for authentication. */
|
|
2623
2623
|
authentication: 32,
|
|
2624
|
+
/** This key may be used for forwarded communications */
|
|
2625
|
+
forwardedCommunication: 64,
|
|
2624
2626
|
/** 0x80 - The private component of this key may be in the
|
|
2625
2627
|
* possession of more than one person. */
|
|
2626
2628
|
sharedPrivateKey: 128
|
|
@@ -2825,6 +2827,13 @@ var openpgp = (function (exports) {
|
|
|
2825
2827
|
* @property {Boolean} allowUnauthenticatedStream
|
|
2826
2828
|
*/
|
|
2827
2829
|
allowUnauthenticatedStream: false,
|
|
2830
|
+
/**
|
|
2831
|
+
* Allow decrypting forwarded messages, using keys with 0x40 ('forwarded communication') flag.
|
|
2832
|
+
* Note: this is related to a **non-standard feature**.
|
|
2833
|
+
* @memberof module:config
|
|
2834
|
+
* @property {Boolean} allowForwardedMessages
|
|
2835
|
+
*/
|
|
2836
|
+
allowForwardedMessages: false,
|
|
2828
2837
|
/**
|
|
2829
2838
|
* @memberof module:config
|
|
2830
2839
|
* @property {Boolean} checksumRequired Do not throw error when armor is missing a checksum
|
|
@@ -2901,6 +2910,14 @@ var openpgp = (function (exports) {
|
|
|
2901
2910
|
* @property {Boolean} ignoreMalformedPackets Ignore malformed packets on parsing instead of throwing an error
|
|
2902
2911
|
*/
|
|
2903
2912
|
ignoreMalformedPackets: false,
|
|
2913
|
+
/**
|
|
2914
|
+
* Parsing of packets is normally restricted to a predefined set of packets. For example a Sym. Encrypted Integrity Protected Data Packet can only
|
|
2915
|
+
* contain a certain set of packets including LiteralDataPacket. With this setting we can allow additional packets, which is probably not advisable
|
|
2916
|
+
* as a global config setting, but can be used for specific function calls (e.g. decrypt method of Message).
|
|
2917
|
+
* @memberof module:config
|
|
2918
|
+
* @property {Array} additionalAllowedPackets Allow additional packets on parsing. Defined as array of packet classes, e.g. [PublicKeyPacket]
|
|
2919
|
+
*/
|
|
2920
|
+
additionalAllowedPackets: [],
|
|
2904
2921
|
/**
|
|
2905
2922
|
* @memberof module:config
|
|
2906
2923
|
* @property {Boolean} showVersion Whether to include {@link module:config/config.versionString} in armored messages
|
|
@@ -2915,7 +2932,7 @@ var openpgp = (function (exports) {
|
|
|
2915
2932
|
* @memberof module:config
|
|
2916
2933
|
* @property {String} versionString A version string to be included in armored messages
|
|
2917
2934
|
*/
|
|
2918
|
-
versionString: 'OpenPGP.js 5.
|
|
2935
|
+
versionString: 'OpenPGP.js 5.9.0',
|
|
2919
2936
|
/**
|
|
2920
2937
|
* @memberof module:config
|
|
2921
2938
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -14405,7 +14422,7 @@ var openpgp = (function (exports) {
|
|
|
14405
14422
|
return util.concatUint8Array([
|
|
14406
14423
|
oid.write(),
|
|
14407
14424
|
new Uint8Array([public_algo]),
|
|
14408
|
-
kdfParams.
|
|
14425
|
+
kdfParams.write(true),
|
|
14409
14426
|
util.stringToUint8Array('Anonymous Sender '),
|
|
14410
14427
|
kdfParams.replacementFingerprint || fingerprint.subarray(0, 20)
|
|
14411
14428
|
]);
|
|
@@ -15247,32 +15264,28 @@ var openpgp = (function (exports) {
|
|
|
15247
15264
|
|
|
15248
15265
|
// OpenPGP.js - An OpenPGP implementation in javascript
|
|
15249
15266
|
|
|
15267
|
+
const VERSION_FORWARDING = 0xFF;
|
|
15268
|
+
|
|
15250
15269
|
class KDFParams {
|
|
15251
15270
|
/**
|
|
15252
15271
|
* @param {Integer} version Version, defaults to 1
|
|
15253
15272
|
* @param {enums.hash} hash Hash algorithm
|
|
15254
15273
|
* @param {enums.symmetric} cipher Symmetric algorithm
|
|
15255
|
-
* @param {
|
|
15256
|
-
* @param {Uint8Array} replacementFingerprint (v2 only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15257
|
-
* @param {Uint8Array} replacementKDFParams (v2 only) serialized KDF params to use in KDF digest computation
|
|
15274
|
+
* @param {Uint8Array} replacementFingerprint (forwarding only) fingerprint to use instead of recipient one (v5 keys, the 20 leftmost bytes of the fingerprint)
|
|
15258
15275
|
*/
|
|
15259
15276
|
constructor(data) {
|
|
15260
15277
|
if (data) {
|
|
15261
|
-
const { version, hash, cipher,
|
|
15278
|
+
const { version, hash, cipher, replacementFingerprint } = data;
|
|
15262
15279
|
this.version = version || 1;
|
|
15263
15280
|
this.hash = hash;
|
|
15264
15281
|
this.cipher = cipher;
|
|
15265
15282
|
|
|
15266
|
-
this.flags = flags;
|
|
15267
15283
|
this.replacementFingerprint = replacementFingerprint;
|
|
15268
|
-
this.replacementKDFParams = replacementKDFParams;
|
|
15269
15284
|
} else {
|
|
15270
15285
|
this.version = null;
|
|
15271
15286
|
this.hash = null;
|
|
15272
15287
|
this.cipher = null;
|
|
15273
|
-
this.flags = null;
|
|
15274
15288
|
this.replacementFingerprint = null;
|
|
15275
|
-
this.replacementKDFParams = null;
|
|
15276
15289
|
}
|
|
15277
15290
|
}
|
|
15278
15291
|
|
|
@@ -15282,44 +15295,41 @@ var openpgp = (function (exports) {
|
|
|
15282
15295
|
* @returns {Number} Number of read bytes.
|
|
15283
15296
|
*/
|
|
15284
15297
|
read(input) {
|
|
15298
|
+
const totalBytes = input[0];
|
|
15285
15299
|
this.version = input[1];
|
|
15286
15300
|
this.hash = input[2];
|
|
15287
15301
|
this.cipher = input[3];
|
|
15288
15302
|
let readBytes = 4;
|
|
15289
15303
|
|
|
15290
|
-
if (this.version ===
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
readBytes += 20;
|
|
15295
|
-
}
|
|
15296
|
-
if (this.flags & enums.kdfFlags.replace_kdf_params) {
|
|
15297
|
-
const fieldLength = input[readBytes] + 1; // account for length
|
|
15298
|
-
this.replacementKDFParams = input.slice(readBytes, readBytes + fieldLength);
|
|
15299
|
-
readBytes += fieldLength;
|
|
15300
|
-
}
|
|
15304
|
+
if (this.version === VERSION_FORWARDING) {
|
|
15305
|
+
const fingerprintLength = totalBytes - readBytes + 1; // acount for length byte
|
|
15306
|
+
this.replacementFingerprint = input.slice(readBytes, readBytes + fingerprintLength);
|
|
15307
|
+
readBytes += fingerprintLength;
|
|
15301
15308
|
}
|
|
15302
15309
|
return readBytes;
|
|
15303
15310
|
}
|
|
15304
15311
|
|
|
15305
15312
|
/**
|
|
15306
15313
|
* Write KDFParams to an Uint8Array
|
|
15314
|
+
* @param {Boolean} [forReplacementParams] - forwarding only: whether to serialize data to use for replacement params
|
|
15307
15315
|
* @returns {Uint8Array} Array with the KDFParams value
|
|
15308
15316
|
*/
|
|
15309
|
-
write() {
|
|
15310
|
-
if (!this.version || this.version === 1) {
|
|
15317
|
+
write(forReplacementParams) {
|
|
15318
|
+
if (!this.version || this.version === 1 || forReplacementParams) {
|
|
15311
15319
|
return new Uint8Array([3, 1, this.hash, this.cipher]);
|
|
15312
15320
|
}
|
|
15313
15321
|
|
|
15314
|
-
const
|
|
15315
|
-
new Uint8Array([
|
|
15316
|
-
|
|
15317
|
-
|
|
15322
|
+
const forwardingFields = util.concatUint8Array([
|
|
15323
|
+
new Uint8Array([
|
|
15324
|
+
3 + this.replacementFingerprint.length,
|
|
15325
|
+
this.version,
|
|
15326
|
+
this.hash,
|
|
15327
|
+
this.cipher
|
|
15328
|
+
]),
|
|
15329
|
+
this.replacementFingerprint
|
|
15318
15330
|
]);
|
|
15319
15331
|
|
|
15320
|
-
|
|
15321
|
-
v2Fields[0] = v2Fields.length - 1;
|
|
15322
|
-
return new Uint8Array(v2Fields);
|
|
15332
|
+
return forwardingFields;
|
|
15323
15333
|
}
|
|
15324
15334
|
}
|
|
15325
15335
|
|
|
@@ -24289,6 +24299,9 @@ var openpgp = (function (exports) {
|
|
|
24289
24299
|
* @async
|
|
24290
24300
|
*/
|
|
24291
24301
|
async read(bytes, allowedPackets, config$1 = config) {
|
|
24302
|
+
if (config$1.additionalAllowedPackets.length) {
|
|
24303
|
+
allowedPackets = { ...allowedPackets, ...util.constructAllowedPackets(config$1.additionalAllowedPackets) };
|
|
24304
|
+
}
|
|
24292
24305
|
this.stream = transformPair(bytes, async (readable, writable) => {
|
|
24293
24306
|
const writer = getWriter(writable);
|
|
24294
24307
|
try {
|
|
@@ -27842,7 +27855,8 @@ var openpgp = (function (exports) {
|
|
|
27842
27855
|
|
|
27843
27856
|
return !signature.keyFlags ||
|
|
27844
27857
|
(signature.keyFlags[0] & enums.keyFlags.encryptCommunication) !== 0 ||
|
|
27845
|
-
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0
|
|
27858
|
+
(signature.keyFlags[0] & enums.keyFlags.encryptStorage) !== 0 ||
|
|
27859
|
+
(config.allowForwardedMessages && (signature.keyFlags[0] & enums.keyFlags.forwardedCommunication) !== 0);
|
|
27846
27860
|
}
|
|
27847
27861
|
|
|
27848
27862
|
/**
|
|
@@ -28790,7 +28804,7 @@ var openpgp = (function (exports) {
|
|
|
28790
28804
|
throw exception || new Error('Could not find primary user');
|
|
28791
28805
|
}
|
|
28792
28806
|
await Promise.all(users.map(async function (a) {
|
|
28793
|
-
return a.
|
|
28807
|
+
return a.selfCertification.revoked || a.user.isRevoked(a.selfCertification, null, date, config$1);
|
|
28794
28808
|
}));
|
|
28795
28809
|
// sort by primary user flag and signature creation time
|
|
28796
28810
|
const primaryUser = users.sort(function(a, b) {
|
|
@@ -29013,7 +29027,8 @@ var openpgp = (function (exports) {
|
|
|
29013
29027
|
|
|
29014
29028
|
results.push(...signatures.map(
|
|
29015
29029
|
signature => ({
|
|
29016
|
-
userID: user.userID.userID,
|
|
29030
|
+
userID: user.userID ? user.userID.userID : null,
|
|
29031
|
+
userAttribute: user.userAttribute,
|
|
29017
29032
|
keyID: signature.keyID,
|
|
29018
29033
|
valid: signature.valid
|
|
29019
29034
|
}))
|
|
@@ -44748,6 +44763,7 @@ var openpgp = (function (exports) {
|
|
|
44748
44763
|
exports.AEADEncryptedDataPacket = AEADEncryptedDataPacket;
|
|
44749
44764
|
exports.CleartextMessage = CleartextMessage;
|
|
44750
44765
|
exports.CompressedDataPacket = CompressedDataPacket;
|
|
44766
|
+
exports.KDFParams = KDFParams;
|
|
44751
44767
|
exports.LiteralDataPacket = LiteralDataPacket;
|
|
44752
44768
|
exports.MarkerPacket = MarkerPacket;
|
|
44753
44769
|
exports.Message = Message;
|