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

Method EncryptKeys

src/wallet/crypter.cpp:279–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279bool CCryptoKeyStore::EncryptKeys(CKeyingMaterial& vMasterKeyIn) {
280 LOCK(cs_KeyStore);
281
282 if (!mapCryptedKeys.empty() || IsEncrypted())
283 return false;
284
285 fUseCrypto = true;
286 for (auto& mKey : mapKeys) {
287 CKey mainKey;
288 mKey.second.GetCKey(mainKey, false);
289 CPubKey vchPubKey = mainKey.GetPubKey();
290 CKeyingMaterial vchSecret(mainKey.begin(), mainKey.end());
291 vector<unsigned char> vchCryptedSecret;
292 if (!EncryptSecret(vMasterKeyIn, vchSecret, vchPubKey.GetHash(), vchCryptedSecret))
293 return false;
294
295 if (!AddCryptedKey(vchPubKey, vchCryptedSecret))
296 return false;
297
298 mKey.second.PurgeMainKey();
299 }
300
301 return true;
302}

Callers

nothing calls this directly

Calls 8

EncryptSecretFunction · 0.85
GetCKeyMethod · 0.80
PurgeMainKeyMethod · 0.80
emptyMethod · 0.45
GetPubKeyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected