MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetKey

Method GetKey

src/crypter.cpp:320–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320bool 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
341bool CCryptoKeyStore::GetPubKey(const CKeyID& address, CPubKey& vchPubKeyOut) const
342{

Callers

nothing calls this directly

Calls 8

DecryptSecretFunction · 0.85
findMethod · 0.45
endMethod · 0.45
GetHashMethod · 0.45
sizeMethod · 0.45
SetMethod · 0.45
beginMethod · 0.45
IsCompressedMethod · 0.45

Tested by

no test coverage detected