mirror of
https://github.com/monero-project/monero.git
synced 2025-08-23 11:35:10 -04:00
Change epee binary output from std::stringstream to byte_stream
This commit is contained in:
parent
b7425c14c8
commit
7414e2bac1
23 changed files with 126 additions and 106 deletions
|
@ -3788,7 +3788,7 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const epee::wipeable_string& password, bool watch_only)
|
||||
{
|
||||
std::string account_data;
|
||||
epee::byte_slice account_data;
|
||||
std::string multisig_signers;
|
||||
std::string multisig_derivations;
|
||||
cryptonote::account_base account = m_account;
|
||||
|
@ -3815,7 +3815,7 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const epee:
|
|||
rapidjson::Document json;
|
||||
json.SetObject();
|
||||
rapidjson::Value value(rapidjson::kStringType);
|
||||
value.SetString(account_data.c_str(), account_data.length());
|
||||
value.SetString(reinterpret_cast<const char*>(account_data.data()), account_data.size());
|
||||
json.AddMember("key_data", value, json.GetAllocator());
|
||||
if (!seed_language.empty())
|
||||
{
|
||||
|
@ -3989,13 +3989,12 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const epee:
|
|||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||
json.Accept(writer);
|
||||
account_data = buffer.GetString();
|
||||
|
||||
// Encrypt the entire JSON object.
|
||||
std::string cipher;
|
||||
cipher.resize(account_data.size());
|
||||
cipher.resize(buffer.GetSize());
|
||||
keys_file_data.get().iv = crypto::rand<crypto::chacha_iv>();
|
||||
crypto::chacha20(account_data.data(), account_data.size(), key, keys_file_data.get().iv, &cipher[0]);
|
||||
crypto::chacha20(buffer.GetString(), buffer.GetSize(), key, keys_file_data.get().iv, &cipher[0]);
|
||||
keys_file_data.get().account_data = cipher;
|
||||
return keys_file_data;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue