tbugfix: encryption of encrypted keys - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1181f4ef016ef4fb4897d363de1eccc4e9496a90 DIR parent ef0809a1dfe935a494a0926d5ec1df0f6026e4cb HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 17 May 2012 08:32:49 +0200 bugfix: encryption of encrypted keys Diffstat: M electrum | 9 +-------- M electrum4a.py | 2 +- M lib/gui.py | 2 +- M lib/gui_qt.py | 2 +- M lib/wallet.py | 4 ++-- 5 files changed, 6 insertions(+), 13 deletions(-) --- DIR diff --git a/electrum b/electrum t@@ -443,14 +443,7 @@ if __name__ == '__main__': sys.exit(1) new_password = getpass.getpass('New password:') if new_password == getpass.getpass('Confirm new password:'): - wallet.use_encryption = (new_password != '') - wallet.seed = wallet.pw_encode( seed, new_password) - for k in wallet.imported_keys.keys(): - a = wallet.imported_keys[k] - b = wallet.pw_decode(a, password) - c = wallet.pw_encode(b, new_password) - wallet.imported_keys[k] = c - wallet.save() + wallet.update_password(seed, password, new_password) else: print "error: mismatch" DIR diff --git a/electrum4a.py b/electrum4a.py t@@ -792,7 +792,7 @@ def change_password_dialog(): modal_dialog('error','passwords do not match') return - wallet.update_password(seed, new_password) + wallet.update_password(seed, password, new_password) if new_password: modal_dialog('Password updated','your wallet is encrypted') else: DIR diff --git a/lib/gui.py b/lib/gui.py t@@ -530,7 +530,7 @@ def change_password_dialog(wallet, parent, icon): show_message("passwords do not match") return - wallet.update_password(seed, new_password) + wallet.update_password(seed, password, new_password) if icon: if wallet.use_encryption: DIR diff --git a/lib/gui_qt.py b/lib/gui_qt.py t@@ -938,7 +938,7 @@ class ElectrumWindow(QMainWindow): QMessageBox.warning(parent, 'Error', 'Passwords do not match', 'OK') return - wallet.update_password(seed, new_password) + wallet.update_password(seed, password, new_password) @staticmethod def seed_dialog(wallet, parent=None): DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -847,13 +847,13 @@ class Wallet: return target, signing_addr, auth_name - def update_password(self, seed, new_password): + def update_password(self, seed, old_password, new_password): if new_password == '': new_password = None self.use_encryption = (new_password != None) self.seed = self.pw_encode( seed, new_password) for k in self.imported_keys.keys(): a = self.imported_keys[k] - b = self.pw_decode(a, password) + b = self.pw_decode(a, old_password) c = self.pw_encode(b, new_password) self.imported_keys[k] = c self.save()