aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorJakob Lind <karl.jakob.lind@gmail.com>2014-08-02 18:14:29 +0200
committerJakob Lind <karl.jakob.lind@gmail.com>2014-08-03 16:05:15 +0200
commit6575d4ebe5a4c4a6c8eb6bff16120e08563440bb (patch)
treed588075321e3ce123bc1f82b435c7eddf431577a /src/simplewallet/simplewallet.cpp
parentremove help text about seed only displayed once (diff)
downloadmonero-6575d4ebe5a4c4a6c8eb6bff16120e08563440bb.tar.xz
check its deterministic wallet before printing seed
when running the seed command
Diffstat (limited to '')
-rw-r--r--src/simplewallet/simplewallet.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 5e636b68f..45dc49bbe 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -46,7 +46,11 @@
#include "version.h"
#include "crypto/crypto.h" // for crypto::secret_key definition
#include "crypto/electrum-words.h"
-
+extern "C"
+{
+#include "crypto/keccak.h"
+#include "crypto/crypto-ops.h"
+}
#if defined(WIN32)
#include <crtdbg.h>
#endif
@@ -193,8 +197,20 @@ bool simple_wallet::seed(const std::vector<std::string> &args/* = std::vector<st
std::string electrum_words;
crypto::ElectrumWords::bytes_to_words(m_wallet->get_account().get_keys().m_spend_secret_key, electrum_words);
- success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control.\n";
- std::cout << electrum_words << std::endl;
+ crypto::secret_key second;
+ keccak((uint8_t *)&m_wallet->get_account().get_keys().m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
+
+ sc_reduce32((uint8_t *)&second);
+
+ if (memcmp(second.data,m_wallet->get_account().get_keys().m_view_secret_key.data, sizeof(crypto::secret_key))==0)
+ {
+ success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control.\n";
+ std::cout << electrum_words << std::endl;
+ }
+ else
+ {
+ fail_msg_writer() << "The wallet is non-deterministic. Cannot display seed.";
+ }
return true;
}