From 63990bf698ccc3da8c3ebe2c52d4afddeef4cf3f Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sun, 5 Jul 2015 15:35:25 +0300 Subject: [PATCH] trezor: show identity.path at challenge_visual It won't be signed when using SSH-agent mode. --- sshagent/trezor.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sshagent/trezor.py b/sshagent/trezor.py index 4bafab8..3e1afc2 100644 --- a/sshagent/trezor.py +++ b/sshagent/trezor.py @@ -70,14 +70,17 @@ class Client(object): log.info('confirm user %s connection to %r using Trezor...', msg['user'], label) - s = self.client.sign_identity(identity=identity, - challenge_hidden=blob, - challenge_visual='', - ecdsa_curve_name=self.curve_name) - assert len(s.signature) == 65 - assert s.signature[0] == b'\x00' - sig = s.signature[1:] + assert identity.proto == 'ssh' + visual = identity.path # not signed when proto='ssh' + result = self.client.sign_identity(identity=identity, + challenge_hidden=blob, + challenge_visual=visual, + ecdsa_curve_name=self.curve_name) + assert len(result.signature) == 65 + assert result.signature[0] == b'\x00' + + sig = result.signature[1:] r = util.bytes2num(sig[:32]) s = util.bytes2num(sig[32:]) return (r, s)