diff options
| author | Gavin Andresen <[email protected]> | 2011-12-19 07:27:25 -0800 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-12-19 07:27:25 -0800 |
| commit | 99a289f531e9dc42aa81ea32ff84b807a46b6a9c (patch) | |
| tree | a4d7f89dbfdb11aef1fe4b6644a1ba127d0e97f5 /src/keystore.cpp | |
| parent | Merge pull request #699 from laanwj/about_qt (diff) | |
| parent | Key import and export (diff) | |
| download | discoin-99a289f531e9dc42aa81ea32ff84b807a46b6a9c.tar.xz discoin-99a289f531e9dc42aa81ea32ff84b807a46b6a9c.zip | |
Merge pull request #574 from sipa/dumpprivkey
Dumpprivkey
Diffstat (limited to 'src/keystore.cpp')
| -rw-r--r-- | src/keystore.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/keystore.cpp b/src/keystore.cpp index 68f57e7e0..6cf557faf 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -29,7 +29,7 @@ bool CKeyStore::GetPubKey(const CBitcoinAddress &address, std::vector<unsigned c bool CBasicKeyStore::AddKey(const CKey& key) { CRITICAL_BLOCK(cs_KeyStore) - mapKeys[key.GetAddress()] = key.GetSecret(); + mapKeys[CBitcoinAddress(key.GetPubKey())] = key.GetSecret(); return true; } @@ -116,23 +116,19 @@ bool CCryptoKeyStore::AddCryptedKey(const std::vector<unsigned char> &vchPubKey, return true; } -bool CCryptoKeyStore::GetKey(const CBitcoinAddress &address, CKey& keyOut) const +bool CCryptoKeyStore::GetSecret(const CBitcoinAddress &address, CSecret& vchSecretOut) const { CRITICAL_BLOCK(cs_KeyStore) { if (!IsCrypted()) - return CBasicKeyStore::GetKey(address, keyOut); + return CBasicKeyStore::GetSecret(address, vchSecretOut); CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address); if (mi != mapCryptedKeys.end()) { const std::vector<unsigned char> &vchPubKey = (*mi).second.first; const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second; - CSecret vchSecret; - if (!DecryptSecret(vMasterKey, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecret)) - return false; - keyOut.SetSecret(vchSecret); - return true; + return DecryptSecret(vMasterKey, vchCryptedSecret, Hash(vchPubKey.begin(), vchPubKey.end()), vchSecretOut); } } return false; |