Electroneum
cryptonote::account_keys Struct Reference

#include <account.h>

Collaboration diagram for cryptonote::account_keys:

Public Member Functions

account_keysoperator= (account_keys const &)=default
 
void encrypt (const crypto::chacha_key &key)
 
void decrypt (const crypto::chacha_key &key)
 
void encrypt_viewkey (const crypto::chacha_key &key)
 
void decrypt_viewkey (const crypto::chacha_key &key)
 
hw::deviceget_device () const
 
void set_device (hw::device &hwdev)
 

Public Attributes

account_public_address m_account_address
 
crypto::secret_key m_spend_secret_key
 
crypto::secret_key m_view_secret_key
 
std::vector< crypto::secret_keym_multisig_keys
 
hw::devicem_device = &hw::get_device("default")
 
crypto::chacha_iv m_encryption_iv
 
const crypto::chacha_iv default_iv {{0, 0, 0, 0, 0, 0, 0, 0}}
 

Detailed Description

Definition at line 41 of file account.h.

Member Function Documentation

◆ decrypt()

void cryptonote::account_keys::decrypt ( const crypto::chacha_key &  key)

Definition at line 112 of file account.cpp.

113  {
114  xor_with_key_stream(key);
115  }
const char * key
Definition: hmac_keccak.cpp:39

◆ decrypt_viewkey()

void cryptonote::account_keys::decrypt_viewkey ( const crypto::chacha_key &  key)

Definition at line 127 of file account.cpp.

128  {
130  }
void encrypt_viewkey(const crypto::chacha_key &key)
Definition: account.cpp:117
const char * key
Definition: hmac_keccak.cpp:39

◆ encrypt()

void cryptonote::account_keys::encrypt ( const crypto::chacha_key &  key)

Definition at line 106 of file account.cpp.

107  {
108  m_encryption_iv = crypto::rand<crypto::chacha_iv>();
109  xor_with_key_stream(key);
110  }
const char * key
Definition: hmac_keccak.cpp:39
crypto::chacha_iv m_encryption_iv
Definition: account.h:48

◆ encrypt_viewkey()

void cryptonote::account_keys::encrypt_viewkey ( const crypto::chacha_key &  key)

Definition at line 117 of file account.cpp.

118  {
119  // encrypt a large enough byte stream with chacha20
120  epee::wipeable_string key_stream = get_key_stream(key, m_encryption_iv, sizeof(crypto::secret_key) * 2);
121  const char *ptr = key_stream.data();
122  ptr += sizeof(crypto::secret_key);
123  for (size_t i = 0; i < sizeof(crypto::secret_key); ++i)
124  m_view_secret_key.data[i] ^= *ptr++;
125  }
const char * key
Definition: hmac_keccak.cpp:39
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition: crypto.h:82
crypto::chacha_iv m_encryption_iv
Definition: account.h:48
crypto::secret_key m_view_secret_key
Definition: account.h:45
const char * data() const noexcept

◆ get_device()

hw::device & cryptonote::account_keys::get_device ( ) const

Definition at line 59 of file account.cpp.

59  {
60  return *m_device;
61  }
hw::device * m_device
Definition: account.h:47
Here is the caller graph for this function:

◆ operator=()

account_keys& cryptonote::account_keys::operator= ( account_keys const &  )
default

◆ set_device()

void cryptonote::account_keys::set_device ( hw::device hwdev)

Definition at line 63 of file account.cpp.

63  {
64  m_device = &hwdev;
65  MCDEBUG("device", "account_keys::set_device device type: "<<typeid(hwdev).name());
66  }
const char * name
hw::device * m_device
Definition: account.h:47
#define MCDEBUG(cat, x)
Definition: misc_log_ex.h:54

Member Data Documentation

◆ default_iv

const crypto::chacha_iv cryptonote::account_keys::default_iv {{0, 0, 0, 0, 0, 0, 0, 0}}

Definition at line 55 of file account.h.

◆ m_account_address

account_public_address cryptonote::account_keys::m_account_address

Definition at line 43 of file account.h.

◆ m_device

hw::device* cryptonote::account_keys::m_device = &hw::get_device("default")

Definition at line 47 of file account.h.

◆ m_encryption_iv

crypto::chacha_iv cryptonote::account_keys::m_encryption_iv

Definition at line 48 of file account.h.

◆ m_multisig_keys

std::vector<crypto::secret_key> cryptonote::account_keys::m_multisig_keys

Definition at line 46 of file account.h.

◆ m_spend_secret_key

crypto::secret_key cryptonote::account_keys::m_spend_secret_key

Definition at line 44 of file account.h.

◆ m_view_secret_key

crypto::secret_key cryptonote::account_keys::m_view_secret_key

Definition at line 45 of file account.h.


The documentation for this struct was generated from the following files: