Don't return keys with an authorized revocation key

This commit is contained in:
Daniel Huigens 2018-10-30 15:39:34 +01:00
parent 8fa3aadea2
commit d314a20e0f
2 changed files with 2 additions and 4 deletions

View File

@ -1240,8 +1240,7 @@ export async function read(data) {
if (packetlist.filterByTag(enums.packet.signature).some( if (packetlist.filterByTag(enums.packet.signature).some(
signature => signature.revocationKeyClass !== null signature => signature.revocationKeyClass !== null
)) { )) {
// Indicate an error, but still parse the key. throw new Error('This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.');
err.push(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); const keyIndex = packetlist.indexOfTag(enums.packet.publicKey, enums.packet.secretKey);
if (keyIndex.length === 0) { if (keyIndex.length === 0) {

View File

@ -1798,8 +1798,7 @@ describe('Key', function() {
expect(pubKeys).to.exist; expect(pubKeys).to.exist;
expect(pubKeys.err).to.exist.and.have.length(1); 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.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).to.have.length(0);
expect(pubKeys.keys[0].getKeyId().toHex()).to.equal('5880a2fd178372b9');
}); });
it('Parsing V5 public key packet', async function() { it('Parsing V5 public key packet', async function() {