From ece457627b9c354847f1bb27222ae2d3fdb2175b Mon Sep 17 00:00:00 2001 From: Anilkumar18 <32846534+Anilkumar18@users.noreply.github.com> Date: Mon, 11 Jun 2018 17:54:22 +0530 Subject: [PATCH 1/2] Added a meaningful message on invalid public key --- gui/qt/main_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 6d5786d8e..f1efe4aed 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -2248,7 +2248,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): encrypted_e.setText(encrypted.decode('ascii')) except BaseException as e: traceback.print_exc(file=sys.stdout) - self.show_warning(str(e)) + self.show_warning("Invalid Public key") def encrypt_message(self, address=''): d = WindowModalDialog(self, _('Encrypt/decrypt Message')) From 0a24c820bb4d9c8deab9d388d589f43cdd3600e4 Mon Sep 17 00:00:00 2001 From: Anilkumar18 <32846534+Anilkumar18@users.noreply.github.com> Date: Tue, 12 Jun 2018 11:16:02 +0530 Subject: [PATCH 2/2] Altered the do_encrypt warning message changed the protection against public_key --- gui/qt/main_window.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index f1efe4aed..97a7ac8eb 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -2244,11 +2244,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): message = message.encode('utf-8') try: public_key = ecc.ECPubkey(bfh(pubkey_e.text())) - encrypted = public_key.encrypt_message(message) - encrypted_e.setText(encrypted.decode('ascii')) except BaseException as e: - traceback.print_exc(file=sys.stdout) - self.show_warning("Invalid Public key") + traceback.print_exc(file=sys.stdout) + self.show_warning(_('Invalid Public key')) + return + encrypted = public_key.encrypt_message(message) + encrypted_e.setText(encrypted.decode('ascii')) def encrypt_message(self, address=''): d = WindowModalDialog(self, _('Encrypt/decrypt Message'))