# Path: keepkeylib/client.py
# class CallException(Exception):
#     def __init__(self, code, message):
#         super(CallException, self).__init__()
#         self.args = [code, message]


import unittest
import common
import binascii
import base64
from keepkeylib.client import CallException
from keepkeylib import messages_pb2 as proto
            '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
            binascii.unhexlify('1ba77e01a9e17ba158b96200000000dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'),
            'This is an example of a signed message.'
        )
        self.assertFalse(res)

        # uncompressed pubkey - FAIL - wrong msg
        res = self.client.verify_message(
            'Bitcoin',
            '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
            binascii.unhexlify('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'),
            'This is an example of a signed message!'
        )
        self.assertFalse(res)

        # compressed pubkey - OK
        res = self.client.verify_message(
            'Bitcoin',
            '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8',
            binascii.unhexlify('1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'),
            'This is an example of a signed message.')
        self.assertTrue(res)

        # compressed pubkey - FAIL - wrong sig
        res = self.client.verify_message(
            'Bitcoin',
            '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8',
            binascii.unhexlify('1f44e3e461f7ca9f57c472000000004df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'),
            'This is an example of a signed message.'
        )

# Path: keepkeylib/client.py
# class CallException(Exception):
#     def __init__(self, code, message):
#         super(CallException, self).__init__()
#         self.args = [code, message]


# Path: tests/test_msg_verifymessage.py
import unittest
import common
import binascii
import base64
from keepkeylib.client import CallException
from keepkeylib import messages_pb2 as proto

            '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
            binascii.unhexlify('1ba77e01a9e17ba158b96200000000dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'),
            'This is an example of a signed message.'
        )
        self.assertFalse(res)

        # uncompressed pubkey - FAIL - wrong msg
        res = self.client.verify_message(
            'Bitcoin',
            '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T',
            binascii.unhexlify('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'),
            'This is an example of a signed message!'
        )
        self.assertFalse(res)

        # compressed pubkey - OK
        res = self.client.verify_message(
            'Bitcoin',
            '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8',
            binascii.unhexlify('1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'),
            'This is an example of a signed message.')
        self.assertTrue(res)

        # compressed pubkey - FAIL - wrong sig
        res = self.client.verify_message(
            'Bitcoin',
            '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8',
            binascii.unhexlify('1f44e3e461f7ca9f57c472000000004df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'),
            'This is an example of a signed message.'
        )

        self.assertFalse(res)