Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/crypter.h
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Keystore which keeps the private keys encrypted. | * Keystore which keeps the private keys encrypted. | ||||
* It derives from the basic key store, which is used if no encryption is | * It derives from the basic key store, which is used if no encryption is | ||||
* active. | * active. | ||||
*/ | */ | ||||
class CCryptoKeyStore : public CBasicKeyStore { | class CCryptoKeyStore : public CBasicKeyStore { | ||||
private: | private: | ||||
CKeyingMaterial vMasterKey; | CKeyingMaterial vMasterKey GUARDED_BY(cs_KeyStore); | ||||
//! if fUseCrypto is true, mapKeys must be empty | //! if fUseCrypto is true, mapKeys must be empty | ||||
//! if fUseCrypto is false, vMasterKey must be empty | //! if fUseCrypto is false, vMasterKey must be empty | ||||
std::atomic<bool> fUseCrypto; | std::atomic<bool> fUseCrypto; | ||||
//! keeps track of whether Unlock has run a thorough check before | //! keeps track of whether Unlock has run a thorough check before | ||||
bool fDecryptionThoroughlyChecked; | bool fDecryptionThoroughlyChecked; | ||||
protected: | protected: | ||||
bool SetCrypted(); | bool SetCrypted(); | ||||
//! will encrypt previously unencrypted keys | //! will encrypt previously unencrypted keys | ||||
bool EncryptKeys(CKeyingMaterial &vMasterKeyIn); | bool EncryptKeys(CKeyingMaterial &vMasterKeyIn); | ||||
bool Unlock(const CKeyingMaterial &vMasterKeyIn); | bool Unlock(const CKeyingMaterial &vMasterKeyIn); | ||||
CryptedKeyMap mapCryptedKeys; | CryptedKeyMap mapCryptedKeys GUARDED_BY(cs_KeyStore); | ||||
public: | public: | ||||
CCryptoKeyStore() | CCryptoKeyStore() | ||||
: fUseCrypto(false), fDecryptionThoroughlyChecked(false) {} | : fUseCrypto(false), fDecryptionThoroughlyChecked(false) {} | ||||
bool IsCrypted() const { return fUseCrypto; } | bool IsCrypted() const { return fUseCrypto; } | ||||
bool IsLocked() const; | bool IsLocked() const; | ||||
bool Lock(); | bool Lock(); | ||||
Show All 17 Lines |