From 743608ec16e27a3c1ca2febd4e80391a32c23efd Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 20 May 2020 21:43:09 +0000 Subject: wallet: allow signing a message with spend or view key --- src/device/device.hpp | 1 + src/device/device_default.cpp | 6 ++++++ src/device/device_default.hpp | 1 + src/device/device_ledger.cpp | 6 ++++++ src/device/device_ledger.hpp | 1 + 5 files changed, 15 insertions(+) (limited to 'src/device') diff --git a/src/device/device.hpp b/src/device/device.hpp index 582eb2242..a6694ad09 100644 --- a/src/device/device.hpp +++ b/src/device/device.hpp @@ -162,6 +162,7 @@ namespace hw { virtual std::vector get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end) = 0; virtual cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) = 0; virtual crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) = 0; + virtual crypto::secret_key get_subaddress_view_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) = 0; /* ======================================================================= */ /* DERIVATION & KEY */ diff --git a/src/device/device_default.cpp b/src/device/device_default.cpp index 145197212..cb63deb15 100644 --- a/src/device/device_default.cpp +++ b/src/device/device_default.cpp @@ -207,6 +207,12 @@ namespace hw { return m; } + crypto::secret_key device_default::get_subaddress_view_secret_key(const crypto::secret_key &a, const cryptonote::subaddress_index &index) { + crypto::secret_key skey = get_subaddress_secret_key(a, index); + sc_mul((unsigned char*)skey.data, (const unsigned char*)skey.data, (const unsigned char*)a.data); + return skey; + } + /* ======================================================================= */ /* DERIVATION & KEY */ /* ======================================================================= */ diff --git a/src/device/device_default.hpp b/src/device/device_default.hpp index 2493bd67d..e49a75b1c 100644 --- a/src/device/device_default.hpp +++ b/src/device/device_default.hpp @@ -85,6 +85,7 @@ namespace hw { std::vector get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end) override; cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) override; crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) override; + crypto::secret_key get_subaddress_view_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) override; /* ======================================================================= */ /* DERIVATION & KEY */ diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index 4e89f835d..ec5c52e58 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -880,6 +880,12 @@ namespace hw { return sub_sec; } + crypto::secret_key device_ledger::get_subaddress_view_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) { +#warning TODO + MERROR("Not implemented yet"); + return crypto::null_skey; + } + /* ======================================================================= */ /* DERIVATION & KEY */ /* ======================================================================= */ diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp index d3ec08288..f82339f7a 100644 --- a/src/device/device_ledger.hpp +++ b/src/device/device_ledger.hpp @@ -249,6 +249,7 @@ namespace hw { std::vector get_subaddress_spend_public_keys(const cryptonote::account_keys &keys, uint32_t account, uint32_t begin, uint32_t end) override; cryptonote::account_public_address get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) override; crypto::secret_key get_subaddress_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) override; + crypto::secret_key get_subaddress_view_secret_key(const crypto::secret_key &sec, const cryptonote::subaddress_index &index) override; /* ======================================================================= */ /* DERIVATION & KEY */ -- cgit v1.2.3