From 19ba2364b6dfcc71ed135d470903fbe0211e1660 Mon Sep 17 00:00:00 2001 From: Ali Raheem Date: Mon, 1 Jan 2018 20:55:10 +0000 Subject: [PATCH 1/2] Show message sign when signing Allow verification by showing the SHA256 hash of the message to be signed (which is also displayed on Ledger). --- plugins/ledger/ledger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py index a82cb8442..e6866dc2c 100644 --- a/plugins/ledger/ledger.py +++ b/plugins/ledger/ledger.py @@ -220,10 +220,11 @@ class Ledger_KeyStore(Hardware_KeyStore): def sign_message(self, sequence, message, password): self.signing = True message = message.encode('utf8') + message_hash = hashlib.sha256(message).hexdigest() # prompt for the PIN before displaying the dialog if necessary client = self.get_client() address_path = self.get_derivation()[2:] + "/%d/%d"%sequence - self.handler.show_message("Signing message ...") + self.handler.show_message("Signing message ...\r\nMessage hash: "+message_hash) try: info = self.get_client().signMessagePrepare(address_path, message) pin = "" From ed86fee3feed60cd2740562318974e86655a29a4 Mon Sep 17 00:00:00 2001 From: Ali Raheem Date: Mon, 1 Jan 2018 21:23:37 +0000 Subject: [PATCH 2/2] Format of message hash to match Ledger On signing SHA256 of message is shown on Ledger in caps. Make Electrum show in same format to save confusion. --- plugins/ledger/ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ledger/ledger.py b/plugins/ledger/ledger.py index e6866dc2c..e9a0063d3 100644 --- a/plugins/ledger/ledger.py +++ b/plugins/ledger/ledger.py @@ -220,7 +220,7 @@ class Ledger_KeyStore(Hardware_KeyStore): def sign_message(self, sequence, message, password): self.signing = True message = message.encode('utf8') - message_hash = hashlib.sha256(message).hexdigest() + message_hash = hashlib.sha256(message).hexdigest().upper() # prompt for the PIN before displaying the dialog if necessary client = self.get_client() address_path = self.get_derivation()[2:] + "/%d/%d"%sequence