@protontech/openpgp 5.3.1 → 5.4.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 +22 -18
- 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 +22 -18
- 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 +22 -18
- package/dist/openpgp.js +22 -18
- 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 +22 -18
- package/openpgp.d.ts +1 -0
- package/package.json +1 -1
package/dist/openpgp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! OpenPGP.js v5.
|
|
1
|
+
/*! OpenPGP.js v5.4.0 - 2022-08-08 - 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');
|
|
@@ -2001,12 +2001,12 @@ const util = {
|
|
|
2001
2001
|
},
|
|
2002
2002
|
|
|
2003
2003
|
/**
|
|
2004
|
-
* Remove trailing spaces and tabs from each line
|
|
2004
|
+
* Remove trailing spaces, carriage returns and tabs from each line
|
|
2005
2005
|
*/
|
|
2006
2006
|
removeTrailingSpaces: function(text) {
|
|
2007
2007
|
return text.split('\n').map(line => {
|
|
2008
2008
|
let i = line.length - 1;
|
|
2009
|
-
for (; i >= 0 && (line[i] === ' ' || line[i] === '\t'); i--);
|
|
2009
|
+
for (; i >= 0 && (line[i] === ' ' || line[i] === '\t' || line[i] === '\r'); i--);
|
|
2010
2010
|
return line.substr(0, i + 1);
|
|
2011
2011
|
}).join('\n');
|
|
2012
2012
|
},
|
|
@@ -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.4.0',
|
|
2888
2888
|
/**
|
|
2889
2889
|
* @memberof module:config
|
|
2890
2890
|
* @property {String} commentString A comment string to be included in armored messages
|
|
@@ -14288,16 +14288,17 @@ function parsePrivateKeyParams(algo, bytes, publicParams) {
|
|
|
14288
14288
|
}
|
|
14289
14289
|
case enums.publicKey.hmac: {
|
|
14290
14290
|
const { cipher: algo } = publicParams;
|
|
14291
|
-
const keySize = hash.getHashByteLength(algo);
|
|
14291
|
+
const keySize = hash.getHashByteLength(algo.getValue());
|
|
14292
14292
|
const hashSeed = bytes.subarray(read, read + 32); read += 32;
|
|
14293
|
-
const
|
|
14294
|
-
return { read, privateParams: {
|
|
14293
|
+
const keyMaterial = bytes.subarray(read, read + keySize); read += keySize;
|
|
14294
|
+
return { read, privateParams: { hashSeed, keyMaterial } };
|
|
14295
14295
|
}
|
|
14296
14296
|
case enums.publicKey.aead: {
|
|
14297
14297
|
const { cipher: algo } = publicParams;
|
|
14298
|
+
const hashSeed = bytes.subarray(read, read + 32); read += 32;
|
|
14298
14299
|
const { keySize } = getCipher(algo.getValue());
|
|
14299
14300
|
const keyMaterial = bytes.subarray(read, read + keySize); read += keySize;
|
|
14300
|
-
return { read, privateParams: { keyMaterial } };
|
|
14301
|
+
return { read, privateParams: { hashSeed, keyMaterial } };
|
|
14301
14302
|
}
|
|
14302
14303
|
default:
|
|
14303
14304
|
throw new UnsupportedError('Unknown public key encryption algorithm.');
|
|
@@ -14343,13 +14344,12 @@ function parseEncSessionKeyParams(algo, bytes) {
|
|
|
14343
14344
|
// - An authentication tag generated by the AEAD mode.
|
|
14344
14345
|
case enums.publicKey.aead: {
|
|
14345
14346
|
const aeadMode = new AEADEnum(); read += aeadMode.read(bytes.subarray(read));
|
|
14346
|
-
const {
|
|
14347
|
+
const { ivLength } = getAEADMode(aeadMode.getValue());
|
|
14347
14348
|
|
|
14348
14349
|
const iv = bytes.subarray(read, read + ivLength); read += ivLength;
|
|
14349
14350
|
const c = new ShortByteString(); read += c.read(bytes.subarray(read));
|
|
14350
|
-
const t = bytes.subarray(read, read + tagLength);
|
|
14351
14351
|
|
|
14352
|
-
return { aeadMode, iv, c
|
|
14352
|
+
return { aeadMode, iv, c };
|
|
14353
14353
|
}
|
|
14354
14354
|
default:
|
|
14355
14355
|
throw new UnsupportedError('Unknown public key encryption algorithm.');
|
|
@@ -14443,8 +14443,8 @@ async function createSymmetricParams(key, algo) {
|
|
|
14443
14443
|
const bindingHash = await hash.sha256(seed);
|
|
14444
14444
|
return {
|
|
14445
14445
|
privateParams: {
|
|
14446
|
-
|
|
14447
|
-
|
|
14446
|
+
hashSeed: seed,
|
|
14447
|
+
keyMaterial: key
|
|
14448
14448
|
},
|
|
14449
14449
|
publicParams: {
|
|
14450
14450
|
cipher: algo,
|
|
@@ -14497,14 +14497,14 @@ async function validateParams$6(algo, publicParams, privateParams) {
|
|
|
14497
14497
|
}
|
|
14498
14498
|
case enums.publicKey.hmac: {
|
|
14499
14499
|
const { cipher: algo, digest } = publicParams;
|
|
14500
|
-
const {
|
|
14501
|
-
const keySize = hash.getHashByteLength(algo);
|
|
14500
|
+
const { hashSeed, keyMaterial } = privateParams;
|
|
14501
|
+
const keySize = hash.getHashByteLength(algo.getValue());
|
|
14502
14502
|
return keySize === keyMaterial.length &&
|
|
14503
14503
|
util.equalsUint8Array(digest, await hash.sha256(hashSeed));
|
|
14504
14504
|
}
|
|
14505
14505
|
case enums.publicKey.aead: {
|
|
14506
14506
|
const { cipher: algo, digest } = publicParams;
|
|
14507
|
-
const {
|
|
14507
|
+
const { hashSeed, keyMaterial } = privateParams;
|
|
14508
14508
|
const { keySize } = getCipher(algo.getValue());
|
|
14509
14509
|
return keySize === keyMaterial.length &&
|
|
14510
14510
|
util.equalsUint8Array(digest, await hash.sha256(hashSeed));
|
|
@@ -30488,7 +30488,7 @@ class CleartextMessage {
|
|
|
30488
30488
|
* @param {Signature} signature - The detached signature or an empty signature for unsigned messages
|
|
30489
30489
|
*/
|
|
30490
30490
|
constructor(text, signature) {
|
|
30491
|
-
// normalize EOL to canonical form <CR><LF>
|
|
30491
|
+
// remove trailing whitespace and normalize EOL to canonical form <CR><LF>
|
|
30492
30492
|
this.text = util.removeTrailingSpaces(text).replace(/\r?\n/g, '\r\n');
|
|
30493
30493
|
if (signature && !(signature instanceof Signature)) {
|
|
30494
30494
|
throw new Error('Invalid signature input');
|
|
@@ -30889,7 +30889,7 @@ async function encryptKey({ privateKey, passphrase, config, ...rest }) {
|
|
|
30889
30889
|
|
|
30890
30890
|
|
|
30891
30891
|
/**
|
|
30892
|
-
* Encrypts a message using public keys, passwords or both at once. At least one of `encryptionKeys` or `
|
|
30892
|
+
* Encrypts a message using public keys, passwords or both at once. At least one of `encryptionKeys`, `passwords` or `sessionKeys`
|
|
30893
30893
|
* must be specified. If signing keys are specified, those will be used to sign the message.
|
|
30894
30894
|
* @param {Object} options
|
|
30895
30895
|
* @param {Message} options.message - Message to be encrypted as created by {@link createMessage}
|
|
@@ -31204,6 +31204,10 @@ async function encryptSessionKey({ data, algorithm, aeadAlgorithm, encryptionKey
|
|
|
31204
31204
|
if (rest.publicKeys) throw new Error('The `publicKeys` option has been removed from openpgp.encryptSessionKey, pass `encryptionKeys` instead');
|
|
31205
31205
|
const unknownOptions = Object.keys(rest); if (unknownOptions.length > 0) throw new Error(`Unknown option: ${unknownOptions.join(', ')}`);
|
|
31206
31206
|
|
|
31207
|
+
if ((!encryptionKeys || encryptionKeys.length === 0) && (!passwords || passwords.length === 0)) {
|
|
31208
|
+
throw new Error('No encryption keys or passwords provided.');
|
|
31209
|
+
}
|
|
31210
|
+
|
|
31207
31211
|
try {
|
|
31208
31212
|
const message = await Message.encryptSessionKey(data, algorithm, aeadAlgorithm, encryptionKeys, passwords, wildcard, encryptionKeyIDs, date, encryptionUserIDs, config);
|
|
31209
31213
|
return formatObject(message, format, config);
|
package/openpgp.d.ts
CHANGED
|
@@ -322,6 +322,7 @@ interface Config {
|
|
|
322
322
|
versionString: string;
|
|
323
323
|
commentString: string;
|
|
324
324
|
allowInsecureDecryptionWithSigningKeys: boolean;
|
|
325
|
+
allowInsecureVerificationWithReformattedKeys: boolean;
|
|
325
326
|
constantTimePKCS1Decryption: boolean;
|
|
326
327
|
constantTimePKCS1DecryptionSupportedSymmetricAlgorithms: Set<enums.symmetric>;
|
|
327
328
|
v5Keys: boolean;
|
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.4.0",
|
|
5
5
|
"license": "LGPL-3.0+",
|
|
6
6
|
"homepage": "https://openpgpjs.org/",
|
|
7
7
|
"engines": {
|