commit 1181f4ef016ef4fb4897d363de1eccc4e9496a90
parent ef0809a1dfe935a494a0926d5ec1df0f6026e4cb
Author: ThomasV <thomasv@gitorious>
Date: Thu, 17 May 2012 08:32:49 +0200
bugfix: encryption of encrypted keys
Diffstat:
5 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/electrum b/electrum
@@ -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"
diff --git a/electrum4a.py b/electrum4a.py
@@ -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:
diff --git a/lib/gui.py b/lib/gui.py
@@ -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:
diff --git a/lib/gui_qt.py b/lib/gui_qt.py
@@ -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):
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -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()