diff --git a/setup.py b/setup.py index a026bc1..fadf6ff 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( url='http://github.com/romanz/trezor-agent', packages=['trezor_agent', 'trezor_agent.gpg'], scripts=['trezor_agent/gpg/trezor-git-gpg-wrapper.sh'], - install_requires=['ecdsa>=0.13', 'ed25519>=1.4', 'Cython>=0.23.4', 'trezor>=0.6.6', 'keepkey>=0.7.0', 'semver>=2.2'], + install_requires=['ecdsa>=0.13', 'ed25519>=1.4', 'Cython>=0.23.4', 'protobuf>=3.0.0b2.post2', 'trezor>=0.6.12', 'semver>=2.2'], platforms=['POSIX'], classifiers=[ 'Environment :: Console', diff --git a/trezor_agent/__main__.py b/trezor_agent/__main__.py index e6ad721..2926fc5 100644 --- a/trezor_agent/__main__.py +++ b/trezor_agent/__main__.py @@ -31,7 +31,7 @@ def create_parser(): p = argparse.ArgumentParser() p.add_argument('-v', '--verbose', default=0, action='count') - curve_names = [name.decode('ascii') for name in formats.SUPPORTED_CURVES] + curve_names = [name for name in formats.SUPPORTED_CURVES] curve_names = ', '.join(sorted(curve_names)) p.add_argument('-e', '--ecdsa-curve-name', metavar='CURVE', default=formats.CURVE_NIST256, @@ -128,7 +128,7 @@ def run_agent(client_factory=client.Client): args = create_agent_parser().parse_args() setup_logging(verbosity=args.verbose) - with client_factory(curve=args.ecdsa_curve_name.encode('ascii')) as conn: + with client_factory(curve=args.ecdsa_curve_name) as conn: label = args.identity command = args.command @@ -156,7 +156,7 @@ def run_git(client_factory=client.Client): args = create_git_parser().parse_args() setup_logging(verbosity=args.verbose) - with client_factory(curve=args.ecdsa_curve_name.encode('ascii')) as conn: + with client_factory(curve=args.ecdsa_curve_name) as conn: label = git_host(args.remote, ['pushurl', 'url']) if not label: log.error('Could not find "%s" SSH remote in .git/config', diff --git a/trezor_agent/formats.py b/trezor_agent/formats.py index baa8ddd..de8ec82 100644 --- a/trezor_agent/formats.py +++ b/trezor_agent/formats.py @@ -12,8 +12,8 @@ from . import util log = logging.getLogger(__name__) # Supported ECDSA curves -CURVE_NIST256 = b'nist256p1' -CURVE_ED25519 = b'ed25519' +CURVE_NIST256 = 'nist256p1' +CURVE_ED25519 = 'ed25519' SUPPORTED_CURVES = {CURVE_NIST256, CURVE_ED25519} # SSH key types diff --git a/trezor_agent/tests/test_client.py b/trezor_agent/tests/test_client.py index b635b8e..7b9abd6 100644 --- a/trezor_agent/tests/test_client.py +++ b/trezor_agent/tests/test_client.py @@ -29,7 +29,7 @@ class FakeConnection(object): def get_public_node(self, n, ecdsa_curve_name=b'secp256k1'): assert not self.closed assert n == ADDR - assert ecdsa_curve_name in {b'secp256k1', b'nist256p1'} + assert ecdsa_curve_name in {'secp256k1', 'nist256p1'} result = mock.Mock(spec=[]) result.node = mock.Mock(spec=[]) result.node.public_key = PUBKEY @@ -91,7 +91,7 @@ def test_ssh_agent(): client.identity_to_string(ident)) assert challenge_hidden == BLOB assert challenge_visual == 'VISUAL' - assert ecdsa_curve_name == b'nist256p1' + assert ecdsa_curve_name == 'nist256p1' result = mock.Mock(spec=[]) result.public_key = PUBKEY diff --git a/trezor_agent/tests/test_formats.py b/trezor_agent/tests/test_formats.py index ba28900..77a0491 100644 --- a/trezor_agent/tests/test_formats.py +++ b/trezor_agent/tests/test_formats.py @@ -29,7 +29,7 @@ def test_parse_public_key(): assert key['name'] == b'home' assert key['point'] == _point - assert key['curve'] == b'nist256p1' + assert key['curve'] == 'nist256p1' assert key['fingerprint'] == '4b:19:bc:0f:c8:7e:dc:fa:1a:e3:c2:ff:6f:e0:80:a2' # nopep8 assert key['type'] == b'ecdsa-sha2-nistp256' @@ -46,7 +46,7 @@ def test_parse_ed25519(): 'fSO8nLIi736is+f0erq28RTc7CkM11NZtTKR hello\n') p = formats.import_public_key(pubkey) assert p['name'] == b'hello' - assert p['curve'] == b'ed25519' + assert p['curve'] == 'ed25519' BLOB = (b'\x00\x00\x00\x0bssh-ed25519\x00\x00\x00 P]\x17kc}#' b'\xbc\x9c\xb2"\xef~\xa2\xb3\xe7\xf4z\xba\xb6\xf1\x14'