23 if(!count || !
key || !iv)
29 di.
Write((
const unsigned char*)strKeyData.c_str(), strKeyData.size());
31 di.
Write(&chSalt[0], chSalt.size());
34 for(
int i = 0; i != count - 1; i++)
49 if (nDerivationMethod == 0)
81 vchCiphertext.resize(vchPlaintext.size() + AES_BLOCKSIZE);
84 size_t nLen = enc.
Encrypt(&vchPlaintext[0], vchPlaintext.size(), &vchCiphertext[0]);
85 if(nLen < vchPlaintext.size())
87 vchCiphertext.resize(nLen);
97 int nLen = vchCiphertext.size();
98 vchPlaintext.resize(nLen);
100 nLen = dec.
Decrypt(&vchCiphertext[0], vchCiphertext.size(), &vchPlaintext[0]);
103 vchPlaintext.resize(nLen);
112 if (!cKeyCrypter.
SetKey(vMasterKey, chIV))
122 if (!cKeyCrypter.
SetKey(vMasterKey, chIV))
148 std::vector<unsigned char> vchCryptedSecret;
181 const CPubKey& vchPubKey = (*mi).second.first;
182 const std::vector<unsigned char>& vchCryptedSecret = (*mi).second.second;
186 if (vchSecret.size() != 32)
188 keyOut.
Set(vchSecret.begin(), vchSecret.end(), vchPubKey.
IsCompressed());
204 vchPubKeyOut = (*mi).second.first;
219 for (KeyMap::value_type& mKey :
mapKeys) {
223 std::vector<unsigned char> vchCryptedSecret;
250 std::vector<unsigned char> vchCryptedSeed;
258 SecureVector vchSecureCryptedSeed(vchCryptedSeed.begin(), vchCryptedSeed.end());
267 std::vector<unsigned char> vchCryptedMnemonic;
268 std::vector<unsigned char> vchCryptedMnemonicPassphrase;
272 if (!vchMnemonicPassphrase.empty() && !
EncryptSecret(vMasterKeyIn, vchMnemonicPassphrase,
hdChain.
GetID(), vchCryptedMnemonicPassphrase))
275 SecureVector vchSecureCryptedMnemonic(vchCryptedMnemonic.begin(), vchCryptedMnemonic.end());
276 SecureVector vchSecureCryptedMnemonicPassphrase(vchCryptedMnemonicPassphrase.begin(), vchCryptedMnemonicPassphrase.end());
297 std::vector<unsigned char> vchCryptedSeed(vchSecureCryptedSeed.begin(), vchSecureCryptedSeed.end());
302 if (!hdChainRet.
SetSeed(vchSecureSeed,
false))
317 std::vector<unsigned char> vchCryptedMnemonic(vchSecureCryptedMnemonic.begin(), vchSecureCryptedMnemonic.end());
318 std::vector<unsigned char> vchCryptedMnemonicPassphrase(vchSecureCryptedMnemonicPassphrase.begin(), vchSecureCryptedMnemonicPassphrase.end());
324 if (!hdChainRet.
SetMnemonic(vchSecureMnemonic, vchSecureMnemonicPassphrase,
false))