commit b08bc514db184e6d96ff20169c086e3c6b807e99
parent 2c6534c1baed7e7999c424fc20f673aeec6130fe
Author: thomasv <thomasv@gitorious>
Date: Sun, 15 Sep 2013 17:49:23 +0200
sign/verify: do unicode conversion only for messages sent by the gui
Diffstat:
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/gui/gui_classic/main_window.py b/gui/gui_classic/main_window.py
@@ -1495,8 +1495,10 @@ class ElectrumWindow(QMainWindow):
@protected
def do_sign(self, address, message, signature, password):
+ message = unicode(message.toPlainText())
+ message = message.encode('utf-8')
try:
- sig = self.wallet.sign_message(str(address.text()), unicode(message.toPlainText()), password)
+ sig = self.wallet.sign_message(str(address.text()), message, password)
signature.setText(sig)
except BaseException, e:
self.show_message(str(e))
@@ -1558,7 +1560,9 @@ class ElectrumWindow(QMainWindow):
layout.setRowStretch(3,1)
def do_verify():
- if self.wallet.verify_message(verify_address.text(), str(verify_signature.toPlainText()), unicode(verify_message.toPlainText())):
+ message = unicode(verify_message.toPlainText()
+ message = message.encode('utf-8')
+ if self.wallet.verify_message(verify_address.text(), str(verify_signature.toPlainText()), message)):
self.show_message(_("Signature verified"))
else:
self.show_message(_("Error: wrong signature"))
diff --git a/lib/bitcoin.py b/lib/bitcoin.py
@@ -287,8 +287,6 @@ SECP256k1 = ecdsa.curves.Curve("SECP256k1", curve_secp256k1, generator_secp256k1
from ecdsa.util import string_to_number, number_to_string
def msg_magic(message):
- message = message.encode('utf-8')
- print_error(("message", message))
varint = var_int(len(message))
encoded_varint = "".join([chr(int(varint[i:i+2], 16)) for i in xrange(0, len(varint), 2)])