diff --git a/src/config/config.js b/src/config/config.js index 3f4b7776b..359accf5d 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -69,12 +69,11 @@ export default { aead_chunk_size_byte: 12, /** * Use V5 keys. - * **NOT INTEROPERABLE WITH OTHER OPENPGP IMPLEMENTATIONS** - * **FUTURE OPENPGP.JS VERSIONS MAY BREAK COMPATIBILITY WHEN USING THIS OPTION** + * Note: not all OpenPGP implementations are compatible with this option * @memberof module:config * @property {Boolean} v5_keys */ - v5_keys: false, + v5_keys: true, /** * {@link https://tools.ietf.org/html/rfc4880#section-3.7.1.3|RFC4880 3.7.1.3}: * Iteration Count Byte for S2K (String to Key) diff --git a/src/packet/signature.js b/src/packet/signature.js index 1e04357fd..69fc711b7 100644 --- a/src/packet/signature.js +++ b/src/packet/signature.js @@ -99,8 +99,6 @@ function Signature(date = new Date()) { /** * parsing function for a signature packet (tag 2). * @param {String} bytes payload of a tag 2 packet - * @param {Integer} position position to start reading from the bytes string - * @param {Integer} len length of the packet or the remaining length of bytes at position * @returns {module:packet.Signature} object representation */ Signature.prototype.read = function (bytes) { diff --git a/test/general/key.js b/test/general/key.js index 14e0e2287..d485db076 100644 --- a/test/general/key.js +++ b/test/general/key.js @@ -2496,6 +2496,8 @@ function versionSpecificTests() { describe('Key', function() { let rsaGenStub; + let v5_keysVal; + let aead_protectVal; let rsaGenValue = openpgp.crypto.publicKey.rsa.generate(openpgp.util.getWebCryptoAll() ? 2048 : 512, "10001"); beforeEach(function() { @@ -2508,11 +2510,25 @@ describe('Key', function() { }); tryTests('V4', versionSpecificTests, { - if: !openpgp.config.ci + if: !openpgp.config.ci, + beforeEach: function() { + v5_keysVal = openpgp.config.v5_keys; + openpgp.config.v5_keys = false; + }, + afterEach: function() { + openpgp.config.v5_keys = v5_keysVal; + } }); tryTests('V4 - With Worker', versionSpecificTests, { if: typeof window !== 'undefined' && window.Worker, + beforeEach: function() { + v5_keysVal = openpgp.config.v5_keys; + openpgp.config.v5_keys = false; + }, + afterEach: function() { + openpgp.config.v5_keys = v5_keysVal; + }, before: async function() { try { await openpgp.initWorker({ path: '../dist/openpgp.worker.js' }); @@ -2525,8 +2541,6 @@ describe('Key', function() { } }); - let v5_keysVal; - let aead_protectVal; tryTests('V5', versionSpecificTests, { if: !openpgp.config.ci, beforeEach: function() { diff --git a/test/general/packet.js b/test/general/packet.js index 31e37d187..d22dd5307 100644 --- a/test/general/packet.js +++ b/test/general/packet.js @@ -910,41 +910,41 @@ V+HOQJQxXJkVRYa3QrFUehiMzTeqqMdgC6ZqJy7+ const keySize = openpgp.util.getWebCryptoAll() ? 2048 : 512; // webkit webcrypto accepts minimum 2048 bit keys return rsa.generate(keySize, "10001").then(function(mpiGen) { - let mpi = [mpiGen.n, mpiGen.e, mpiGen.d, mpiGen.p, mpiGen.q, mpiGen.u]; - mpi = mpi.map(function(k) { - return new openpgp.MPI(k); - }); - const testText = input.createSomeMessage(); + let mpi = [mpiGen.n, mpiGen.e, mpiGen.d, mpiGen.p, mpiGen.q, mpiGen.u]; + mpi = mpi.map(function(k) { + return new openpgp.MPI(k); + }); + const testText = input.createSomeMessage(); - key.params = mpi; - key.algorithm = "rsa_sign"; + key.params = mpi; + key.algorithm = "rsa_sign"; - const signed = new openpgp.packet.List(); - const literal = new openpgp.packet.Literal(); - const signature = new openpgp.packet.Signature(); + const signed = new openpgp.packet.List(); + const literal = new openpgp.packet.Literal(); + const signature = new openpgp.packet.Signature(); - literal.setText(testText); + literal.setText(testText); - signature.hashAlgorithm = 'sha256'; - signature.publicKeyAlgorithm = 'rsa_sign'; - signature.signatureType = 'text'; + signature.hashAlgorithm = openpgp.enums.hash.sha256; + signature.publicKeyAlgorithm = openpgp.enums.publicKey.rsa_sign; + signature.signatureType = openpgp.enums.signature.text; - return signature.sign(key, literal).then(async () => { + return signature.sign(key, literal).then(async () => { - signed.push(literal); - signed.push(signature); + signed.push(literal); + signed.push(signature); - const raw = signed.write(); + const raw = signed.write(); - const signed2 = new openpgp.packet.List(); - await signed2.read(raw); - signed2.concat(await openpgp.stream.readToEnd(signed2.stream, arr => arr)); + const signed2 = new openpgp.packet.List(); + await signed2.read(raw); + signed2.concat(await openpgp.stream.readToEnd(signed2.stream, arr => arr)); - await Promise.all([ - expect(signed2[1].verify(key, openpgp.enums.signature.text, signed2[0])).to.eventually.be.true, - openpgp.stream.pipe(signed2[0].getBytes(), new openpgp.stream.WritableStream()) - ]); - }); + await Promise.all([ + expect(signed2[1].verify(key, openpgp.enums.signature.text, signed2[0])).to.eventually.be.true, + openpgp.stream.pipe(signed2[0].getBytes(), new openpgp.stream.WritableStream()) + ]); + }); }); }); });