Make signature.verified a Promise instead of result.signatures

Also, fix verifying detached signatures
This commit is contained in:
Daniel Huigens 2018-06-25 20:33:38 +02:00
parent 0db32bea39
commit 9f0f00e087
7 changed files with 100 additions and 81 deletions

View File

@ -542,23 +542,36 @@ Message.prototype.verify = async function(keys, date=new Date(), asStream) {
if (literalDataList.length !== 1) { if (literalDataList.length !== 1) {
throw new Error('Can only verify message with one literal data packet.'); throw new Error('Can only verify message with one literal data packet.');
} }
if (msg.packets.stream) {
const onePassSigList = msg.packets.filterByTag(enums.packet.onePassSignature); const onePassSigList = msg.packets.filterByTag(enums.packet.onePassSignature);
const signatureList = msg.packets.filterByTag(enums.packet.signature);
if (onePassSigList.length && !signatureList.length && msg.packets.stream) {
onePassSigList.forEach(onePassSig => { onePassSigList.forEach(onePassSig => {
onePassSig.signatureData = stream.fromAsync(() => new Promise(resolve => { onePassSig.correspondingSig = new Promise(resolve => {
onePassSig.signatureDataResolve = resolve; onePassSig.correspondingSigResolve = resolve;
})); });
onePassSig.signatureData = stream.fromAsync(async () => (await onePassSig.correspondingSig).signatureData);
onePassSig.hashed = onePassSig.hash(literalDataList[0], undefined, asStream); onePassSig.hashed = onePassSig.hash(literalDataList[0], undefined, asStream);
}); });
return stream.transform(msg.packets.stream, signature => { const verificationObjects = await createVerificationObjects(onePassSigList, literalDataList, keys, date);
const onePassSig = onePassSigList.pop(); msg.packets.stream = stream.transformPair(msg.packets.stream, async (readable, writable) => {
onePassSig.signatureDataResolve(signature.signatureData); const writer = stream.getWriter(writable);
signature.hashed = onePassSig.hashed; try {
signature.hashedData = onePassSig.hashedData; await stream.readToEnd(stream.transform(readable, signature => {
return createVerificationObject(signature, literalDataList, keys, date); onePassSigList.pop().correspondingSigResolve(signature);
}));
await writer.ready;
await writer.close();
} catch(e) {
onePassSigList.forEach(onePassSig => {
onePassSig.correspondingSigResolve({
verify: () => undefined
}); });
});
await writer.abort(e);
}
});
return verificationObjects.reverse();
} }
const signatureList = msg.packets.filterByTag(enums.packet.signature);
return createVerificationObjects(signatureList, literalDataList, keys, date); return createVerificationObjects(signatureList, literalDataList, keys, date);
}; };
@ -603,12 +616,14 @@ async function createVerificationObject(signature, literalDataList, keys, date=n
const verifiedSig = { const verifiedSig = {
keyid: signature.issuerKeyId, keyid: signature.issuerKeyId,
valid: keyPacket ? await signature.verify(keyPacket, literalDataList[0]) : null verified: keyPacket ? signature.verify(keyPacket, literalDataList[0]) : Promise.resolve(null)
}; };
verifiedSig.signature = Promise.resolve(signature.correspondingSig || signature).then(signature => {
const packetlist = new packet.List(); const packetlist = new packet.List();
packetlist.push(signature); packetlist.push(signature);
verifiedSig.signature = new Signature(packetlist); return new Signature(packetlist);
});
return verifiedSig; return verifiedSig;
} }

View File

@ -364,26 +364,27 @@ export function decrypt({ message, privateKeys, passwords, sessionKeys, publicKe
} }
const result = {}; const result = {};
let signatures = signature ? decrypted.verifyDetached(signature, publicKeys, date) : decrypted.verify(publicKeys, date, asStream); result.signatures = signature ? await decrypted.verifyDetached(signature, publicKeys, date) : await decrypted.verify(publicKeys, date, asStream);
result.data = format === 'binary' ? decrypted.getLiteralData() : decrypted.getText(); result.data = format === 'binary' ? decrypted.getLiteralData() : decrypted.getText();
result.data = await convertStream(result.data, asStream); result.data = await convertStream(result.data, asStream);
signatures = signatures.then(signatures => stream.readToEnd(signatures, arr => arr));
if (asStream) { if (asStream) {
result.signatures = signatures.catch(() => []);
result.data = stream.transformPair(message.packets.stream, async (readable, writable) => { result.data = stream.transformPair(message.packets.stream, async (readable, writable) => {
await stream.pipe(result.data, writable, { await stream.pipe(result.data, writable, {
preventClose: true preventClose: true
}); });
const writer = stream.getWriter(writable); const writer = stream.getWriter(writable);
try { try {
await signatures; await stream.readToEnd(decrypted.packets.stream, arr => arr);
await writer.close(); await writer.close();
} catch(e) { } catch(e) {
await writer.abort(e); await writer.abort(e);
} }
}); });
} else { } else {
result.signatures = await signatures; await Promise.all(result.signatures.map(async signature => {
signature.signature = await signature.signature;
signature.valid = await signature.verified;
}));
} }
result.filename = decrypted.getFilename(); result.filename = decrypted.getFilename();
return result; return result;
@ -466,26 +467,27 @@ export function verify({ message, publicKeys, asStream=message.fromStream, signa
return Promise.resolve().then(async function() { return Promise.resolve().then(async function() {
const result = {}; const result = {};
const signatures = signature ? await message.verifyDetached(signature, publicKeys, date) : await message.verify(publicKeys, date, asStream); result.signatures = signature ? await message.verifyDetached(signature, publicKeys, date) : await message.verify(publicKeys, date, asStream);
result.data = message instanceof CleartextMessage ? message.getText() : message.getLiteralData(); result.data = message instanceof CleartextMessage ? message.getText() : message.getLiteralData();
result.data = await convertStream(result.data, asStream); result.data = await convertStream(result.data, asStream);
if (asStream) { if (asStream) {
result.data = stream.transformPair(signatures, async (readable, writable) => { result.data = stream.transformPair(message.packets.stream, async (readable, writable) => {
const signatures = stream.readToEnd(readable, arr => arr);
result.signatures = signatures.catch(() => []);
await stream.pipe(result.data, writable, { await stream.pipe(result.data, writable, {
preventClose: true preventClose: true
}); });
const writer = stream.getWriter(writable); const writer = stream.getWriter(writable);
try { try {
await signatures; await stream.readToEnd(readable, arr => arr);
await writer.close(); await writer.close();
} catch(e) { } catch(e) {
await writer.abort(e); await writer.abort(e);
} }
}); });
} else { } else {
result.signatures = await stream.readToEnd(signatures, arr => arr); await Promise.all(result.signatures.map(async signature => {
signature.signature = await signature.signature;
signature.valid = await signature.verified;
}));
} }
return result; return result;
}).catch(onError.bind(null, 'Error verifying cleartext signed message')); }).catch(onError.bind(null, 'Error verifying cleartext signed message'));

View File

@ -69,18 +69,20 @@ export function clonePackets(options) {
options.signature = options.signature.packets; options.signature = options.signature.packets;
} }
if (options.signatures) { if (options.signatures) {
if (options.signatures instanceof Promise) {
const signatures = options.signatures;
options.signatures = stream.fromAsync(async () => (await signatures).map(verificationObjectToClone));
} else {
options.signatures.forEach(verificationObjectToClone); options.signatures.forEach(verificationObjectToClone);
} }
}
return options; return options;
} }
function verificationObjectToClone(verObject) { function verificationObjectToClone(verObject) {
if (verObject.signature instanceof Promise) {
const signature = verObject.signature;
verObject.signature = stream.fromAsync(async () => (await signature).packets);
} else {
verObject.signature = verObject.signature.packets; verObject.signature = verObject.signature.packets;
}
const verified = verObject.verified;
verObject.verified = stream.fromAsync(() => verified);
return verObject; return verObject;
} }
@ -116,12 +118,8 @@ export function parseClonedPackets(options) {
options.message = packetlistCloneToMessage(options.message); options.message = packetlistCloneToMessage(options.message);
} }
if (options.signatures) { if (options.signatures) {
if (util.isStream(options.signatures)) {
options.signatures = stream.readToEnd(options.signatures, arr => arr).then(signatures => signatures.map(packetlistCloneToSignatures));
} else {
options.signatures = options.signatures.map(packetlistCloneToSignatures); options.signatures = options.signatures.map(packetlistCloneToSignatures);
} }
}
if (options.signature) { if (options.signature) {
options.signature = packetlistCloneToSignature(options.signature); options.signature = packetlistCloneToSignature(options.signature);
} }
@ -146,8 +144,12 @@ function packetlistCloneToCleartextMessage(clone) {
//verification objects //verification objects
function packetlistCloneToSignatures(clone) { function packetlistCloneToSignatures(clone) {
clone.keyid = type_keyid.fromClone(clone.keyid); clone.keyid = type_keyid.fromClone(clone.keyid);
const packetlist = List.fromStructuredClone(clone.signature); if (util.isStream(clone.signature)) {
clone.signature = new Signature(packetlist); clone.signature = stream.readToEnd(clone.signature, ([signature]) => new Signature(List.fromStructuredClone(signature)));
} else {
clone.signature = new Signature(List.fromStructuredClone(clone.signature));
}
clone.verified = stream.readToEnd(clone.verified, ([verified]) => verified);
return clone; return clone;
} }

View File

@ -140,4 +140,10 @@ OnePassSignature.prototype.toHash = Signature.prototype.toHash;
OnePassSignature.prototype.toSign = Signature.prototype.toSign; OnePassSignature.prototype.toSign = Signature.prototype.toSign;
OnePassSignature.prototype.calculateTrailer = Signature.prototype.calculateTrailer; OnePassSignature.prototype.calculateTrailer = Signature.prototype.calculateTrailer;
OnePassSignature.prototype.verify = async function() {
const correspondingSig = await this.correspondingSig;
correspondingSig.hashed = this.hashed;
return correspondingSig.verify.apply(correspondingSig, arguments);
};
export default OnePassSignature; export default OnePassSignature;

View File

@ -1827,14 +1827,13 @@ describe('OpenPGP.js public api tests', function() {
const literals = packets.packets.filterByTag(openpgp.enums.packet.literal); const literals = packets.packets.filterByTag(openpgp.enums.packet.literal);
expect(literals.length).to.equal(1); expect(literals.length).to.equal(1);
expect(+literals[0].date).to.equal(+past); expect(+literals[0].date).to.equal(+past);
let signatures = await packets.verify(encryptOpt.publicKeys, past); const signatures = await packets.verify(encryptOpt.publicKeys, past);
expect(await openpgp.stream.readToEnd(packets.getText())).to.equal(plaintext); expect(await openpgp.stream.readToEnd(packets.getText())).to.equal(plaintext);
signatures = await openpgp.stream.readToEnd(signatures, arr => arr); expect(+(await signatures[0].signature).packets[0].created).to.equal(+past);
expect(+signatures[0].signature.packets[0].created).to.equal(+past); expect(await signatures[0].verified).to.be.true;
expect(signatures[0].valid).to.be.true;
expect(encryptOpt.privateKeys[0].getSigningKey(signatures[0].keyid, past)) expect(encryptOpt.privateKeys[0].getSigningKey(signatures[0].keyid, past))
.to.be.not.null; .to.be.not.null;
expect(signatures[0].signature.packets.length).to.equal(1); expect((await signatures[0].signature).packets.length).to.equal(1);
}); });
}); });
@ -1856,14 +1855,13 @@ describe('OpenPGP.js public api tests', function() {
expect(literals.length).to.equal(1); expect(literals.length).to.equal(1);
expect(literals[0].format).to.equal('binary'); expect(literals[0].format).to.equal('binary');
expect(+literals[0].date).to.equal(+future); expect(+literals[0].date).to.equal(+future);
let signatures = await packets.verify(encryptOpt.publicKeys, future); const signatures = await packets.verify(encryptOpt.publicKeys, future);
expect(await openpgp.stream.readToEnd(packets.getLiteralData())).to.deep.equal(data); expect(await openpgp.stream.readToEnd(packets.getLiteralData())).to.deep.equal(data);
signatures = await openpgp.stream.readToEnd(signatures, arr => arr); expect(+(await signatures[0].signature).packets[0].created).to.equal(+future);
expect(+signatures[0].signature.packets[0].created).to.equal(+future); expect(await signatures[0].verified).to.be.true;
expect(signatures[0].valid).to.be.true;
expect(encryptOpt.privateKeys[0].getSigningKey(signatures[0].keyid, future)) expect(encryptOpt.privateKeys[0].getSigningKey(signatures[0].keyid, future))
.to.be.not.null; .to.be.not.null;
expect(signatures[0].signature.packets.length).to.equal(1); expect((await signatures[0].signature).packets.length).to.equal(1);
}); });
}); });
@ -1886,14 +1884,13 @@ describe('OpenPGP.js public api tests', function() {
expect(literals.length).to.equal(1); expect(literals.length).to.equal(1);
expect(literals[0].format).to.equal('mime'); expect(literals[0].format).to.equal('mime');
expect(+literals[0].date).to.equal(+future); expect(+literals[0].date).to.equal(+future);
let signatures = await packets.verify(encryptOpt.publicKeys, future); const signatures = await packets.verify(encryptOpt.publicKeys, future);
expect(await openpgp.stream.readToEnd(packets.getLiteralData())).to.deep.equal(data); expect(await openpgp.stream.readToEnd(packets.getLiteralData())).to.deep.equal(data);
signatures = await openpgp.stream.readToEnd(signatures, arr => arr); expect(+(await signatures[0].signature).packets[0].created).to.equal(+future);
expect(+signatures[0].signature.packets[0].created).to.equal(+future); expect(await signatures[0].verified).to.be.true;
expect(signatures[0].valid).to.be.true;
expect(encryptOpt.privateKeys[0].getSigningKey(signatures[0].keyid, future)) expect(encryptOpt.privateKeys[0].getSigningKey(signatures[0].keyid, future))
.to.be.not.null; .to.be.not.null;
expect(signatures[0].signature.packets.length).to.equal(1); expect((await signatures[0].signature).packets.length).to.equal(1);
}); });
}); });

View File

@ -344,11 +344,10 @@ describe("Signature", function() {
return msg.decrypt([priv_key_gnupg_ext]).then(function(msg) { return msg.decrypt([priv_key_gnupg_ext]).then(function(msg) {
return msg.verify([pub_key]).then(async verified => { return msg.verify([pub_key]).then(async verified => {
openpgp.stream.pipe(msg.getLiteralData(), new WritableStream()); openpgp.stream.pipe(msg.getLiteralData(), new WritableStream());
verified = await openpgp.stream.readToEnd(verified, arr => arr);
expect(verified).to.exist; expect(verified).to.exist;
expect(verified).to.have.length(1); expect(verified).to.have.length(1);
expect(verified[0].valid).to.be.true; expect(await verified[0].verified).to.be.true;
expect(verified[0].signature.packets.length).to.equal(1); expect((await verified[0].signature).packets.length).to.equal(1);
}); });
}); });
}); });
@ -370,11 +369,10 @@ describe("Signature", function() {
const pub_key = (await openpgp.key.readArmored(pub_key_arm2)).keys[0]; const pub_key = (await openpgp.key.readArmored(pub_key_arm2)).keys[0];
return sMsg.verify([pub_key]).then(async verified => { return sMsg.verify([pub_key]).then(async verified => {
openpgp.stream.pipe(sMsg.getLiteralData(), new WritableStream()); openpgp.stream.pipe(sMsg.getLiteralData(), new WritableStream());
verified = await openpgp.stream.readToEnd(verified, arr => arr);
expect(verified).to.exist; expect(verified).to.exist;
expect(verified).to.have.length(1); expect(verified).to.have.length(1);
expect(verified[0].valid).to.be.true; expect(await verified[0].verified).to.be.true;
expect(verified[0].signature.packets.length).to.equal(1); expect((await verified[0].signature).packets.length).to.equal(1);
}); });
}); });
@ -442,13 +440,12 @@ describe("Signature", function() {
return sMsg.verify([pubKey2, pubKey3]).then(async verifiedSig => { return sMsg.verify([pubKey2, pubKey3]).then(async verifiedSig => {
expect(await openpgp.stream.readToEnd(sMsg.getText())).to.equal(plaintext); expect(await openpgp.stream.readToEnd(sMsg.getText())).to.equal(plaintext);
verifiedSig = await openpgp.stream.readToEnd(verifiedSig, arr => arr);
expect(verifiedSig).to.exist; expect(verifiedSig).to.exist;
expect(verifiedSig).to.have.length(2); expect(verifiedSig).to.have.length(2);
expect(verifiedSig[0].valid).to.be.true; expect(await verifiedSig[0].verified).to.be.true;
expect(verifiedSig[1].valid).to.be.true; expect(await verifiedSig[1].verified).to.be.true;
expect(verifiedSig[0].signature.packets.length).to.equal(1); expect((await verifiedSig[0].signature).packets.length).to.equal(1);
expect(verifiedSig[1].signature.packets.length).to.equal(1); expect((await verifiedSig[1].signature).packets.length).to.equal(1);
}); });
}); });
@ -597,10 +594,9 @@ yYDnCgA=
return openpgp.verify({ publicKeys:[pubKey], message:sMsg }).then(async function(cleartextSig) { return openpgp.verify({ publicKeys:[pubKey], message:sMsg }).then(async function(cleartextSig) {
expect(cleartextSig).to.exist; expect(cleartextSig).to.exist;
expect(openpgp.util.nativeEOL(openpgp.util.Uint8Array_to_str(await openpgp.stream.readToEnd(cleartextSig.data)))).to.equal(plaintext); expect(openpgp.util.nativeEOL(openpgp.util.Uint8Array_to_str(await openpgp.stream.readToEnd(cleartextSig.data)))).to.equal(plaintext);
cleartextSig.signatures = await openpgp.stream.readToEnd(cleartextSig.signatures, arr => arr);
expect(cleartextSig.signatures).to.have.length(1); expect(cleartextSig.signatures).to.have.length(1);
expect(cleartextSig.signatures[0].valid).to.be.true; expect(await cleartextSig.signatures[0].verified).to.be.true;
expect(cleartextSig.signatures[0].signature.packets.length).to.equal(1); expect((await cleartextSig.signatures[0].signature).packets.length).to.equal(1);
}); });
}); });
@ -886,8 +882,7 @@ yYDnCgA=
await msg.appendSignature(detachedSig); await msg.appendSignature(detachedSig);
return msg.verify(publicKeys).then(async result => { return msg.verify(publicKeys).then(async result => {
openpgp.stream.pipe(msg.getLiteralData(), new WritableStream()); openpgp.stream.pipe(msg.getLiteralData(), new WritableStream());
result = await openpgp.stream.readToEnd(result, arr => arr); expect(await result[0].verified).to.be.true;
expect(result[0].valid).to.be.true;
}); });
}); });
@ -902,9 +897,9 @@ yYDnCgA=
return openpgp.generateKey(opt).then(function(gen) { return openpgp.generateKey(opt).then(function(gen) {
const generatedKey = gen.key; const generatedKey = gen.key;
return msg.signDetached([generatedKey, privKey2]).then(detachedSig => { return msg.signDetached([generatedKey, privKey2]).then(detachedSig => {
return msg.verifyDetached(detachedSig, [generatedKey.toPublic(), pubKey2]).then(result => { return msg.verifyDetached(detachedSig, [generatedKey.toPublic(), pubKey2]).then(async result => {
expect(result[0].valid).to.be.true; expect(await result[0].verified).to.be.true;
expect(result[1].valid).to.be.true; expect(await result[1].verified).to.be.true;
}); });
}); });
}); });

View File

@ -260,7 +260,7 @@ describe('Streaming', function() {
expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(1024)).to.deep.equal(plaintext[0]); expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(1024)).to.deep.equal(plaintext[0]);
if (i > 10) throw new Error('Data did not arrive early.'); if (i > 10) throw new Error('Data did not arrive early.');
expect(await openpgp.stream.readToEnd(decrypted.data)).to.deep.equal(util.concatUint8Array(plaintext)); expect(await openpgp.stream.readToEnd(decrypted.data)).to.deep.equal(util.concatUint8Array(plaintext));
expect(await decrypted.signatures).to.exist.and.have.length(0); expect(decrypted.signatures).to.exist.and.have.length(0);
} finally { } finally {
openpgp.config.unsafe_stream = unsafe_streamValue; openpgp.config.unsafe_stream = unsafe_streamValue;
} }
@ -349,7 +349,7 @@ describe('Streaming', function() {
expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(1024)).not.to.deep.equal(plaintext[0]); expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(1024)).not.to.deep.equal(plaintext[0]);
if (i > 10) throw new Error('Data did not arrive early.'); if (i > 10) throw new Error('Data did not arrive early.');
await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Modification detected.'); await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Modification detected.');
await decrypted.signatures; expect(decrypted.signatures).to.exist.and.have.length(0);
} finally { } finally {
openpgp.config.unsafe_stream = unsafe_streamValue; openpgp.config.unsafe_stream = unsafe_streamValue;
} }
@ -398,7 +398,7 @@ describe('Streaming', function() {
expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(10)).not.to.deep.equal(plaintext[0]); expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(10)).not.to.deep.equal(plaintext[0]);
if (i > 10) throw new Error('Data did not arrive early.'); if (i > 10) throw new Error('Data did not arrive early.');
await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Ascii armor integrity check on message failed'); await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Ascii armor integrity check on message failed');
expect(await decrypted.signatures).to.exist.and.have.length(0); expect(decrypted.signatures).to.exist.and.have.length(1);
} finally { } finally {
openpgp.config.unsafe_stream = unsafe_streamValue; openpgp.config.unsafe_stream = unsafe_streamValue;
} }
@ -446,7 +446,8 @@ describe('Streaming', function() {
expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(10)).not.to.deep.equal(plaintext[0]); expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(10)).not.to.deep.equal(plaintext[0]);
if (i > 10) throw new Error('Data did not arrive early.'); if (i > 10) throw new Error('Data did not arrive early.');
await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Ascii armor integrity check on message failed'); await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Ascii armor integrity check on message failed');
expect(await decrypted.signatures).to.exist.and.have.length(0); expect(decrypted.signatures).to.exist.and.have.length(1);
expect(await decrypted.signatures[0].verified).to.be.null;
} finally { } finally {
openpgp.config.unsafe_stream = unsafe_streamValue; openpgp.config.unsafe_stream = unsafe_streamValue;
} }
@ -492,7 +493,7 @@ describe('Streaming', function() {
expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(10)).not.to.deep.equal(plaintext[0]); expect(await openpgp.stream.getReader(openpgp.stream.clone(decrypted.data)).readBytes(10)).not.to.deep.equal(plaintext[0]);
if (i > 10) throw new Error('Data did not arrive early.'); if (i > 10) throw new Error('Data did not arrive early.');
await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Ascii armor integrity check on message failed'); await expect(openpgp.stream.readToEnd(decrypted.data)).to.be.rejectedWith('Ascii armor integrity check on message failed');
expect(await decrypted.signatures).to.exist.and.have.length(0); expect(decrypted.signatures).to.exist.and.have.length(1);
} finally { } finally {
openpgp.config.unsafe_stream = unsafe_streamValue; openpgp.config.unsafe_stream = unsafe_streamValue;
} }
@ -677,7 +678,8 @@ describe('Streaming', function() {
reader.releaseLock(); reader.releaseLock();
await openpgp.stream.cancel(decrypted.data, new Error('canceled by test')); await openpgp.stream.cancel(decrypted.data, new Error('canceled by test'));
expect(canceled).to.be.true; expect(canceled).to.be.true;
expect(await decrypted.signatures).to.exist.and.have.length(0); expect(decrypted.signatures).to.exist.and.have.length(1);
expect(await decrypted.signatures[0].verified).to.be.undefined;
} finally { } finally {
openpgp.config.aead_protect = aead_protectValue; openpgp.config.aead_protect = aead_protectValue;
openpgp.config.aead_chunk_size_byte = aead_chunk_size_byteValue; openpgp.config.aead_chunk_size_byte = aead_chunk_size_byteValue;