| 318 | } |
| 319 | |
| 320 | bool CCryptoKeyStore::GetKey(const CKeyID& address, CKey& keyOut) const |
| 321 | { |
| 322 | LOCK(cs_KeyStore); |
| 323 | if (!IsCrypted()) |
| 324 | return CBasicKeyStore::GetKey(address, keyOut); |
| 325 | |
| 326 | CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address); |
| 327 | if (mi != mapCryptedKeys.end()) { |
| 328 | const CPubKey& vchPubKey = (*mi).second.first; |
| 329 | const std::vector<unsigned char>& vchCryptedSecret = (*mi).second.second; |
| 330 | CKeyingMaterial vchSecret; |
| 331 | if (!DecryptSecret(vMasterKey, vchCryptedSecret, vchPubKey.GetHash(), vchSecret)) |
| 332 | return false; |
| 333 | if (vchSecret.size() != 32) |
| 334 | return false; |
| 335 | keyOut.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.IsCompressed()); |
| 336 | return true; |
| 337 | } |
| 338 | return false; |
| 339 | } |
| 340 | |
| 341 | bool CCryptoKeyStore::GetPubKey(const CKeyID& address, CPubKey& vchPubKeyOut) const |
| 342 | { |
nothing calls this directly
no test coverage detected