MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / AddKeyPubKey

Method AddKeyPubKey

src/wallet/crypter.cpp:216–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216bool 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
240bool CCryptoKeyStore::AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret)

Callers

nothing calls this directly

Calls 4

EncryptSecretFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected