MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / GetKey

Method GetKey

src/wallet/crypter.cpp:218–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218bool CCryptoKeyStore::GetKey(const CKeyID& keyid, CKey& keyOut, bool isMiner) const {
219 LOCK(cs_KeyStore);
220
221 if (isMiner)
222 return CBasicKeyStore::GetKey(keyid, keyOut, isMiner);
223
224 if (!IsEncrypted())
225 return CBasicKeyStore::GetKey(keyid, keyOut);
226
227 CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(keyid);
228 if (mi != mapCryptedKeys.end()) {
229 const CPubKey& vchPubKey = (*mi).second.first;
230 const vector<unsigned char>& vchCryptedSecret = (*mi).second.second;
231 CKeyingMaterial vchSecret;
232 if (!DecryptSecret(vMasterKey, vchCryptedSecret, vchPubKey.GetHash(), vchSecret))
233 return false;
234 if (vchSecret.size() != 32)
235 return false;
236 keyOut.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.IsCompressed());
237 return true;
238 }
239
240 return false;
241}
242
243bool CCryptoKeyStore::GetPubKey(const CKeyID& keyid, CPubKey& vchPubKeyOut, bool isMiner) const {
244 LOCK(cs_KeyStore);

Callers 15

GetAssetTokensByPermMethod · 0.45
GetVoterListMethod · 0.45
CDbIteratorClass · 0.45
IsValidMethod · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
signmessageFunction · 0.45
getsignatureFunction · 0.45
CommonTxGeneratorFunction · 0.45
ContractTxGeneratorFunction · 0.45

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 2

BOOST_AUTO_TEST_CASEFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36