decode: raise an error when keygrip is missing

nistp521
Roman Zeyde 7 years ago
parent 59560ec0b0
commit 8a77fa519f
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

@ -291,6 +291,7 @@ def load_by_keygrip(pubkey_bytes, keygrip):
for p in packets:
if p.get('keygrip') == keygrip:
return p, user_ids
raise KeyError('{} keygrip not found'.format(util.hexlify(keygrip)))
def load_signature(stream, original_data):

@ -56,3 +56,8 @@ def test_has_custom_subpacket():
for marker in custom_markers:
sig = {'unhashed_subpackets': [marker]}
assert decode.has_custom_subpacket(sig)
def test_load_by_keygrip_missing():
with pytest.raises(KeyError):
decode.load_by_keygrip(pubkey_bytes=b'', keygrip=b'')

Loading…
Cancel
Save