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>
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< CKeyID > | GetKeys () 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< CScriptID > | GetCScripts () 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.
Constructor & Destructor Documentation
◆ CCryptoKeyStore()
Member Function Documentation
◆ AddCryptedKey()
|
virtual |
Reimplemented in CWallet.
Definition at line 323 of file crypter.cpp.
References CKeyStore::cs_KeyStore, CPubKey::GetID(), LOCK, mapCryptedKeys, and SetCrypted().
Referenced by CWallet::AddCryptedKey(), AddKeyPubKey(), EncryptKeys(), and CWallet::LoadCryptedKey().
◆ AddKeyPubKey()
Add a key to the store.
Reimplemented from CBasicKeyStore.
Reimplemented in CWallet.
Definition at line 299 of file crypter.cpp.
References AddCryptedKey(), CBasicKeyStore::AddKeyPubKey(), CKey::begin(), CKeyStore::cs_KeyStore, EncryptSecret(), CKey::end(), CPubKey::GetHash(), IsCrypted(), IsLocked(), LOCK, and vMasterKey.
Referenced by CWallet::AddKeyPubKeyWithDB(), and CWallet::LoadKey().
◆ DecryptHDChain()
|
protected |
Definition at line 464 of file crypter.cpp.
References cryptedHDChain, CHDChain::Debug(), DecryptSecret(), CHDChain::GetID(), CHDChain::GetMnemonic(), CHDChain::GetSeed(), CHDChain::GetSeedHash(), CHDChain::IsCrypted(), IsCrypted(), CHDChain::IsNull(), CHDChain::SetCrypted(), CHDChain::SetMnemonic(), CHDChain::SetSeed(), and vMasterKey.
Referenced by CWallet::DeriveNewChildKey(), CWallet::GetDecryptedHDChain(), CWallet::GetKey(), and Unlock().
◆ EncryptHDChain()
|
protected |
Definition at line 411 of file crypter.cpp.
References cryptedHDChain, CHDChain::Debug(), EncryptSecret(), CHDChain::GetID(), CHDChain::GetMnemonic(), CHDChain::GetSeed(), CHDChain::GetSeedHash(), CBasicKeyStore::hdChain, CHDChain::IsCrypted(), IsCrypted(), CHDChain::IsNull(), CHDChain::SetCrypted(), CHDChain::SetMnemonic(), CHDChain::SetNull(), and CHDChain::SetSeed().
Referenced by CWallet::EncryptWallet().
◆ EncryptKeys()
|
protected |
will encrypt previously unencrypted keys
Definition at line 389 of file crypter.cpp.
References AddCryptedKey(), CKey::begin(), CKeyStore::cs_KeyStore, EncryptSecret(), CKey::end(), fUseCrypto, CPubKey::GetHash(), CKey::GetPubKey(), IsCrypted(), LOCK, mapCryptedKeys, and CBasicKeyStore::mapKeys.
Referenced by CWallet::EncryptWallet().
◆ GetHDChain()
|
overridevirtual |
Reimplemented from CBasicKeyStore.
Definition at line 539 of file crypter.cpp.
References cryptedHDChain, CBasicKeyStore::hdChain, IsCrypted(), and CHDChain::IsNull().
Referenced by CWallet::AddHDPubKey(), CWallet::DeriveNewChildKey(), dumphdinfo(), dumpwallet(), CWallet::EncryptWallet(), CWallet::GetDecryptedHDChain(), CWallet::GetKey(), getwalletinfo(), CWallet::IsHDEnabled(), and validateaddress().
◆ GetKey()
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()
|
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()
|
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()
|
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()
|
inline |
Definition at line 155 of file crypter.h.
References fUseCrypto.
Referenced by AddKeyPubKey(), CWallet::AddKeyPubKeyWithDB(), DecryptHDChain(), CWallet::DeriveNewChildKey(), EncryptHDChain(), EncryptKeys(), CWallet::EncryptWallet(), encryptwallet(), WalletModel::getEncryptionStatus(), GetHDChain(), GetKey(), GetKeys(), GetPubKey(), getwalletinfo(), HaveKey(), HelpRequiringPassphrase(), IsLocked(), SetHDChain(), walletlock(), walletpassphrase(), and walletpassphrasechange().
◆ IsLocked()
bool CCryptoKeyStore::IsLocked | ( | bool | fForMixing = false | ) | const |
Definition at line 209 of file crypter.cpp.
References CKeyStore::cs_KeyStore, fOnlyMixingAllowed, IsCrypted(), LOCK, and vMasterKey.
Referenced by AddKeyPubKey(), CWallet::AutoBackupWallet(), CWallet::ChangeWalletPassphrase(), EnsureWalletIsUnlocked(), WalletModel::getEncryptionStatus(), CWallet::GetKeyFromPool(), getnewaddress(), getrawchangeaddress(), WalletModel::prepareTransaction(), CWallet::ReserveKeyFromKeyPool(), CWallet::TopUpKeyPool(), CWallet::Unlock(), and walletpassphrase().
◆ Lock()
bool CCryptoKeyStore::Lock | ( | bool | fForMixing = false | ) |
Definition at line 230 of file crypter.cpp.
References CKeyStore::cs_KeyStore, fOnlyMixingAllowed, LOCK, NotifyStatusChanged, SetCrypted(), and vMasterKey.
Referenced by WalletModel::changePassphrase(), CWallet::ChangeWalletPassphrase(), CWallet::EncryptWallet(), LockWallet(), WalletModel::setWalletLocked(), and walletlock().
◆ SetCrypted()
|
protected |
Definition at line 190 of file crypter.cpp.
References CKeyStore::cs_KeyStore, fUseCrypto, LOCK, and CBasicKeyStore::mapKeys.
Referenced by AddCryptedKey(), Lock(), SetCryptedHDChain(), and Unlock().
◆ SetCryptedHDChain()
|
protected |
Definition at line 527 of file crypter.cpp.
References cryptedHDChain, CHDChain::IsCrypted(), and SetCrypted().
Referenced by CWallet::SetCryptedHDChain().
◆ SetHDChain()
|
protected |
Definition at line 515 of file crypter.cpp.
References CBasicKeyStore::hdChain, CHDChain::IsCrypted(), and IsCrypted().
Referenced by CWallet::SetHDChain().
◆ Unlock()
|
protected |
Definition at line 245 of file crypter.cpp.
References cryptedHDChain, CKeyStore::cs_KeyStore, DecryptHDChain(), DecryptKey(), fDecryptionThoroughlyChecked, fOnlyMixingAllowed, CHDChain::GetID(), CHDChain::GetSeedHash(), CHDChain::IsNull(), LOCK, LogPrintf, mapCryptedKeys, NotifyStatusChanged, SetCrypted(), and vMasterKey.
Referenced by CWallet::ChangeWalletPassphrase(), and CWallet::Unlock().
Member Data Documentation
◆ cryptedHDChain
|
private |
Definition at line 122 of file crypter.h.
Referenced by DecryptHDChain(), EncryptHDChain(), GetHDChain(), SetCryptedHDChain(), and Unlock().
◆ fDecryptionThoroughlyChecked
|
private |
◆ 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
|
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
|
protected |
Definition at line 148 of file crypter.h.
Referenced by AddCryptedKey(), EncryptKeys(), GetKey(), GetKeys(), GetPubKey(), HaveKey(), CWallet::LoadWallet(), and Unlock().
◆ 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
|
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:
- src/wallet/crypter.h
- src/wallet/crypter.cpp