Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

Keystore which keeps the private keys encrypted. More...

#include <crypter.h>

+ Inheritance diagram for CCryptoKeyStore:
+ Collaboration diagram for CCryptoKeyStore:

Public Member Functions

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

Public Attributes

boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
 Wallet status (encrypted, locked) changed. More...
 

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)
 

Protected Attributes

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

Private Attributes

CHDChain cryptedHDChain
 
CKeyingMaterial vMasterKey
 
std::atomic< bool > fUseCrypto
 if fUseCrypto is true, mapKeys must be empty if fUseCrypto is false, vMasterKey must be empty More...
 
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...
 

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 119 of file crypter.h.

Constructor & Destructor Documentation

◆ CCryptoKeyStore()

CCryptoKeyStore::CCryptoKeyStore ( )
inline

Definition at line 151 of file crypter.h.

Member Function Documentation

◆ AddCryptedKey()

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

◆ AddKeyPubKey()

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

◆ DecryptHDChain()

◆ EncryptHDChain()

◆ EncryptKeys()

bool CCryptoKeyStore::EncryptKeys ( CKeyingMaterial vMasterKeyIn)
protected

◆ GetHDChain()

◆ GetKey()

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

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 343 of file crypter.cpp.

References CKeyStore::cs_KeyStore, DecryptKey(), CBasicKeyStore::GetKey(), IsCrypted(), LOCK, mapCryptedKeys, and vMasterKey.

Referenced by CWallet::GetKey().

◆ GetKeys()

std::set< CKeyID > CCryptoKeyStore::GetKeys ( ) const
overridevirtual

Reimplemented from CBasicKeyStore.

Definition at line 376 of file crypter.cpp.

References CKeyStore::cs_KeyStore, CBasicKeyStore::GetKeys(), IsCrypted(), LOCK, and mapCryptedKeys.

Referenced by CWallet::GetKeyBirthTimes().

◆ GetPubKey()

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

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 360 of file crypter.cpp.

References CKeyStore::cs_KeyStore, CBasicKeyStore::GetPubKey(), IsCrypted(), LOCK, and mapCryptedKeys.

Referenced by CWallet::GetPubKey().

◆ HaveKey()

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

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

Reimplemented from CBasicKeyStore.

Reimplemented in CWallet.

Definition at line 334 of file crypter.cpp.

References CKeyStore::cs_KeyStore, CBasicKeyStore::HaveKey(), IsCrypted(), LOCK, and mapCryptedKeys.

Referenced by CWallet::HaveKey().

◆ IsCrypted()

◆ IsLocked()

◆ Lock()

◆ SetCrypted()

bool CCryptoKeyStore::SetCrypted ( )
protected

◆ SetCryptedHDChain()

bool CCryptoKeyStore::SetCryptedHDChain ( const CHDChain chain)
protected

Definition at line 527 of file crypter.cpp.

References cryptedHDChain, CHDChain::IsCrypted(), and SetCrypted().

Referenced by CWallet::SetCryptedHDChain().

◆ SetHDChain()

bool CCryptoKeyStore::SetHDChain ( const CHDChain chain)
protected

Definition at line 515 of file crypter.cpp.

References CBasicKeyStore::hdChain, CHDChain::IsCrypted(), and IsCrypted().

Referenced by CWallet::SetHDChain().

◆ Unlock()

Member Data Documentation

◆ cryptedHDChain

CHDChain CCryptoKeyStore::cryptedHDChain
private

Definition at line 122 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 131 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 134 of file crypter.h.

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

◆ fUseCrypto

std::atomic<bool> CCryptoKeyStore::fUseCrypto
private

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

Definition at line 128 of file crypter.h.

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

◆ mapCryptedKeys

CryptedKeyMap CCryptoKeyStore::mapCryptedKeys
protected

◆ NotifyStatusChanged

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

Wallet status (encrypted, locked) changed.

Note: Called without locks held.

Definition at line 172 of file crypter.h.

Referenced by CWallet::EncryptWallet(), Lock(), WalletModel::subscribeToCoreSignals(), Unlock(), and WalletModel::unsubscribeFromCoreSignals().

◆ vMasterKey

CKeyingMaterial CCryptoKeyStore::vMasterKey
private

Definition at line 124 of file crypter.h.

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


The documentation for this class was generated from the following files:
Released under the MIT license