From e8b6d43636e09ff977d06902a8139a3e4e5ef299 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 16:41:34 +0200 Subject: [PATCH 1/6] vector_ref::cleanse actually sets to zero. --- libdevcore/vector_ref.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h index c7ba3a437..b5d0453a6 100644 --- a/libdevcore/vector_ref.h +++ b/libdevcore/vector_ref.h @@ -86,7 +86,7 @@ public: void cleanse() { uint8_t* p = (uint8_t*)begin(); - size_t len = (uint8_t*)end() - p; + size_t const len = (uint8_t*)end() - p; size_t loop = len; size_t count = s_cleanseCounter; while (loop--) @@ -98,6 +98,7 @@ public: if (p) count += (63 + (size_t)p); s_cleanseCounter = (uint8_t)count; + memset((uint8_t*)begin(), 0, len); } _T* begin() { return m_data; } From 441105ec4c568c28c0539bd78b2c6c139012dc00 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 16:41:48 +0200 Subject: [PATCH 2/6] ImportKey dialog. --- alethzero/Transact.cpp | 15 +- alethzero/plugins/keys/ImportKey.cpp | 181 +++++++++++++++++ alethzero/plugins/keys/ImportKey.h | 44 ++++ alethzero/plugins/keys/ImportKey.ui | 291 +++++++++++++++++++++++++++ libdevcrypto/SecretStore.cpp | 10 +- libdevcrypto/SecretStore.h | 3 + libethcore/KeyManager.cpp | 7 + libethcore/KeyManager.h | 3 +- 8 files changed, 544 insertions(+), 10 deletions(-) create mode 100644 alethzero/plugins/keys/ImportKey.cpp create mode 100644 alethzero/plugins/keys/ImportKey.h create mode 100644 alethzero/plugins/keys/ImportKey.ui diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index c9d687ef3..e51e3f6e0 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -136,11 +136,12 @@ void Transact::updateDestination() // TODO: should be a Qt model. ui->destination->clear(); ui->destination->addItem("(Create Contract)"); + QMultiMap in; for (Address const& a: m_main->allKnownAddresses()) - { - cdebug << "Adding" << a << m_main->toName(a) << " -> " << (m_main->toName(a) + " (" + ICAP(a).encoded() + ")"); - ui->destination->addItem(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QString::fromStdString(a.hex())); - } + in.insert(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QString::fromStdString(a.hex())); + for (auto i = in.begin(); i != in.end(); ++i) + ui->destination->addItem(i.key(), i.value()); + } void Transact::updateFee() @@ -361,9 +362,8 @@ void Transact::timerEvent(QTimerEvent*) } updateBounds(); - if (m_lowerBound == m_upperBound) - finaliseBounds(); } + finaliseBounds(); } void Transact::updateBounds() @@ -380,6 +380,8 @@ void Transact::updateBounds() void Transact::finaliseBounds() { + killTimer(m_gasCalcTimer); + quint64 baseGas = (quint64)Transaction::gasRequired(m_data, 0); ui->progressGas->setVisible(false); @@ -420,7 +422,6 @@ void Transact::finaliseBounds() updateFee(); ui->code->setHtml(htmlInfo + m_dataInfo); ui->send->setEnabled(true); - killTimer(m_gasCalcTimer); } GasRequirements Transact::determineGasRequirements() diff --git a/alethzero/plugins/keys/ImportKey.cpp b/alethzero/plugins/keys/ImportKey.cpp new file mode 100644 index 000000000..3769e7ed6 --- /dev/null +++ b/alethzero/plugins/keys/ImportKey.cpp @@ -0,0 +1,181 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file ImportKey.cpp + * @author Gav Wood + * @date 2015 + */ + +#include "ImportKey.h" +#include +#include +#include +#include +#include +#include +#include +#include "ui_ImportKey.h" +using namespace std; +using namespace dev; +using namespace az; +using namespace eth; + +DEV_AZ_NOTE_PLUGIN(ImportKey); + +ImportKey::ImportKey(MainFace* _m): + Plugin(_m, "ImportKey") +{ + connect(addMenuItem("Import Key...", "menuTools", true), SIGNAL(triggered()), SLOT(import())); +} + +ImportKey::~ImportKey() +{ +} + +void ImportKey::import() +{ + QDialog d; + Ui_ImportKey u; + u.setupUi(&d); + d.setWindowTitle("Import Key"); + + string lastKey; + Secret lastSecret; + string lastPassword; + + auto updateImport = [&](){ + u.import_2->setDisabled(u.addressOut->text().isEmpty() || u.name->text().isEmpty()); + }; + + auto updateAddress = [&](){ + string as = u.address->text().toStdString(); + try + { + u.addressOut->setText(QString::fromStdString(main()->render(eth::toAddress(as)))); + } + catch (...) + { + u.addressOut->setText(""); + } + updateImport(); + }; + + auto updatePassword = [&](){ + u.passwordHash->setText(QString::fromStdString(sha3(u.password->text().toStdString()).hex())); + }; + + function updateKey = [&](){ + // update according to key. + if (lastKey == u.key->text().toStdString()) + return; + lastKey = u.key->text().toStdString(); + lastSecret.clear(); + u.address->clear(); + u.oldPassword->setEnabled(false); + u.oldPassword->setChecked(false); + bytes b; + DEV_IGNORE_EXCEPTIONS(b = fromHex(lastKey, WhenError::Throw)); + if (b.size() == 32) + { + lastSecret = Secret(b); + bytesRef(&b).cleanse(); + } + while (!lastKey.empty() && !lastSecret) + { + bool ok; + lastPassword = QInputDialog::getText(&d, "Open Key File", "Enter the password protecting this key file. Cancel if you do not want to provide te password.", QLineEdit::Password, QString(), &ok).toStdString(); + if (!ok) + { + lastSecret.clear(); + break; + } + // Try to open as a file. + lastSecret = KeyManager::presaleSecret(contentsString(lastKey), [&](bool first){ return first ? lastPassword : string(); }).secret(); + if (!lastSecret) + lastSecret = Secret(SecretStore::secret(contentsString(lastKey), lastPassword)); + if (!lastSecret && QMessageBox::warning(&d, "Invalid Password or Key File", "The given password could not be used to decrypt the key file given. Are you sure it is a valid key file and that the password is correct?", QMessageBox::Abort, QMessageBox::Retry) == QMessageBox::Abort) + { + u.key->clear(); + updateKey(); + return; + } + } + u.oldPassword->setEnabled(!!lastSecret); + u.newPassword->setEnabled(!!lastSecret); + u.noPassword->setEnabled(!!lastSecret); + u.password->setEnabled(!!lastSecret); + u.passwordHash->setReadOnly(!!lastSecret); + u.address->setReadOnly(!lastSecret); + if (lastSecret) + { + u.oldPassword->setEnabled(!lastPassword.empty()); + if (lastPassword.empty()) + u.oldPassword->setChecked(false); + u.address->setText(QString::fromStdString(ICAP(toAddress(lastSecret)).encoded())); + updateAddress(); + } + else + u.address->clear(); + }; + + connect(u.noPassword, &QRadioButton::clicked, [&](){ + u.passwordHash->clear(); + u.hint->setText("Same as master password."); + }); + connect(u.oldPassword, &QRadioButton::clicked, [&](){ + u.passwordHash->setText(QString::fromStdString(sha3(lastPassword).hex())); + u.hint->setText("Same as original password for file " + QString::fromStdString(lastKey)); + }); + connect(u.newPassword, &QRadioButton::clicked, [&](){ + u.hint->setText(""); + updatePassword(); + }); + connect(u.password, &QLineEdit::textChanged, [&](){ updatePassword(); }); + connect(u.address, &QLineEdit::textChanged, [&](){ updateAddress(); }); + connect(u.key, &QLineEdit::textEdited, [&](){ updateKey(); }); + connect(u.name, &QLineEdit::textEdited, [&](){ updateImport(); }); + connect(u.openKey, &QToolButton::clicked, [&](){ + QString fn = QFileDialog::getOpenFileName(main(), "Open Key File", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); + if (!fn.isEmpty()) + { + u.key->setText(fn); + updateKey(); + } + }); + + if (d.exec() == QDialog::Accepted) + { + Address a = ICAP::decoded(u.addressOut->text().toStdString()).direct(); + string n = u.name->text().toStdString(); + h256 ph; + DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); + string h = u.hint->text().toStdString(); + bool mp = u.noPassword->isChecked(); + string p = mp ? string() : u.oldPassword ? lastPassword : u.password->text().toStdString(); + + // check for a brain wallet import + if (lastKey.empty() && !lastSecret) + main()->keyManager().importExistingBrain(a, n, h); + else if (!lastKey.empty() && !lastSecret) + main()->keyManager().importExisting(main()->keyManager().store().importKey(lastKey), n, a, ph, h); + else if (mp) + main()->keyManager().import(lastSecret, n); + else + main()->keyManager().import(lastSecret, n, p, h); + + main()->noteKeysChanged(); + } +} diff --git a/alethzero/plugins/keys/ImportKey.h b/alethzero/plugins/keys/ImportKey.h new file mode 100644 index 000000000..ed233664e --- /dev/null +++ b/alethzero/plugins/keys/ImportKey.h @@ -0,0 +1,44 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file ImportKey.h + * @author Gav Wood + * @date 2015 + */ + +#pragma once + +#include "MainFace.h" + +namespace dev +{ +namespace az +{ + +class ImportKey: public QObject, public Plugin +{ + Q_OBJECT + +public: + ImportKey(MainFace* _m); + ~ImportKey(); + +private slots: + void import(); +}; + +} +} diff --git a/alethzero/plugins/keys/ImportKey.ui b/alethzero/plugins/keys/ImportKey.ui new file mode 100644 index 000000000..855877eb9 --- /dev/null +++ b/alethzero/plugins/keys/ImportKey.ui @@ -0,0 +1,291 @@ + + + ImportKey + + + + 0 + 0 + 575 + 315 + + + + Dialog + + + + + + + + Leave blank for a brain wallet + + + + + + + ... + + + + + + + true + + + + + + + Show + + + + + + + Address: + + + address + + + + + + + New Password: + + + buttonGroup + + + + + + + Place the address of the key here + + + + + + + Name: + + + name + + + + + + + Master password + + + true + + + buttonGroup + + + + + + + + + + false + + + Old password + + + buttonGroup + + + + + + + Enter the password you wish to use for the key here + + + + + + + true + + + Unknown Address + + + + + + + Enter this key's name here + + + + + + + Password Hash: + + + passwordHash + + + + + + + Password Hint: + + + hint + + + + + + + Use same password for the key as for the master. + + + false + + + + + + + Key: + + + key + + + + + + + Use the same password as in the key file. + + + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + false + + + &Import + + + true + + + + + + + + + key + openKey + name + address + noPassword + oldPassword + newPassword + password + showPassword + passwordHash + hint + cancel + import_2 + + + + + import_2 + clicked() + ImportKey + accept() + + + 564 + 304 + + + 449 + 504 + + + + + cancel + clicked() + ImportKey + reject() + + + 478 + 304 + + + 351 + 506 + + + + + + + + diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index 39f421f3e..b214c92b2 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -107,6 +107,14 @@ bytesSec SecretStore::secret(h128 const& _uuid, function const& _pass, return key; } +bytesSec SecretStore::secret(string const& _content, string const& _pass) +{ + js::mValue u = upgraded(_content); + if (u.type() != js::obj_type) + return bytesSec(); + return decrypt(js::write_string(u.get_obj()["crypto"], false), _pass); +} + h128 SecretStore::importSecret(bytesSec const& _s, string const& _pass) { h128 r; @@ -169,8 +177,6 @@ void SecretStore::save(string const& _keysPath) void SecretStore::load(string const& _keysPath) { fs::path p(_keysPath); - fs::create_directories(p); - DEV_IGNORE_EXCEPTIONS(fs::permissions(p, fs::owner_all)); for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) if (fs::is_regular_file(it->path())) readKey(it->path().string(), true); diff --git a/libdevcrypto/SecretStore.h b/libdevcrypto/SecretStore.h index 0fcb18734..9117788cb 100644 --- a/libdevcrypto/SecretStore.h +++ b/libdevcrypto/SecretStore.h @@ -53,6 +53,9 @@ public: /// @param _pass function that returns the password for the key. /// @param _useCache if true, allow previously decrypted keys to be returned directly. bytesSec secret(h128 const& _uuid, std::function const& _pass, bool _useCache = true) const; + /// @returns the secret key stored by the given @a _uuid. + /// @param _pass function that returns the password for the key. + static bytesSec secret(std::string const& _content, std::string const& _pass); /// Imports the (encrypted) key stored in the file @a _file and copies it to the managed directory. h128 importKey(std::string const& _file) { auto ret = readKey(_file, false); if (ret) save(); return ret; } /// Imports the (encrypted) key contained in the json formatted @a _content and stores it in diff --git a/libethcore/KeyManager.cpp b/libethcore/KeyManager.cpp index 6f3733d74..e00cb68d7 100644 --- a/libethcore/KeyManager.cpp +++ b/libethcore/KeyManager.cpp @@ -243,6 +243,13 @@ Address KeyManager::importBrain(string const& _seed, string const& _accountName, return addr; } +void KeyManager::importExistingBrain(Address const& _a, string const& _accountName, string const& _passwordHint) +{ + m_keyInfo[_a].accountName = _accountName; + m_keyInfo[_a].passwordHint = _passwordHint; + write(); +} + void KeyManager::importExisting(h128 const& _uuid, string const& _info, string const& _pass, string const& _passwordHint) { bytesSec key = m_store.secret(_uuid, [&](){ return _pass; }); diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index 8830f0044..f1081116a 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -108,6 +108,7 @@ public: h128 import(Secret const& _s, std::string const& _accountName, std::string const& _pass, std::string const& _passwordHint); h128 import(Secret const& _s, std::string const& _accountName) { return import(_s, _accountName, defaultPassword(), std::string()); } Address importBrain(std::string const& _seed, std::string const& _accountName, std::string const& _seedHint); + void importExistingBrain(Address const& _a, std::string const& _accountName, std::string const& _seedHint); SecretStore& store() { return m_store; } void importExisting(h128 const& _uuid, std::string const& _accountName, std::string const& _pass, std::string const& _passwordHint); @@ -130,7 +131,7 @@ public: static std::string defaultPath() { return getDataDir("ethereum") + "/keys.info"; } /// Extracts the secret key from the presale wallet. - KeyPair presaleSecret(std::string const& _json, std::function const& _password); + static KeyPair presaleSecret(std::string const& _json, std::function const& _password); /// @returns the brainwallet secret for the given seed. static Secret brain(std::string const& _seed); From d5776ef0b4d48d7c18277217e36da967f72dec3d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 18:42:36 +0200 Subject: [PATCH 3/6] Fixes for new import dialog. --- alethzero/plugins/keys/ImportKey.cpp | 65 ++++++++++--- alethzero/plugins/keys/ImportKey.ui | 132 ++++++++++++++++++--------- 2 files changed, 140 insertions(+), 57 deletions(-) diff --git a/alethzero/plugins/keys/ImportKey.cpp b/alethzero/plugins/keys/ImportKey.cpp index 3769e7ed6..f9278a1fc 100644 --- a/alethzero/plugins/keys/ImportKey.cpp +++ b/alethzero/plugins/keys/ImportKey.cpp @@ -55,16 +55,44 @@ void ImportKey::import() string lastKey; Secret lastSecret; string lastPassword; + Address lastAddress; + + auto updateAction = [&](){ + if (!u.import_2->isEnabled()) + u.action->clear(); + else if (lastKey.empty() && !lastSecret) + u.action->setText("Import brainwallet with given address and hint"); + else if (!lastKey.empty() && !lastSecret) + { + h256 ph; + DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); + if (ph) + u.action->setText("Import untouched key with given address and hint"); + else + u.action->setText("Import untouched key with given address, password hash and hint"); + } + else + { + bool mp = u.noPassword->isChecked(); + if (mp) + u.action->setText("Import recast key using master password and given hint"); + else + u.action->setText("Import recast key with given password and hint"); + } + }; auto updateImport = [&](){ - u.import_2->setDisabled(u.addressOut->text().isEmpty() || u.name->text().isEmpty()); + u.import_2->setDisabled(u.addressOut->text().isEmpty() || u.name->text().isEmpty() || !(u.oldPassword->isChecked() || u.newPassword->isChecked() || u.noPassword->isChecked())); + updateAction(); }; auto updateAddress = [&](){ + lastAddress.clear(); string as = u.address->text().toStdString(); try { - u.addressOut->setText(QString::fromStdString(main()->render(eth::toAddress(as)))); + lastAddress = eth::toAddress(as); + u.addressOut->setText(QString::fromStdString(main()->render(lastAddress))); } catch (...) { @@ -75,6 +103,7 @@ void ImportKey::import() auto updatePassword = [&](){ u.passwordHash->setText(QString::fromStdString(sha3(u.password->text().toStdString()).hex())); + updateAction(); }; function updateKey = [&](){ @@ -116,9 +145,12 @@ void ImportKey::import() u.oldPassword->setEnabled(!!lastSecret); u.newPassword->setEnabled(!!lastSecret); u.noPassword->setEnabled(!!lastSecret); + u.masterLabel->setEnabled(!!lastSecret); + u.oldLabel->setEnabled(!!lastSecret); + u.showPassword->setEnabled(!!lastSecret); u.password->setEnabled(!!lastSecret); u.passwordHash->setReadOnly(!!lastSecret); - u.address->setReadOnly(!lastSecret); + u.address->setReadOnly(!!lastSecret); if (lastSecret) { u.oldPassword->setEnabled(!lastPassword.empty()); @@ -129,15 +161,18 @@ void ImportKey::import() } else u.address->clear(); + updateImport(); }; connect(u.noPassword, &QRadioButton::clicked, [&](){ u.passwordHash->clear(); - u.hint->setText("Same as master password."); + u.hint->setText("No additional password (same as master password)."); + updateAction(); }); connect(u.oldPassword, &QRadioButton::clicked, [&](){ u.passwordHash->setText(QString::fromStdString(sha3(lastPassword).hex())); u.hint->setText("Same as original password for file " + QString::fromStdString(lastKey)); + updateAction(); }); connect(u.newPassword, &QRadioButton::clicked, [&](){ u.hint->setText(""); @@ -147,6 +182,7 @@ void ImportKey::import() connect(u.address, &QLineEdit::textChanged, [&](){ updateAddress(); }); connect(u.key, &QLineEdit::textEdited, [&](){ updateKey(); }); connect(u.name, &QLineEdit::textEdited, [&](){ updateImport(); }); + connect(u.showPassword, &QCheckBox::toggled, [&](bool show){ u.password->setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password); }); connect(u.openKey, &QToolButton::clicked, [&](){ QString fn = QFileDialog::getOpenFileName(main(), "Open Key File", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); if (!fn.isEmpty()) @@ -158,23 +194,28 @@ void ImportKey::import() if (d.exec() == QDialog::Accepted) { - Address a = ICAP::decoded(u.addressOut->text().toStdString()).direct(); + Address a = ICAP::decoded(lastAddress).direct(); string n = u.name->text().toStdString(); - h256 ph; - DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); string h = u.hint->text().toStdString(); - bool mp = u.noPassword->isChecked(); - string p = mp ? string() : u.oldPassword ? lastPassword : u.password->text().toStdString(); // check for a brain wallet import if (lastKey.empty() && !lastSecret) main()->keyManager().importExistingBrain(a, n, h); else if (!lastKey.empty() && !lastSecret) + { + h256 ph; + DEV_IGNORE_EXCEPTIONS(ph = h256(u.passwordHash->text().toStdString())); main()->keyManager().importExisting(main()->keyManager().store().importKey(lastKey), n, a, ph, h); - else if (mp) - main()->keyManager().import(lastSecret, n); + } else - main()->keyManager().import(lastSecret, n, p, h); + { + bool mp = u.noPassword->isChecked(); + string p = mp ? string() : u.oldPassword ? lastPassword : u.password->text().toStdString(); + if (mp) + main()->keyManager().import(lastSecret, n); + else + main()->keyManager().import(lastSecret, n, p, h); + } main()->noteKeysChanged(); } diff --git a/alethzero/plugins/keys/ImportKey.ui b/alethzero/plugins/keys/ImportKey.ui index 855877eb9..56aa7a9fa 100644 --- a/alethzero/plugins/keys/ImportKey.ui +++ b/alethzero/plugins/keys/ImportKey.ui @@ -6,8 +6,8 @@ 0 0 - 575 - 315 + 530 + 389 @@ -16,20 +16,6 @@ - - - - Leave blank for a brain wallet - - - - - - - ... - - - @@ -39,6 +25,9 @@ + + false + Show @@ -47,17 +36,27 @@ - Address: + &Address: address + + + + ... + + + + + false + - New Password: + New &Password: buttonGroup @@ -74,7 +73,7 @@ - Name: + &Name: name @@ -83,8 +82,11 @@ + + false + - Master password + &Master password true @@ -103,7 +105,7 @@ false - Old password + &Old password buttonGroup @@ -117,16 +119,6 @@ - - - - true - - - Unknown Address - - - @@ -137,7 +129,7 @@ - Password Hash: + Password &Hash: passwordHash @@ -147,7 +139,7 @@ - Password Hint: + Password Hin&t: hint @@ -155,7 +147,10 @@ - + + + false + Use same password for the key as for the master. @@ -164,10 +159,20 @@ - + + + + Brain wallet (no key file) + + + true + + + + - Key: + &Key: key @@ -175,12 +180,25 @@ - + + + false + Use the same password as in the key file. + + + + true + + + Unknown Address + + + @@ -198,6 +216,13 @@ + + + + + + + @@ -216,6 +241,9 @@ Cancel + + Esc + @@ -236,8 +264,6 @@ - key - openKey name address noPassword @@ -259,12 +285,12 @@ accept() - 564 - 304 + 519 + 378 449 - 504 + 388 @@ -275,12 +301,28 @@ reject() - 478 - 304 + 433 + 378 351 - 506 + 388 + + + + + newPassword + pressed() + password + setFocus() + + + 80 + 211 + + + 185 + 215 From bb8e88f05cd91d59150c105235c6aac0145202a1 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 18:42:56 +0200 Subject: [PATCH 4/6] Minor additional fix for dialog. --- alethzero/plugins/keys/ImportKey.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alethzero/plugins/keys/ImportKey.cpp b/alethzero/plugins/keys/ImportKey.cpp index f9278a1fc..6f47505d4 100644 --- a/alethzero/plugins/keys/ImportKey.cpp +++ b/alethzero/plugins/keys/ImportKey.cpp @@ -194,7 +194,7 @@ void ImportKey::import() if (d.exec() == QDialog::Accepted) { - Address a = ICAP::decoded(lastAddress).direct(); + Address a = lastAddress; string n = u.name->text().toStdString(); string h = u.hint->text().toStdString(); From 7362c38bb06c6003495276f213ef39ace162b51c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 16 Aug 2015 22:30:23 +0200 Subject: [PATCH 5/6] Minor UI improvements --- alethzero/plugins/keys/ImportKey.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/alethzero/plugins/keys/ImportKey.ui b/alethzero/plugins/keys/ImportKey.ui index 56aa7a9fa..03f62e152 100644 --- a/alethzero/plugins/keys/ImportKey.ui +++ b/alethzero/plugins/keys/ImportKey.ui @@ -265,7 +265,10 @@ name + key + openKey address + addressOut noPassword oldPassword newPassword From 0d1fd853863088631b8e541110aad1a03feb764f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 17 Aug 2015 10:48:32 +0200 Subject: [PATCH 6/6] Tests fix; ignore missing web3 keys path. --- libdevcrypto/SecretStore.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index b214c92b2..1b1e67e9b 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -177,9 +177,13 @@ void SecretStore::save(string const& _keysPath) void SecretStore::load(string const& _keysPath) { fs::path p(_keysPath); - for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) - if (fs::is_regular_file(it->path())) - readKey(it->path().string(), true); + try + { + for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) + if (fs::is_regular_file(it->path())) + readKey(it->path().string(), true); + } + catch (...) {} } h128 SecretStore::readKey(string const& _file, bool _takeFileOwnership)