1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

disable utf tests for sign/verify message for now

This commit is contained in:
Pavol Rusnak 2014-06-02 17:53:20 +02:00
parent c921bd802a
commit c06a45c1a8
2 changed files with 25 additions and 21 deletions

View File

@ -19,6 +19,13 @@ class TestMsgSignmessage(common.TrezorTest):
self.assertEqual(sig.address, 'mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL') self.assertEqual(sig.address, 'mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL')
self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80') self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
def test_too_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)
"""
def test_sign_utf(self): def test_sign_utf(self):
self.setup_mnemonic_nopin_nopassphrase() self.setup_mnemonic_nopin_nopassphrase()
@ -32,12 +39,7 @@ class TestMsgSignmessage(common.TrezorTest):
sig_nfc = self.client.sign_message('Bitcoin', [0], words_nfc) sig_nfc = self.client.sign_message('Bitcoin', [0], words_nfc)
self.assertEqual(sig_nfc.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e') self.assertEqual(sig_nfc.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e')
self.assertEqual(binascii.hexlify(sig_nfc.signature), '1fd0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda4e39588e4ec2b6a22dda4ec4f562f06e91129eea9a844a7193812de82d47c496b') self.assertEqual(binascii.hexlify(sig_nfc.signature), '1fd0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda4e39588e4ec2b6a22dda4ec4f562f06e91129eea9a844a7193812de82d47c496b')
"""
def test_too_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)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()

View File

@ -5,11 +5,10 @@ import base64
from trezorlib.client import CallException from trezorlib.client import CallException
'''
class TestMsgVerifymessage(common.TrezorTest): class TestMsgVerifymessage(common.TrezorTest):
def test_too_long(self): def test_too_long(self):
self.setup_mnemonic_nopin_nopassphrase() self.setup_mnemonic_nopin_nopassphrase()
ret = self.client.verify_message('1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', ret = self.client.verify_message('1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
binascii.unhexlify('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'), binascii.unhexlify('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'),
'1' * 256 '1' * 256
@ -17,12 +16,14 @@ class TestMsgVerifymessage(common.TrezorTest):
self.assertFalse(ret) self.assertFalse(ret)
def test_message_testnet(self): def test_message_testnet(self):
self.setup_mnemonic_nopin_nopassphrase()
sig = base64.b64decode('IFP/nvQalDo9lWCI7kScOzRkz/fiiScdkw7tFAKPoGbl6S8AY3wEws43s2gR57AfwZP8/8y7+F+wvGK9phQghN4=') sig = base64.b64decode('IFP/nvQalDo9lWCI7kScOzRkz/fiiScdkw7tFAKPoGbl6S8AY3wEws43s2gR57AfwZP8/8y7+F+wvGK9phQghN4=')
ret = self.client.verify_message('moRDikgmxcpouFtqnKnVVzLYgkDD2gQ3sk', sig, 'Ahoj') ret = self.client.verify_message('moRDikgmxcpouFtqnKnVVzLYgkDD2gQ3sk', sig, 'Ahoj')
self.assertTrue(ret) self.assertTrue(ret)
def test_message_verify(self): def test_message_verify(self):
self.setup_mnemonic_nopin_nopassphrase()
# uncompressed pubkey - OK # uncompressed pubkey - OK
res = self.client.verify_message( res = self.client.verify_message(
'1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
@ -70,6 +71,18 @@ class TestMsgVerifymessage(common.TrezorTest):
) )
self.assertFalse(res) self.assertFalse(res)
"""
def test_verify_bitcoind(self):
self.setup_mnemonic_nopin_nopassphrase()
res = self.client.verify_message(
'1KzXE97kV7DrpxCViCN3HbGbiKhzzPM7TQ',
binascii.unhexlify('1cc694f0f23901dfe3603789142f36a3fc582d0d5c0ec7215cf2ccd641e4e37228504f3d4dc3eea28bbdbf5da27c49d4635c097004d9f228750ccd836a8e1460c0'),
u'\u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy'
)
self.assertTrue(res)
def test_verify_utf(self): def test_verify_utf(self):
self.setup_mnemonic_nopin_nopassphrase() self.setup_mnemonic_nopin_nopassphrase()
@ -90,18 +103,7 @@ class TestMsgVerifymessage(common.TrezorTest):
self.assertTrue(res_nfkd) self.assertTrue(res_nfkd)
self.assertTrue(res_nfc) self.assertTrue(res_nfc)
"""
def test_verify_bitcoind(self):
self.setup_mnemonic_nopin_nopassphrase()
res = self.client.verify_message(
'1KzXE97kV7DrpxCViCN3HbGbiKhzzPM7TQ',
binascii.unhexlify('1cc694f0f23901dfe3603789142f36a3fc582d0d5c0ec7215cf2ccd641e4e37228504f3d4dc3eea28bbdbf5da27c49d4635c097004d9f228750ccd836a8e1460c0'),
u'\u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy'
)
self.assertTrue(res)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
'''