1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 00:58:09 +00:00

rewrite sign/verify tests to test long messages

This commit is contained in:
Pavol Rusnak 2014-11-12 20:26:04 +01:00
parent 69d2d2ded3
commit 6a27ce2d5c
2 changed files with 8 additions and 8 deletions

View File

@ -19,11 +19,11 @@ class TestMsgSignmessage(common.TrezorTest):
self.assertEqual(sig.address, 'mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL')
self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
def test_too_long(self):
def test_sign_long(self):
self.setup_mnemonic_nopin_nopassphrase()
# Message cannot be longer than 255 bytes
self.assertRaises(CallException, self.client.sign_message, 'Bitcoin', [0], '1' * 256)
sig = self.client.sign_message('Bitcoin', [0], "VeryLongMessage!" * 64)
self.assertEqual(sig.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e')
self.assertEqual(binascii.hexlify(sig.signature), '205ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed')
"""
def test_sign_utf(self):

View File

@ -7,13 +7,13 @@ from trezorlib.client import CallException
class TestMsgVerifymessage(common.TrezorTest):
def test_too_long(self):
def test_message_long(self):
self.setup_mnemonic_nopin_nopassphrase()
ret = self.client.verify_message('1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
binascii.unhexlify('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'),
'1' * 256
binascii.unhexlify('1bddc0aed9cf4e10dc9f57770934f4fb72a27c4510a0f4a81e09c163552416f799cd3f211ffeed0f411e9af9b927407d67115fb6d0ab1897137048efe33417fcc1'),
"VeryLongMessage!" * 64
)
self.assertFalse(ret)
self.assertTrue(ret)
def test_message_testnet(self):
self.setup_mnemonic_nopin_nopassphrase()