| 259 | } |
| 260 | |
| 261 | bool CCryptoKeyStore::GetKey(const CKeyID &address, CKey& keyOut) const |
| 262 | { |
| 263 | LOCK(cs_KeyStore); |
| 264 | if (!IsCrypted()) { |
| 265 | return CBasicKeyStore::GetKey(address, keyOut); |
| 266 | } |
| 267 | |
| 268 | CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address); |
| 269 | if (mi != mapCryptedKeys.end()) |
| 270 | { |
| 271 | const CPubKey &vchPubKey = (*mi).second.first; |
| 272 | const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second; |
| 273 | return DecryptKey(vMasterKey, vchCryptedSecret, vchPubKey, keyOut); |
| 274 | } |
| 275 | return false; |
| 276 | } |
| 277 | |
| 278 | bool CCryptoKeyStore::GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const |
| 279 | { |
no test coverage detected