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

Method Unlock

src/wallet/crypter.cpp:152–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) {
153 {
154 LOCK(cs_KeyStore);
155 if (!SetCrypted())
156 return false;
157
158 CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
159 for (; mi != mapCryptedKeys.end(); ++mi) {
160 const CPubKey& vchPubKey = (*mi).second.first;
161 const vector<unsigned char>& vchCryptedSecret = (*mi).second.second;
162 CKeyingMaterial vchSecret;
163 if (!DecryptSecret(vMasterKeyIn, vchCryptedSecret, vchPubKey.GetHash(), vchSecret))
164 return false;
165 if (vchSecret.size() != 32)
166 return false;
167 CKey key;
168 key.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.IsCompressed());
169 if (key.GetPubKey() == vchPubKey)
170 break;
171 return false;
172 }
173 vMasterKey = vMasterKeyIn;
174 }
175
176 return true;
177}
178
179bool CCryptoKeyStore::AddKeyCombi(const CKeyID& keyId, const CKeyCombi& keyCombi) {
180 {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected