mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
Merge branch 'upstream' into refactor-transport-nicediff
This commit is contained in:
commit
f75b90d260
10
CHANGELOG.md
Normal file
10
CHANGELOG.md
Normal file
@ -0,0 +1,10 @@
|
||||
The changelog format is bound to change as we figure out a way to autogenerate it.
|
||||
|
||||
## version 0.9.1 (released 2018-03-05)
|
||||
|
||||
- proper support for Trezor model T
|
||||
- gradually dropping Python 2 compatibility (pypi package will now be marked as Python 3 only)
|
||||
- support for Monacoin
|
||||
- improvements to `trezorctl`:
|
||||
- add pretty-printing of features and protobuf debug dumps (fixes #199)
|
||||
- support `TREZOR_PATH` environment variable to preselect a Trezor device.
|
2
setup.py
2
setup.py
@ -41,6 +41,7 @@ setup(
|
||||
],
|
||||
scripts=['trezorctl'],
|
||||
install_requires=install_requires,
|
||||
python_requires='>=3.3',
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
classifiers=[
|
||||
@ -48,5 +49,6 @@ setup(
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Operating System :: Microsoft :: Windows',
|
||||
'Operating System :: MacOS :: MacOS X',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
],
|
||||
)
|
||||
|
@ -11,10 +11,12 @@ from urllib.parse import urlparse
|
||||
from trezorlib.client import TrezorClient
|
||||
from trezorlib.transport import get_transport
|
||||
|
||||
|
||||
# Return path by BIP-32
|
||||
def getPath(client):
|
||||
return client.expand_path("10016'/0")
|
||||
|
||||
|
||||
# Deriving master key
|
||||
def getMasterKey(client):
|
||||
bip32_path = getPath(client)
|
||||
@ -29,6 +31,7 @@ def getMasterKey(client):
|
||||
))
|
||||
return key
|
||||
|
||||
|
||||
# Deriving file name and encryption key
|
||||
def getFileEncKey(key):
|
||||
filekey, enckey = key[:len(key) // 2], key[len(key) // 2:]
|
||||
@ -37,6 +40,7 @@ def getFileEncKey(key):
|
||||
filename = digest + '.pswd'
|
||||
return [filename, filekey, enckey]
|
||||
|
||||
|
||||
# File level decryption and file reading
|
||||
def decryptStorage(path, key):
|
||||
cipherkey = unhexlify(key)
|
||||
@ -57,6 +61,7 @@ def decryptStorage(path, key):
|
||||
data = data + decryptor.finalize().decode()
|
||||
return json.loads(data)
|
||||
|
||||
|
||||
def decryptEntryValue(nonce, val):
|
||||
cipherkey = unhexlify(nonce)
|
||||
iv = val[:12]
|
||||
@ -76,6 +81,7 @@ def decryptEntryValue(nonce, val):
|
||||
data = data + decryptor.finalize().decode()
|
||||
return json.loads(data)
|
||||
|
||||
|
||||
# Decrypt give entry nonce
|
||||
def getDecryptedNonce(client, entry):
|
||||
print()
|
||||
@ -101,6 +107,7 @@ def getDecryptedNonce(client, entry):
|
||||
))
|
||||
return decrypted_nonce
|
||||
|
||||
|
||||
# Pretty print of list
|
||||
def printEntries(entries):
|
||||
print('Password entries')
|
||||
@ -110,7 +117,8 @@ def printEntries(entries):
|
||||
print('Entry id: #%s' % k)
|
||||
print('-------------')
|
||||
for kk, vv in v.items():
|
||||
if kk in ['nonce', 'safe_note', 'password']: continue # skip these fields
|
||||
if kk in ['nonce', 'safe_note', 'password']:
|
||||
continue # skip these fields
|
||||
print('*', kk, ': ', vv)
|
||||
print()
|
||||
return
|
||||
@ -163,5 +171,6 @@ def main():
|
||||
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
16
trezorctl
16
trezorctl
@ -28,7 +28,7 @@ import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
from trezorlib.client import TrezorClient, TrezorClientVerbose, CallException
|
||||
from trezorlib.client import TrezorClient, TrezorClientVerbose, CallException, format_protobuf
|
||||
from trezorlib.transport import get_transport, enumerate_devices, TransportException
|
||||
from trezorlib import messages as proto
|
||||
from trezorlib import protobuf
|
||||
@ -95,7 +95,7 @@ def cli(ctx, path, verbose, is_json):
|
||||
@cli.resultcallback()
|
||||
def print_result(res, path, verbose, is_json):
|
||||
if is_json:
|
||||
if issubclass(res.__class__, protobuf.MessageType):
|
||||
if isinstance(res, protobuf.MessageType):
|
||||
click.echo(json.dumps({res.__class__.__name__: res.__dict__}))
|
||||
else:
|
||||
click.echo(json.dumps(res, sort_keys=True, indent=4))
|
||||
@ -110,6 +110,8 @@ def print_result(res, path, verbose, is_json):
|
||||
click.echo('%s.%s: %s' % (k, kk, vv))
|
||||
else:
|
||||
click.echo('%s: %s' % (k, v))
|
||||
elif isinstance(res, protobuf.MessageType):
|
||||
click.echo(format_protobuf(res))
|
||||
else:
|
||||
click.echo(res)
|
||||
|
||||
@ -597,9 +599,9 @@ def ethereum_sign_message(connect, address, message):
|
||||
|
||||
def ethereum_decode_hex(value):
|
||||
if value.startswith('0x') or value.startswith('0X'):
|
||||
return value[2:].decode('hex')
|
||||
return binascii.unhexlify(value[2:])
|
||||
else:
|
||||
return value.decode('hex')
|
||||
return binascii.unhexlify(value)
|
||||
|
||||
|
||||
@cli.command(help='Verify message signed with Ethereum address.')
|
||||
@ -746,7 +748,7 @@ def ethereum_sign_tx(connect, host, chain_id, address, value, gas_limit, gas_pri
|
||||
|
||||
client = connect()
|
||||
address_n = client.expand_path(address)
|
||||
address = '0x%s' % (binascii.hexlify(client.ethereum_get_address(address_n)),)
|
||||
address = '0x%s' % (binascii.hexlify(client.ethereum_get_address(address_n)).decode())
|
||||
|
||||
if gas_price is None or gas_limit is None or nonce is None:
|
||||
host, port = host.split(':')
|
||||
@ -764,7 +766,7 @@ def ethereum_sign_tx(connect, host, chain_id, address, value, gas_limit, gas_pri
|
||||
to_address=to,
|
||||
from_address=address,
|
||||
value=('0x%x' % value),
|
||||
data='0x' + data)
|
||||
data='0x%s' % (binascii.hexlify(data).decode()))
|
||||
|
||||
if nonce is None:
|
||||
nonce = eth.eth_getTransactionCount(address)
|
||||
@ -781,7 +783,7 @@ def ethereum_sign_tx(connect, host, chain_id, address, value, gas_limit, gas_pri
|
||||
|
||||
transaction = rlp.encode(
|
||||
(nonce, gas_price, gas_limit, to_address, value, data) + sig)
|
||||
tx_hex = '0x%s' % binascii.hexlify(transaction)
|
||||
tx_hex = '0x%s' % binascii.hexlify(transaction).decode()
|
||||
|
||||
if publish:
|
||||
tx_hash = eth.eth_sendRawTransaction(tx_hex)
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '0.9.0'
|
||||
__version__ = '0.9.1'
|
||||
|
@ -36,6 +36,7 @@ from . import tools
|
||||
from . import mapping
|
||||
from .coins import coins_slip44
|
||||
from .debuglink import DebugLink
|
||||
from .protobuf import MessageType
|
||||
|
||||
# Python2 vs Python3
|
||||
try:
|
||||
@ -86,13 +87,46 @@ def get_buttonrequest_value(code):
|
||||
return [k for k in dir(proto.ButtonRequestType) if getattr(proto.ButtonRequestType, k) == code][0]
|
||||
|
||||
|
||||
def format_protobuf(pb, indent=0, sep=' ' * 4):
|
||||
def pformat_value(value, indent):
|
||||
level = sep * indent
|
||||
leadin = sep * (indent + 1)
|
||||
if isinstance(value, MessageType):
|
||||
return format_protobuf(value, indent, sep)
|
||||
if isinstance(value, list):
|
||||
lines = []
|
||||
lines.append('[')
|
||||
lines += [leadin + pformat_value(x, indent + 1) + ',' for x in value]
|
||||
lines.append(level + ']')
|
||||
return '\n'.join(lines)
|
||||
if isinstance(value, dict):
|
||||
lines = []
|
||||
lines.append('{')
|
||||
for key, val in sorted(value.items()):
|
||||
if val is None or val == []:
|
||||
continue
|
||||
if key == 'address_n' and isinstance(val, list):
|
||||
lines.append(leadin + key + ': ' + repr(val) + ',')
|
||||
else:
|
||||
lines.append(leadin + key + ': ' + pformat_value(val, indent + 1) + ',')
|
||||
lines.append(level + '}')
|
||||
return '\n'.join(lines)
|
||||
if isinstance(value, bytearray):
|
||||
return 'bytearray(0x{})'.format(value.hex())
|
||||
|
||||
return repr(value)
|
||||
|
||||
return pb.__class__.__name__ + ' ' + pformat_value(pb.__dict__, indent)
|
||||
|
||||
|
||||
def pprint(msg):
|
||||
msg_class = msg.__class__.__name__
|
||||
msg_size = msg.ByteSize()
|
||||
if isinstance(msg, proto.FirmwareUpload) or isinstance(msg, proto.SelfTest):
|
||||
return "<%s> (%d bytes):\n" % (msg_class, msg_size)
|
||||
if isinstance(msg, proto.FirmwareUpload) or isinstance(msg, proto.SelfTest) \
|
||||
or isinstance(msg, proto.Features):
|
||||
return "<%s> (%d bytes)" % (msg_class, msg_size)
|
||||
else:
|
||||
return "<%s> (%d bytes):\n%s" % (msg_class, msg_size, msg)
|
||||
return "<%s> (%d bytes):\n%s" % (msg_class, msg_size, format_protobuf(msg))
|
||||
|
||||
|
||||
def log(msg):
|
||||
|
@ -50,6 +50,7 @@ class TestBip32Speed(TrezorTest):
|
||||
print("DEPTH", depth, "EXPECTED DELAY", expected, "REAL DELAY", delay)
|
||||
assert delay <= expected
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_cache(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
||||
|
@ -21,7 +21,6 @@ from .common import *
|
||||
from trezorlib import messages as proto
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgApplysettings(TrezorTest):
|
||||
|
||||
def test_apply_settings(self):
|
||||
@ -33,10 +32,13 @@ class TestMsgApplysettings(TrezorTest):
|
||||
proto.ButtonRequest(),
|
||||
proto.Success(),
|
||||
proto.Features()])
|
||||
if self.client.features.major_version >= 2:
|
||||
self.client.expected_responses.pop(0) # skip PinMatrixRequest
|
||||
self.client.apply_settings(label='new label')
|
||||
|
||||
assert self.client.features.label == 'new label'
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_invalid_language(self):
|
||||
self.setup_mnemonic_pin_passphrase()
|
||||
assert self.client.features.language == 'english'
|
||||
@ -60,6 +62,8 @@ class TestMsgApplysettings(TrezorTest):
|
||||
proto.ButtonRequest(),
|
||||
proto.Success(),
|
||||
proto.Features()])
|
||||
if self.client.features.major_version >= 2:
|
||||
self.client.expected_responses.pop(0) # skip PinMatrixRequest
|
||||
self.client.apply_settings(use_passphrase=True)
|
||||
|
||||
assert self.client.features.passphrase_protection is True
|
||||
@ -80,6 +84,7 @@ class TestMsgApplysettings(TrezorTest):
|
||||
|
||||
assert self.client.features.passphrase_protection is True
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_apply_homescreen(self):
|
||||
self.setup_mnemonic_pin_passphrase()
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
from .common import *
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgEthereumSignmessage(TrezorTest):
|
||||
|
||||
def test_sign(self):
|
||||
|
@ -18,6 +18,7 @@
|
||||
from .common import *
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgEthereumVerifymessage(TrezorTest):
|
||||
|
||||
def test_verify(self):
|
||||
|
@ -25,19 +25,30 @@ class TestMsgGetpublickey(TrezorTest):
|
||||
def test_btc(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert bip32.serialize(self.client.get_public_node([]).node, 0x0488B21E) == 'xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy'
|
||||
assert self.client.get_public_node([], coin_name='Bitcoin').xpub == 'xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy'
|
||||
assert bip32.serialize(self.client.get_public_node([1]).node, 0x0488B21E) == 'xpub68zNxjsTrV8y9AadThLW7dTAqEpZ7xBLFSyJ3X9pjTv6Njg6kxgjXJkzxq8u3ttnjBw1jupQHMP3gpGZzZqd1eh5S4GjkaMhPR18vMyUi8N'
|
||||
assert self.client.get_public_node([1], coin_name='Bitcoin').xpub == 'xpub68zNxjsTrV8y9AadThLW7dTAqEpZ7xBLFSyJ3X9pjTv6Njg6kxgjXJkzxq8u3ttnjBw1jupQHMP3gpGZzZqd1eh5S4GjkaMhPR18vMyUi8N'
|
||||
assert bip32.serialize(self.client.get_public_node([0, -1]).node, 0x0488B21E) == 'xpub6A3FoZqYXj1AbW4thRwBh26YwZWbmoyjTaZwwxJjY1oKUpefLepL3RFS9DHKQrjAfxDrzDepYMDZPqXN6upQm3bHQ9xaXD5a3mqni3goF4v'
|
||||
assert self.client.get_public_node([0, -1], coin_name='Bitcoin').xpub == 'xpub6A3FoZqYXj1AbW4thRwBh26YwZWbmoyjTaZwwxJjY1oKUpefLepL3RFS9DHKQrjAfxDrzDepYMDZPqXN6upQm3bHQ9xaXD5a3mqni3goF4v'
|
||||
assert bip32.serialize(self.client.get_public_node([-9, 0]).node, 0x0488B21E) == 'xpub6A2h5mzLDfYginoD7q7wCWbq18wTbN9gducRr2w5NRTwdLeoT3cJSwefFqW7uXTpVFGtpUyDMBNYs3DNvvXx6NPjF9YEbUQrtxFSWnPtVrv'
|
||||
assert self.client.get_public_node([-9, 0], coin_name='Bitcoin').xpub == 'xpub6A2h5mzLDfYginoD7q7wCWbq18wTbN9gducRr2w5NRTwdLeoT3cJSwefFqW7uXTpVFGtpUyDMBNYs3DNvvXx6NPjF9YEbUQrtxFSWnPtVrv'
|
||||
assert bip32.serialize(self.client.get_public_node([0, 9999999]).node, 0x0488B21E) == 'xpub6A3FoZqQEK6iwLZ4HFkqSo5fb35BH4bpjC4SPZ63prfLdGYPwYxEuC6o91bUvFFdMzKWe5rs3axHRUjxJaSvBnKKFtnfLwDACRxPxabsv2r'
|
||||
assert self.client.get_public_node([0, 9999999], coin_name='Bitcoin').xpub == 'xpub6A3FoZqQEK6iwLZ4HFkqSo5fb35BH4bpjC4SPZ63prfLdGYPwYxEuC6o91bUvFFdMzKWe5rs3axHRUjxJaSvBnKKFtnfLwDACRxPxabsv2r'
|
||||
|
||||
def test_ltc(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert bip32.serialize(self.client.get_public_node([]).node, 0x019dA462) == 'Ltub2SSUS19CirucVPGDKDBatBDBEM2s9UbH66pBURfaKrMocCPLhQ7Z7hecy5VYLHA5fRdXwB2e61j2VJCNzVsqKTCVEU1vECjqi5EyczFX9xp'
|
||||
assert bip32.serialize(self.client.get_public_node([1]).node, 0x019dA462) == 'Ltub2VRVRP5VjvSyPXra4BLVyVZPv397sjhUNjBGsbtw6xko77JuQyBULxFSKheviJJ3KQLbL3Cx8P2RnudguTw4raUVjCACRG7jsumUptYx55C'
|
||||
assert bip32.serialize(self.client.get_public_node([0, -1]).node, 0x019dA462) == 'Ltub2WUNGD3aRAKAqsLqHuwBYtCn2MqAXbVsarmvn33quWe2DCHTzfK4s4jsW5oM5G8RGAdSaM3NPNrwVvtV1ourbyNhhHr3BtqcYGc8caf5GoT'
|
||||
assert bip32.serialize(self.client.get_public_node([-9, 0]).node, 0x019dA462) == 'Ltub2WToYRCN76rgyA59iK7w4Ni45wG2M9fpmBpQg7gBjvJeMiHc7473Gb96ci29Zvs55TgUQcMmCD1vy8aVqpdPwJB9YHRhGAAuPT1nRLLXmFu'
|
||||
assert bip32.serialize(self.client.get_public_node([0, 9999999]).node, 0x019dA462) == 'Ltub2WUNGD3S7kQjBhpzsjkqJfBtfqPk2r7xrUGRDdqACMW3MeBCbZSyiqbEVt7WaeesxCj6EDFQtcbfXa75DUYN2i6jZ2g81cyCgvijs9J2u2n'
|
||||
assert bip32.serialize(self.client.get_public_node([]).node, 0x019DA462) == 'Ltub2SSUS19CirucVPGDKDBatBDBEM2s9UbH66pBURfaKrMocCPLhQ7Z7hecy5VYLHA5fRdXwB2e61j2VJCNzVsqKTCVEU1vECjqi5EyczFX9xp'
|
||||
assert self.client.get_public_node([], coin_name='Litecoin').xpub == 'Ltub2SSUS19CirucVPGDKDBatBDBEM2s9UbH66pBURfaKrMocCPLhQ7Z7hecy5VYLHA5fRdXwB2e61j2VJCNzVsqKTCVEU1vECjqi5EyczFX9xp'
|
||||
assert bip32.serialize(self.client.get_public_node([1]).node, 0x019DA462) == 'Ltub2VRVRP5VjvSyPXra4BLVyVZPv397sjhUNjBGsbtw6xko77JuQyBULxFSKheviJJ3KQLbL3Cx8P2RnudguTw4raUVjCACRG7jsumUptYx55C'
|
||||
assert self.client.get_public_node([1], coin_name='Litecoin').xpub == 'Ltub2VRVRP5VjvSyPXra4BLVyVZPv397sjhUNjBGsbtw6xko77JuQyBULxFSKheviJJ3KQLbL3Cx8P2RnudguTw4raUVjCACRG7jsumUptYx55C'
|
||||
assert bip32.serialize(self.client.get_public_node([0, -1]).node, 0x019DA462) == 'Ltub2WUNGD3aRAKAqsLqHuwBYtCn2MqAXbVsarmvn33quWe2DCHTzfK4s4jsW5oM5G8RGAdSaM3NPNrwVvtV1ourbyNhhHr3BtqcYGc8caf5GoT'
|
||||
assert self.client.get_public_node([0, -1], coin_name='Litecoin').xpub == 'Ltub2WUNGD3aRAKAqsLqHuwBYtCn2MqAXbVsarmvn33quWe2DCHTzfK4s4jsW5oM5G8RGAdSaM3NPNrwVvtV1ourbyNhhHr3BtqcYGc8caf5GoT'
|
||||
assert bip32.serialize(self.client.get_public_node([-9, 0]).node, 0x019DA462) == 'Ltub2WToYRCN76rgyA59iK7w4Ni45wG2M9fpmBpQg7gBjvJeMiHc7473Gb96ci29Zvs55TgUQcMmCD1vy8aVqpdPwJB9YHRhGAAuPT1nRLLXmFu'
|
||||
assert self.client.get_public_node([-9, 0], coin_name='Litecoin').xpub == 'Ltub2WToYRCN76rgyA59iK7w4Ni45wG2M9fpmBpQg7gBjvJeMiHc7473Gb96ci29Zvs55TgUQcMmCD1vy8aVqpdPwJB9YHRhGAAuPT1nRLLXmFu'
|
||||
assert bip32.serialize(self.client.get_public_node([0, 9999999]).node, 0x019DA462) == 'Ltub2WUNGD3S7kQjBhpzsjkqJfBtfqPk2r7xrUGRDdqACMW3MeBCbZSyiqbEVt7WaeesxCj6EDFQtcbfXa75DUYN2i6jZ2g81cyCgvijs9J2u2n'
|
||||
assert self.client.get_public_node([0, 9999999], coin_name='Litecoin').xpub == 'Ltub2WUNGD3S7kQjBhpzsjkqJfBtfqPk2r7xrUGRDdqACMW3MeBCbZSyiqbEVt7WaeesxCj6EDFQtcbfXa75DUYN2i6jZ2g81cyCgvijs9J2u2n'
|
||||
|
||||
def test_tbtc(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert bip32.serialize(self.client.get_public_node([111, 42]).node, 0x043587CF) == 'tpubDAgixSyai5PWbc8N1mBkHDR5nLgAnHFtY7r4y5EzxqAxrt9YUDpZL3kaRoHVvCfrcwNo31c2isBP2uTHcZxEosuKbyJhCAbrvGoPuLUZ7Mz'
|
||||
assert self.client.get_public_node([111, 42], coin_name='Testnet').xpub == 'tpubDAgixSyai5PWbc8N1mBkHDR5nLgAnHFtY7r4y5EzxqAxrt9YUDpZL3kaRoHVvCfrcwNo31c2isBP2uTHcZxEosuKbyJhCAbrvGoPuLUZ7Mz'
|
||||
|
43
trezorlib/tests/device_tests/test_msg_getpublickey_curve.py
Normal file
43
trezorlib/tests/device_tests/test_msg_getpublickey_curve.py
Normal file
@ -0,0 +1,43 @@
|
||||
# This file is part of the TREZOR project.
|
||||
#
|
||||
# Copyright (C) 2012-2016 Marek Palatinus <slush@satoshilabs.com>
|
||||
# Copyright (C) 2012-2016 Pavol Rusnak <stick@satoshilabs.com>
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from .common import *
|
||||
import trezorlib.ckd_public as bip32
|
||||
|
||||
|
||||
class TestMsgGetpublickeyCurve(TrezorTest):
|
||||
|
||||
def test_default_curve(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 42]).node.public_key).decode() == '02e7fcec053f0df94d88c86447970743e8a1979d242d09338dcf8687a9966f7fbc'
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 0x80000000 | 42]).node.public_key).decode() == '03ce7b690969d773ba9ed212464eb2b534b87b9b8a9383300bddabe1f093f79220'
|
||||
|
||||
def test_secp256k1_curve(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 42], ecdsa_curve_name='secp256k1').node.public_key).decode() == '02e7fcec053f0df94d88c86447970743e8a1979d242d09338dcf8687a9966f7fbc'
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 0x80000000 | 42], ecdsa_curve_name='secp256k1').node.public_key).decode() == '03ce7b690969d773ba9ed212464eb2b534b87b9b8a9383300bddabe1f093f79220'
|
||||
|
||||
def test_nist256p1_curve(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 42], ecdsa_curve_name='nist256p1').node.public_key).decode() == '02a9ce59b32bd64a70bc52aca96e5d09af65c6b9593ba2a60af8fccfe1437f2129'
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 0x80000000 | 42], ecdsa_curve_name='nist256p1').node.public_key).decode() == '026fe35d8afed67dbf0561a1d32922e8ad0cd0d86effbc82be970cbed7d9bab2c2'
|
||||
|
||||
def test_ed25519_curve(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 42], ecdsa_curve_name='ed25519').node.public_key).decode() == '001d9a1e56f69828d44ec96dad345678411976d3ea6d290fe3ae8032c47699ce15'
|
||||
assert hexlify(self.client.get_public_node([0x80000000 | 111, 0x80000000 | 42], ecdsa_curve_name='ed25519').node.public_key).decode() == '0069a14b478e508eab6e93303f4e6f5c50b8136627830f2ed5c3a835fc6c0ea2b7'
|
@ -20,7 +20,6 @@ from .common import *
|
||||
from trezorlib import messages as proto
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgSignmessageSegwit(TrezorTest):
|
||||
|
||||
def test_sign(self):
|
||||
|
@ -20,7 +20,6 @@ from .common import *
|
||||
from trezorlib import messages as proto
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgSignmessageSegwitNative(TrezorTest):
|
||||
|
||||
def test_sign(self):
|
||||
|
@ -187,7 +187,6 @@ class TestMsgSigntxBch(TrezorTest):
|
||||
else:
|
||||
assert False # exception expected
|
||||
|
||||
|
||||
def test_attack_change_input(self):
|
||||
self.setup_mnemonic_allallall()
|
||||
self.client.set_tx_api(TxApiBcash)
|
||||
|
@ -20,7 +20,6 @@ from .common import *
|
||||
import base64
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgVerifymessageSegwit(TrezorTest):
|
||||
|
||||
def test_message_long(self):
|
||||
|
@ -20,7 +20,6 @@ from .common import *
|
||||
import base64
|
||||
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
class TestMsgVerifymessageSegwitNative(TrezorTest):
|
||||
|
||||
def test_message_long(self):
|
||||
|
Loading…
Reference in New Issue
Block a user