mirror of
https://github.com/romanz/amodem.git
synced 2026-04-20 04:56:25 +08:00
decode: raise an error when keygrip is missing
This commit is contained in:
@@ -291,6 +291,7 @@ def load_by_keygrip(pubkey_bytes, keygrip):
|
|||||||
for p in packets:
|
for p in packets:
|
||||||
if p.get('keygrip') == keygrip:
|
if p.get('keygrip') == keygrip:
|
||||||
return p, user_ids
|
return p, user_ids
|
||||||
|
raise KeyError('{} keygrip not found'.format(util.hexlify(keygrip)))
|
||||||
|
|
||||||
|
|
||||||
def load_signature(stream, original_data):
|
def load_signature(stream, original_data):
|
||||||
|
|||||||
@@ -56,3 +56,8 @@ def test_has_custom_subpacket():
|
|||||||
for marker in custom_markers:
|
for marker in custom_markers:
|
||||||
sig = {'unhashed_subpackets': [marker]}
|
sig = {'unhashed_subpackets': [marker]}
|
||||||
assert decode.has_custom_subpacket(sig)
|
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'')
|
||||||
|
|||||||
Reference in New Issue
Block a user