aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2020-10-13 15:15:07 +0000
committerLee Clagett <code@leeclagett.com>2020-10-10 15:28:40 +0000
commit7414e2bac11cbf9163ca16dc1b1510b4fd9a0d64 (patch)
tree1cd7aa7394630a8be218534112ba88a5b618d96a /src/wallet
parentMerge pull request #7072 (diff)
downloadmonero-7414e2bac11cbf9163ca16dc1b1510b4fd9a0d64.tar.xz
Change epee binary output from std::stringstream to byte_stream
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 920e0413c..91b3c0535 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -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;
}