aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/account.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-08-17 14:08:59 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-08-17 14:08:59 -0500
commit765db1ae7a3337d085584ab31983fe6b7599dbcb (patch)
tree8ee2064e832103be0890657f15973a15e3619edb /tests/unit_tests/account.cpp
parentMerge pull request #6736 (diff)
downloadmonero-765db1ae7a3337d085584ab31983fe6b7599dbcb.tar.xz
Revert "Use domain-separated ChaCha20 for in-memory key encryption"
This reverts commit 921dd8dde5d381052d0aa2936304a3541a230c55.
Diffstat (limited to '')
-rw-r--r--tests/unit_tests/account.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/tests/unit_tests/account.cpp b/tests/unit_tests/account.cpp
index 68bf4dce7..2ab2f893a 100644
--- a/tests/unit_tests/account.cpp
+++ b/tests/unit_tests/account.cpp
@@ -29,30 +29,14 @@
#include "gtest/gtest.h"
#include "cryptonote_basic/account.h"
-#include "ringct/rctOps.h"
-// Tests in-memory encryption of account secret keys
TEST(account, encrypt_keys)
{
- // Generate account keys and random multisig keys
cryptonote::keypair recovery_key = cryptonote::keypair::generate(hw::get_device("default"));
cryptonote::account_base account;
crypto::secret_key key = account.generate(recovery_key.sec);
-
- const size_t n_multisig = 4;
- std::vector<crypto::secret_key> multisig_keys;
- multisig_keys.reserve(n_multisig);
- multisig_keys.resize(0);
- for (size_t i = 0; i < n_multisig; ++i)
- {
- multisig_keys.push_back(rct::rct2sk(rct::skGen()));
- }
- ASSERT_TRUE(account.make_multisig(account.get_keys().m_view_secret_key, account.get_keys().m_spend_secret_key, account.get_keys().m_account_address.m_spend_public_key, multisig_keys));
-
const cryptonote::account_keys keys = account.get_keys();
- ASSERT_EQ(keys.m_multisig_keys.size(),n_multisig);
- // Encrypt and decrypt keys
ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
ASSERT_EQ(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
@@ -66,40 +50,22 @@ TEST(account, encrypt_keys)
ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
ASSERT_NE(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
- ASSERT_NE(account.get_keys().m_multisig_keys, keys.m_multisig_keys);
account.decrypt_viewkey(chacha_key);
ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
- ASSERT_NE(account.get_keys().m_multisig_keys, keys.m_multisig_keys);
account.encrypt_viewkey(chacha_key);
ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
ASSERT_NE(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
- ASSERT_NE(account.get_keys().m_multisig_keys, keys.m_multisig_keys);
-
- account.decrypt_viewkey(chacha_key);
-
- ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
- ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
- ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
- ASSERT_NE(account.get_keys().m_multisig_keys, keys.m_multisig_keys);
-
- account.encrypt_viewkey(chacha_key);
-
- ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
- ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
- ASSERT_NE(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
- ASSERT_NE(account.get_keys().m_multisig_keys, keys.m_multisig_keys);
account.decrypt_keys(chacha_key);
ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address);
ASSERT_EQ(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key);
ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key);
- ASSERT_EQ(account.get_keys().m_multisig_keys, keys.m_multisig_keys);
}