aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-12-10 17:34:50 -0800
committerAlexander Blair <snipa@jagtech.io>2020-12-10 17:34:50 -0800
commit1e9483a2d585d4ce4c2bf001862132ca46185c16 (patch)
treeb9a58d5cd7de6b8ed5da9df1c869449f0623611b /src/wallet/wallet2.cpp
parent6bddd54f9d1195c4dcef04e096474c2ff7066f1d (diff)
parent7414e2bac11cbf9163ca16dc1b1510b4fd9a0d64 (diff)
downloadmonzero-core-1e9483a2d585d4ce4c2bf001862132ca46185c16.tar.gz
monzero-core-1e9483a2d585d4ce4c2bf001862132ca46185c16.tar.xz
monzero-core-1e9483a2d585d4ce4c2bf001862132ca46185c16.zip
Merge pull request #7009
7414e2bac Change epee binary output from std::stringstream to byte_stream (Lee Clagett)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-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;
}