diff --git a/trezor_agent/gpg/tests/088F8EB2D57AF4D64C40A5EA90AC201D7BFE5D13.gpg b/trezor_agent/gpg/tests/088F8EB2D57AF4D64C40A5EA90AC201D7BFE5D13.gpg new file mode 100644 index 0000000..fa5f767 Binary files /dev/null and b/trezor_agent/gpg/tests/088F8EB2D57AF4D64C40A5EA90AC201D7BFE5D13.gpg differ diff --git a/trezor_agent/gpg/tests/114D3A028A34F56550D403F6DD9DAA354E9AAB78.gpg b/trezor_agent/gpg/tests/114D3A028A34F56550D403F6DD9DAA354E9AAB78.gpg new file mode 100644 index 0000000..21b92d2 Binary files /dev/null and b/trezor_agent/gpg/tests/114D3A028A34F56550D403F6DD9DAA354E9AAB78.gpg differ diff --git a/trezor_agent/gpg/tests/181D005503DBE3ADC43D142D6FC4ECF01E42B367.gpg b/trezor_agent/gpg/tests/181D005503DBE3ADC43D142D6FC4ECF01E42B367.gpg new file mode 100644 index 0000000..220676b Binary files /dev/null and b/trezor_agent/gpg/tests/181D005503DBE3ADC43D142D6FC4ECF01E42B367.gpg differ diff --git a/trezor_agent/gpg/tests/71B5A80A63FE12B0D74DABBFE4A883364AAF6E16.gpg b/trezor_agent/gpg/tests/71B5A80A63FE12B0D74DABBFE4A883364AAF6E16.gpg new file mode 100644 index 0000000..062761f Binary files /dev/null and b/trezor_agent/gpg/tests/71B5A80A63FE12B0D74DABBFE4A883364AAF6E16.gpg differ diff --git a/trezor_agent/gpg/tests/77E9D99CBB9B4C961370BAF9AD4DD89F17138874.gpg b/trezor_agent/gpg/tests/77E9D99CBB9B4C961370BAF9AD4DD89F17138874.gpg new file mode 100644 index 0000000..8190ade Binary files /dev/null and b/trezor_agent/gpg/tests/77E9D99CBB9B4C961370BAF9AD4DD89F17138874.gpg differ diff --git a/trezor_agent/gpg/tests/80615870F5BAD690333686D0F2AD85AC1E42B367.gpg b/trezor_agent/gpg/tests/80615870F5BAD690333686D0F2AD85AC1E42B367.gpg new file mode 100644 index 0000000..07bff0e Binary files /dev/null and b/trezor_agent/gpg/tests/80615870F5BAD690333686D0F2AD85AC1E42B367.gpg differ diff --git a/trezor_agent/gpg/tests/86E6792FC27BFD478860C11091F3B339B9A02A3D.gpg b/trezor_agent/gpg/tests/86E6792FC27BFD478860C11091F3B339B9A02A3D.gpg new file mode 100644 index 0000000..f93a752 Binary files /dev/null and b/trezor_agent/gpg/tests/86E6792FC27BFD478860C11091F3B339B9A02A3D.gpg differ diff --git a/trezor_agent/gpg/tests/A4EB142E5FC2C898BAEC2C9B2BA8930D2B320C62.gpg b/trezor_agent/gpg/tests/A4EB142E5FC2C898BAEC2C9B2BA8930D2B320C62.gpg new file mode 100644 index 0000000..72901f2 Binary files /dev/null and b/trezor_agent/gpg/tests/A4EB142E5FC2C898BAEC2C9B2BA8930D2B320C62.gpg differ diff --git a/trezor_agent/gpg/tests/ABAF11C65A2970B130ABE3C479BE3E4300411886.gpg b/trezor_agent/gpg/tests/ABAF11C65A2970B130ABE3C479BE3E4300411886.gpg new file mode 100644 index 0000000..2ef496c Binary files /dev/null and b/trezor_agent/gpg/tests/ABAF11C65A2970B130ABE3C479BE3E4300411886.gpg differ diff --git a/trezor_agent/gpg/tests/test_decode.py b/trezor_agent/gpg/tests/test_decode.py index 09355a1..c5fd71f 100644 --- a/trezor_agent/gpg/tests/test_decode.py +++ b/trezor_agent/gpg/tests/test_decode.py @@ -1,5 +1,7 @@ +import glob import hashlib import io +import os import pytest @@ -65,7 +67,8 @@ zpR9luXTKwMEl+mlZmwEFKZXBmir '_to_hash': b'\x04\x13\x13\x08\x00\x12\x05\x02WHH\xd6\x02\x1b\x03\x02\x15\x08\x02\x16\x00\x02\x17\x80\x04\xff\x00\x00\x00\x18' # nopep8 }) - digest = decode.digest_packets(packets=[pubkey, user_id, signature], hashalg=hashlib.sha256) + digest = decode.digest_packets(packets=[pubkey, user_id, signature], + hasher=hashlib.sha256()) decode.verify_digest(pubkey=pubkey, digest=digest, signature=signature['sig'], label='GPG primary public key') @@ -95,3 +98,16 @@ KDQU0N5KmNwLlt2kwo4A/jQkBII2cI8tTqOVTLNRXXqIOsMf/fG4jKM/VOFc/01c use_custom=True) assert_subdict(pubkey, expected_pubkey) assert_subdict(pubkey, {'user_id': b'testing'}) + + +cwd = os.path.join(os.path.dirname(__file__)) +input_files = glob.glob(os.path.join(cwd, '*.gpg')) + + +@pytest.fixture(params=input_files) +def public_key_path(request): + return request.param + + +def test_gpg_files(public_key_path): # pylint: disable=redefined-outer-name + decode.load_public_key(open(public_key_path, 'rb').read())