From 2cdbc89d2847f8d241245842ad1741a94fed82d3 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 12 Mar 2016 20:57:09 +0200 Subject: [PATCH] protocol: fixup UT --- trezor_agent/tests/test_protocol.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/trezor_agent/tests/test_protocol.py b/trezor_agent/tests/test_protocol.py index f3578cb..3d8a625 100644 --- a/trezor_agent/tests/test_protocol.py +++ b/trezor_agent/tests/test_protocol.py @@ -61,6 +61,16 @@ def test_sign_wrong(): h.handle(NIST256_SIGN_MSG) +def test_sign_cancel(): + def cancel_signature(label, blob): + raise IOError() + + key = formats.import_public_key(NIST256_KEY) + h = protocol.Handler(keys=[key], signer=cancel_signature) + + assert h.handle(NIST256_SIGN_MSG) == protocol._fail() + + ED25519_KEY = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFBdF2tjfSO8nLIi736is+f0erq28RTc7CkM11NZtTKR ssh://localhost' # nopep8 ED25519_SIGN_MSG = b'''\r\x00\x00\x003\x00\x00\x00\x0bssh-ed25519\x00\x00\x00 P]\x17kc}#\xbc\x9c\xb2"\xef~\xa2\xb3\xe7\xf4z\xba\xb6\xf1\x14\xdc\xec)\x0c\xd7SY\xb52\x91\x00\x00\x00\x94\x00\x00\x00 i3\xae}yk\\\xa1L\xb9\xe1\xbf\xbc\x8e\x87\r\x0e\xc0\x9f\x97\x0fTC!\x80\x07\x91\xdb^8\xc1\xd62\x00\x00\x00\x05roman\x00\x00\x00\x0essh-connection\x00\x00\x00\tpublickey\x01\x00\x00\x00\x0bssh-ed25519\x00\x00\x003\x00\x00\x00\x0bssh-ed25519\x00\x00\x00 P]\x17kc}#\xbc\x9c\xb2"\xef~\xa2\xb3\xe7\xf4z\xba\xb6\xf1\x14\xdc\xec)\x0c\xd7SY\xb52\x91\x00\x00\x00\x00''' # nopep8 ED25519_SIGN_REPLY = b'''\x00\x00\x00X\x0e\x00\x00\x00S\x00\x00\x00\x0bssh-ed25519\x00\x00\x00@\x8eb)\xa6\xe9P\x83VE\xfbq\xc6\xbf\x1dV3\xe3