Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/crypter.cpp
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | |||||
bool CCryptoKeyStore::Unlock(const CKeyingMaterial &vMasterKeyIn) { | bool CCryptoKeyStore::Unlock(const CKeyingMaterial &vMasterKeyIn) { | ||||
{ | { | ||||
LOCK(cs_KeyStore); | LOCK(cs_KeyStore); | ||||
if (!SetCrypted()) { | if (!SetCrypted()) { | ||||
return false; | return false; | ||||
} | } | ||||
bool keyPass = false; | // Always pass when there are no encrypted keys | ||||
bool keyPass = mapCryptedKeys.empty(); | |||||
bool keyFail = false; | bool keyFail = false; | ||||
CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin(); | CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin(); | ||||
for (; mi != mapCryptedKeys.end(); ++mi) { | for (; mi != mapCryptedKeys.end(); ++mi) { | ||||
const CPubKey &vchPubKey = (*mi).second.first; | const CPubKey &vchPubKey = (*mi).second.first; | ||||
const std::vector<uint8_t> &vchCryptedSecret = (*mi).second.second; | const std::vector<uint8_t> &vchCryptedSecret = (*mi).second.second; | ||||
CKey key; | CKey key; | ||||
if (!DecryptKey(vMasterKeyIn, vchCryptedSecret, vchPubKey, key)) { | if (!DecryptKey(vMasterKeyIn, vchCryptedSecret, vchPubKey, key)) { | ||||
keyFail = true; | keyFail = true; | ||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |