| 409 | } |
| 410 | |
| 411 | bool CWallet::Unlock(const SecureString& strWalletPassphrase) |
| 412 | { |
| 413 | CCrypter crypter; |
| 414 | CKeyingMaterial _vMasterKey; |
| 415 | |
| 416 | { |
| 417 | LOCK(cs_wallet); |
| 418 | for (const MasterKeyMap::value_type& pMasterKey : mapMasterKeys) |
| 419 | { |
| 420 | if(!crypter.SetKeyFromPassphrase(strWalletPassphrase, pMasterKey.second.vchSalt, pMasterKey.second.nDeriveIterations, pMasterKey.second.nDerivationMethod)) |
| 421 | return false; |
| 422 | if (!crypter.Decrypt(pMasterKey.second.vchCryptedKey, _vMasterKey)) |
| 423 | continue; // try another master key |
| 424 | if (CCryptoKeyStore::Unlock(_vMasterKey)) |
| 425 | return true; |
| 426 | } |
| 427 | } |
| 428 | return false; |
| 429 | } |
| 430 | |
| 431 | bool CWallet::ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase) |
| 432 | { |
no test coverage detected