Use V5 keys by default (#1063)

This commit is contained in:
larabr 2020-03-26 17:57:10 +01:00 committed by Daniel Huigens
parent a7640bce52
commit 4c93abb9f9
4 changed files with 45 additions and 34 deletions

View File

@ -69,12 +69,11 @@ export default {
aead_chunk_size_byte: 12, aead_chunk_size_byte: 12,
/** /**
* Use V5 keys. * Use V5 keys.
* **NOT INTEROPERABLE WITH OTHER OPENPGP IMPLEMENTATIONS** * Note: not all OpenPGP implementations are compatible with this option
* **FUTURE OPENPGP.JS VERSIONS MAY BREAK COMPATIBILITY WHEN USING THIS OPTION**
* @memberof module:config * @memberof module:config
* @property {Boolean} v5_keys * @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}: * {@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) * Iteration Count Byte for S2K (String to Key)

View File

@ -99,8 +99,6 @@ function Signature(date = new Date()) {
/** /**
* parsing function for a signature packet (tag 2). * parsing function for a signature packet (tag 2).
* @param {String} bytes payload of a tag 2 packet * @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 * @returns {module:packet.Signature} object representation
*/ */
Signature.prototype.read = function (bytes) { Signature.prototype.read = function (bytes) {

View File

@ -2545,6 +2545,8 @@ function versionSpecificTests() {
describe('Key', function() { describe('Key', function() {
let rsaGenStub; let rsaGenStub;
let v5_keysVal;
let aead_protectVal;
let rsaGenValue = openpgp.crypto.publicKey.rsa.generate(openpgp.util.getWebCryptoAll() ? 2048 : 512, "10001"); let rsaGenValue = openpgp.crypto.publicKey.rsa.generate(openpgp.util.getWebCryptoAll() ? 2048 : 512, "10001");
beforeEach(function() { beforeEach(function() {
@ -2557,11 +2559,25 @@ describe('Key', function() {
}); });
tryTests('V4', versionSpecificTests, { 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, { tryTests('V4 - With Worker', versionSpecificTests, {
if: typeof window !== 'undefined' && window.Worker, 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() { before: async function() {
try { try {
await openpgp.initWorker({ path: '../dist/openpgp.worker.js' }); await openpgp.initWorker({ path: '../dist/openpgp.worker.js' });
@ -2574,8 +2590,6 @@ describe('Key', function() {
} }
}); });
let v5_keysVal;
let aead_protectVal;
tryTests('V5', versionSpecificTests, { tryTests('V5', versionSpecificTests, {
if: !openpgp.config.ci, if: !openpgp.config.ci,
beforeEach: function() { beforeEach: function() {

View File

@ -925,9 +925,9 @@ V+HOQJQxXJkVRYa3QrFUehiMzTeqqMdgC6ZqJy7+
literal.setText(testText); literal.setText(testText);
signature.hashAlgorithm = 'sha256'; signature.hashAlgorithm = openpgp.enums.hash.sha256;
signature.publicKeyAlgorithm = 'rsa_sign'; signature.publicKeyAlgorithm = openpgp.enums.publicKey.rsa_sign;
signature.signatureType = 'text'; signature.signatureType = openpgp.enums.signature.text;
return signature.sign(key, literal).then(async () => { return signature.sign(key, literal).then(async () => {