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

Method AddKeyCombi

src/wallet/crypter.cpp:179–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179bool CCryptoKeyStore::AddKeyCombi(const CKeyID& keyId, const CKeyCombi& keyCombi) {
180 {
181 LOCK(cs_KeyStore);
182
183 if (!IsEncrypted())
184 return CBasicKeyStore::AddKeyCombi(keyId, keyCombi);
185
186 if (IsLocked())
187 return false;
188
189 CKey mainKey;
190 keyCombi.GetCKey(mainKey, false);
191 CKeyCombi newkeyCombi = keyCombi;
192 newkeyCombi.PurgeMainKey();
193 CBasicKeyStore::AddKeyCombi(keyId, keyCombi);
194
195 vector<unsigned char> vchCryptedSecret;
196 CKeyingMaterial vchSecret(mainKey.begin(), mainKey.end());
197 CPubKey pubKey;
198 pubKey = mainKey.GetPubKey();
199 if (!EncryptSecret(vMasterKey, vchSecret, pubKey.GetHash(), vchCryptedSecret))
200 return false;
201
202 if (!AddCryptedKey(pubKey, vchCryptedSecret))
203 return false;
204 }
205 return true;
206}
207
208bool CCryptoKeyStore::AddCryptedKey(const CPubKey& vchPubKey, const vector<unsigned char>& vchCryptedSecret) {
209 {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected