Dash Core  0.12.2.1
P2P Digital Currency
CCryptoKeyStore Class Reference

#include <crypter.h>

+ Inheritance diagram for CCryptoKeyStore:

Public Member Functions

 CCryptoKeyStore ()
 
bool IsCrypted () const
 
bool IsLocked (bool fForMixing=false) const
 
bool Lock (bool fAllowMixing=false)
 
virtual bool AddCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
 
bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey)
 Add a key to the store. More...
 
bool HaveKey (const CKeyID &address) const
 Check whether a key corresponding to a given address is present in the store. More...
 
bool GetKey (const CKeyID &address, CKey &keyOut) const
 
bool GetPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
void GetKeys (std::set< CKeyID > &setAddress) const
 
bool GetHDChain (CHDChain &hdChainRet) const
 
- Public Member Functions inherited from CBasicKeyStore
virtual bool AddCScript (const CScript &redeemScript)
 Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki. More...
 
virtual bool HaveCScript (const CScriptID &hash) const
 
virtual bool GetCScript (const CScriptID &hash, CScript &redeemScriptOut) const
 
virtual bool AddWatchOnly (const CScript &dest)
 Support for Watch-only addresses. More...
 
virtual bool RemoveWatchOnly (const CScript &dest)
 
virtual bool HaveWatchOnly (const CScript &dest) const
 
virtual bool HaveWatchOnly () const
 
bool GetHDChain (CHDChain &hdChainRet) const
 
- Public Member Functions inherited from CKeyStore
virtual ~CKeyStore ()
 
virtual bool AddKey (const CKey &key)
 

Public Attributes

boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
 

Protected Member Functions

bool SetCrypted ()
 
bool EncryptKeys (CKeyingMaterial &vMasterKeyIn)
 will encrypt previously unencrypted keys More...
 
bool EncryptHDChain (const CKeyingMaterial &vMasterKeyIn)
 
bool DecryptHDChain (CHDChain &hdChainRet) const
 
bool SetHDChain (const CHDChain &chain)
 
bool SetCryptedHDChain (const CHDChain &chain)
 
bool Unlock (const CKeyingMaterial &vMasterKeyIn, bool fForMixingOnly=false)
 

Private Attributes

CryptedKeyMap mapCryptedKeys
 
CHDChain cryptedHDChain
 
CKeyingMaterial vMasterKey
 
bool fUseCrypto
 
bool fDecryptionThoroughlyChecked
 keeps track of whether Unlock has run a thorough check before More...
 
bool fOnlyMixingAllowed
 if fOnlyMixingAllowed is true, only mixing should be allowed in unlocked wallet More...
 

Additional Inherited Members

- Protected Attributes inherited from CBasicKeyStore
KeyMap mapKeys
 
WatchKeyMap mapWatchKeys
 
ScriptMap mapScripts
 
WatchOnlySet setWatchOnly
 
CHDChain hdChain
 
- Protected Attributes inherited from CKeyStore
CCriticalSection cs_KeyStore
 

Detailed Description

Keystore which keeps the private keys encrypted. It derives from the basic key store, which is used if no encryption is active.

Definition at line 117 of file crypter.h.

Constructor & Destructor Documentation

◆ CCryptoKeyStore()

CCryptoKeyStore::CCryptoKeyStore ( )
inline

Definition at line 149 of file crypter.h.

Member Function Documentation

◆ AddCryptedKey()

bool CCryptoKeyStore::AddCryptedKey ( const CPubKey vchPubKey,
const std::vector< unsigned char > &  vchCryptedSecret 
)
virtual

Reimplemented in CWallet.

Definition at line 324 of file crypter.cpp.

Referenced by CWallet::AddCryptedKey(), AddKeyPubKey(), EncryptKeys(), and CWallet::LoadCryptedKey().

◆ AddKeyPubKey()

bool CCryptoKeyStore::AddKeyPubKey ( const CKey key,
const CPubKey pubkey 
)
virtual

Add a key to the store.

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 302 of file crypter.cpp.

Referenced by CWallet::AddKeyPubKey(), and CWallet::LoadKey().

◆ DecryptHDChain()

bool CCryptoKeyStore::DecryptHDChain ( CHDChain hdChainRet) const
protected

Definition at line 450 of file crypter.cpp.

Referenced by Unlock().

◆ EncryptHDChain()

bool CCryptoKeyStore::EncryptHDChain ( const CKeyingMaterial vMasterKeyIn)
protected

Definition at line 397 of file crypter.cpp.

◆ EncryptKeys()

bool CCryptoKeyStore::EncryptKeys ( CKeyingMaterial vMasterKeyIn)
protected

will encrypt previously unencrypted keys

Definition at line 373 of file crypter.cpp.

◆ GetHDChain()

bool CCryptoKeyStore::GetHDChain ( CHDChain hdChainRet) const

Definition at line 525 of file crypter.cpp.

Referenced by dumphdinfo(), dumpwallet(), getwalletinfo(), and validateaddress().

◆ GetKey()

bool CCryptoKeyStore::GetKey ( const CKeyID address,
CKey keyOut 
) const
virtual

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 336 of file crypter.cpp.

Referenced by CWallet::GetKey().

◆ GetKeys()

void CCryptoKeyStore::GetKeys ( std::set< CKeyID > &  setAddress) const
inlinevirtual

Reimplemented from CBasicKeyStore.

Definition at line 203 of file crypter.h.

◆ GetPubKey()

bool CCryptoKeyStore::GetPubKey ( const CKeyID address,
CPubKey vchPubKeyOut 
) const
virtual

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 354 of file crypter.cpp.

Referenced by CWallet::GetPubKey().

◆ HaveKey()

bool CCryptoKeyStore::HaveKey ( const CKeyID address) const
inlinevirtual

Check whether a key corresponding to a given address is present in the store.

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 191 of file crypter.h.

Referenced by CWallet::HaveKey().

◆ IsCrypted()

◆ IsLocked()

◆ Lock()

bool CCryptoKeyStore::Lock ( bool  fAllowMixing = false)

Definition at line 233 of file crypter.cpp.

Referenced by LockWallet(), MasternodeList::StartAll(), and walletlock().

◆ SetCrypted()

bool CCryptoKeyStore::SetCrypted ( )
protected

Definition at line 222 of file crypter.cpp.

Referenced by AddCryptedKey(), Lock(), SetCryptedHDChain(), and Unlock().

◆ SetCryptedHDChain()

bool CCryptoKeyStore::SetCryptedHDChain ( const CHDChain chain)
protected

Definition at line 513 of file crypter.cpp.

Referenced by CWallet::SetCryptedHDChain().

◆ SetHDChain()

bool CCryptoKeyStore::SetHDChain ( const CHDChain chain)
protected

Definition at line 501 of file crypter.cpp.

Referenced by CWallet::SetHDChain().

◆ Unlock()

bool CCryptoKeyStore::Unlock ( const CKeyingMaterial vMasterKeyIn,
bool  fForMixingOnly = false 
)
protected

Definition at line 248 of file crypter.cpp.

Referenced by CWallet::ChangeWalletPassphrase(), and CWallet::Unlock().

Member Data Documentation

◆ cryptedHDChain

CHDChain CCryptoKeyStore::cryptedHDChain
private

Definition at line 121 of file crypter.h.

Referenced by DecryptHDChain(), EncryptHDChain(), GetHDChain(), SetCryptedHDChain(), and Unlock().

◆ fDecryptionThoroughlyChecked

bool CCryptoKeyStore::fDecryptionThoroughlyChecked
private

keeps track of whether Unlock has run a thorough check before

Definition at line 130 of file crypter.h.

Referenced by Unlock().

◆ fOnlyMixingAllowed

bool CCryptoKeyStore::fOnlyMixingAllowed
private

if fOnlyMixingAllowed is true, only mixing should be allowed in unlocked wallet

Definition at line 133 of file crypter.h.

Referenced by IsLocked(), Lock(), and Unlock().

◆ fUseCrypto

bool CCryptoKeyStore::fUseCrypto
private

if fUseCrypto is true, mapKeys must be empty if fUseCrypto is false, vMasterKey must be empty

Definition at line 127 of file crypter.h.

Referenced by EncryptKeys(), IsCrypted(), and SetCrypted().

◆ mapCryptedKeys

CryptedKeyMap CCryptoKeyStore::mapCryptedKeys
private

Definition at line 120 of file crypter.h.

Referenced by AddCryptedKey(), EncryptKeys(), GetKey(), GetKeys(), GetPubKey(), HaveKey(), and Unlock().

◆ NotifyStatusChanged

boost::signals2::signal<void (CCryptoKeyStore* wallet)> CCryptoKeyStore::NotifyStatusChanged

Wallet status (encrypted, locked) changed. Note: Called without locks held.

Definition at line 225 of file crypter.h.

Referenced by Lock(), and Unlock().

◆ vMasterKey

CKeyingMaterial CCryptoKeyStore::vMasterKey
private

Definition at line 123 of file crypter.h.

Referenced by AddKeyPubKey(), DecryptHDChain(), GetKey(), IsLocked(), Lock(), and Unlock().


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