From d314a20e0fd9261683517b55c4aede444a88f8f8 Mon Sep 17 00:00:00 2001 From: Daniel Huigens Date: Tue, 30 Oct 2018 15:39:34 +0100 Subject: [PATCH] Don't return keys with an authorized revocation key --- src/key.js | 3 +-- test/general/key.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/key.js b/src/key.js index ae23d9a6..5d4fd15b 100644 --- a/src/key.js +++ b/src/key.js @@ -1240,8 +1240,7 @@ export async function read(data) { if (packetlist.filterByTag(enums.packet.signature).some( signature => signature.revocationKeyClass !== null )) { - // Indicate an error, but still parse the key. - err.push(new Error('This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.')); + throw new Error('This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.'); } const keyIndex = packetlist.indexOfTag(enums.packet.publicKey, enums.packet.secretKey); if (keyIndex.length === 0) { diff --git a/test/general/key.js b/test/general/key.js index eb21125f..a2ce51a3 100644 --- a/test/general/key.js +++ b/test/general/key.js @@ -1798,8 +1798,7 @@ describe('Key', function() { expect(pubKeys).to.exist; expect(pubKeys.err).to.exist.and.have.length(1); expect(pubKeys.err[0].message).to.equal('This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.'); - expect(pubKeys.keys).to.have.length(1); - expect(pubKeys.keys[0].getKeyId().toHex()).to.equal('5880a2fd178372b9'); + expect(pubKeys.keys).to.have.length(0); }); it('Parsing V5 public key packet', async function() {