| 214 | } |
| 215 | |
| 216 | bool CCryptoKeyStore::AddKeyPubKey(const CKey& key, const CPubKey &pubkey) |
| 217 | { |
| 218 | LOCK(cs_KeyStore); |
| 219 | if (!IsCrypted()) { |
| 220 | return CBasicKeyStore::AddKeyPubKey(key, pubkey); |
| 221 | } |
| 222 | |
| 223 | if (IsLocked()) { |
| 224 | return false; |
| 225 | } |
| 226 | |
| 227 | std::vector<unsigned char> vchCryptedSecret; |
| 228 | CKeyingMaterial vchSecret(key.begin(), key.end()); |
| 229 | if (!EncryptSecret(vMasterKey, vchSecret, pubkey.GetHash(), vchCryptedSecret)) { |
| 230 | return false; |
| 231 | } |
| 232 | |
| 233 | if (!AddCryptedKey(pubkey, vchCryptedSecret)) { |
| 234 | return false; |
| 235 | } |
| 236 | return true; |
| 237 | } |
| 238 | |
| 239 | |
| 240 | bool CCryptoKeyStore::AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) |
nothing calls this directly
no test coverage detected