PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | List of all members
CCryptoKeyStore Class Reference

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

#include <crypter.h>

Inheritance diagram for CCryptoKeyStore:
[legend]
Collaboration diagram for CCryptoKeyStore:
[legend]

Public Member Functions

 CCryptoKeyStore ()
 
bool IsCrypted () const
 
bool IsLocked () const
 
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 AddCryptedSaplingSpendingKey (const libzcash::SaplingExtendedFullViewingKey &extfvk, const std::vector< unsigned char > &vchCryptedSecret)
 Sapling. More...
 
bool HaveSaplingSpendingKey (const libzcash::SaplingExtendedFullViewingKey &extfvk) const override
 
bool GetSaplingSpendingKey (const libzcash::SaplingExtendedFullViewingKey &extfvk, libzcash::SaplingExtendedSpendingKey &skOut) const override
 
- Public Member Functions inherited from CBasicKeyStore
bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey)
 Add a key to the store. More...
 
bool GetPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const
 
bool HaveKey (const CKeyID &address) const
 Check whether a key corresponding to a given address is present in the store. More...
 
bool HaveKey (const CExchangeKeyID &address) const
 
std::set< CKeyIDGetKeys () const
 
bool GetKey (const CKeyID &address, CKey &keyOut) const
 
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 AddSaplingSpendingKey (const libzcash::SaplingExtendedSpendingKey &sk)
 Sapling. More...
 
bool HaveSaplingSpendingKey (const libzcash::SaplingExtendedFullViewingKey &extfvk) const
 
bool GetSaplingSpendingKey (const libzcash::SaplingExtendedFullViewingKey &extfvk, libzcash::SaplingExtendedSpendingKey &skOut) const
 
virtual bool AddSaplingFullViewingKey (const libzcash::SaplingExtendedFullViewingKey &extfvk)
 Support for Sapling full viewing keys. More...
 
virtual bool HaveSaplingFullViewingKey (const libzcash::SaplingIncomingViewingKey &ivk) const
 
virtual bool GetSaplingFullViewingKey (const libzcash::SaplingIncomingViewingKey &ivk, libzcash::SaplingExtendedFullViewingKey &extfvkOut) const
 
virtual bool AddSaplingIncomingViewingKey (const libzcash::SaplingIncomingViewingKey &ivk, const libzcash::SaplingPaymentAddress &addr)
 Sapling incoming viewing keys. More...
 
virtual bool HaveSaplingIncomingViewingKey (const libzcash::SaplingPaymentAddress &addr) const
 
virtual bool GetSaplingIncomingViewingKey (const libzcash::SaplingPaymentAddress &addr, libzcash::SaplingIncomingViewingKey &ivkOut) const
 
bool GetSaplingExtendedSpendingKey (const libzcash::SaplingPaymentAddress &addr, libzcash::SaplingExtendedSpendingKey &extskOut) const
 
void GetSaplingPaymentAddresses (std::set< libzcash::SaplingPaymentAddress > &setAddress) const
 
- 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...
 
- Public Attributes inherited from CBasicKeyStore
SaplingSpendingKeyMap mapSaplingSpendingKeys
 
SaplingFullViewingKeyMap mapSaplingFullViewingKeys
 
SaplingIncomingViewingKeyMap mapSaplingIncomingViewingKeys
 
- Public Attributes inherited from CKeyStore
RecursiveMutex cs_KeyStore
 

Protected Member Functions

bool SetCrypted ()
 
bool EncryptKeys (CKeyingMaterial &vMasterKeyIn)
 will encrypt previously unencrypted keys More...
 
bool UnlockSaplingKeys (const CKeyingMaterial &vMasterKeyIn, bool fDecryptionThoroughlyChecked)
 

Static Protected Member Functions

static bool DecryptKey (const CKeyingMaterial &vMasterKey, const std::vector< unsigned char > &vchCryptedSecret, const CPubKey &vchPubKey, CKey &key)
 

Protected Attributes

CKeyingMaterial vMasterKey
 
CryptedSaplingSpendingKeyMap mapCryptedSaplingSpendingKeys
 
CryptedKeyMap mapCryptedKeys
 
- Protected Attributes inherited from CBasicKeyStore
KeyMap mapKeys
 
WatchKeyMap mapWatchKeys
 
ScriptMap mapScripts
 
WatchOnlySet setWatchOnly
 

Private Attributes

std::atomic< bool > fUseCrypto
 if fUseCrypto is true, mapKeys and mapSaplingSpendingKeys must be empty if fUseCrypto is false, vMasterKey must be empty 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 126 of file crypter.h.

Constructor & Destructor Documentation

◆ CCryptoKeyStore()

CCryptoKeyStore::CCryptoKeyStore ( )
inline

Definition at line 152 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 188 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddCryptedSaplingSpendingKey()

bool CCryptoKeyStore::AddCryptedSaplingSpendingKey ( const libzcash::SaplingExtendedFullViewingKey extfvk,
const std::vector< unsigned char > &  vchCryptedSecret 
)
virtual

Sapling.

Definition at line 13 of file crypter_sapling.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddKeyPubKey()

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

Add a key to the store.

Implements CKeyStore.

Reimplemented in CWallet.

Definition at line 156 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DecryptKey()

bool CCryptoKeyStore::DecryptKey ( const CKeyingMaterial vMasterKey,
const std::vector< unsigned char > &  vchCryptedSecret,
const CPubKey vchPubKey,
CKey key 
)
staticprotected

Definition at line 124 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EncryptKeys()

bool CCryptoKeyStore::EncryptKeys ( CKeyingMaterial vMasterKeyIn)
protected

will encrypt previously unencrypted keys

Definition at line 244 of file crypter.cpp.

Here is the call graph for this function:

◆ GetKey()

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

Implements CKeyStore.

Definition at line 199 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetKeys()

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

Implements CKeyStore.

Definition at line 231 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPubKey()

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

Implements CKeyStore.

Definition at line 215 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSaplingSpendingKey()

bool CCryptoKeyStore::GetSaplingSpendingKey ( const libzcash::SaplingExtendedFullViewingKey extfvk,
libzcash::SaplingExtendedSpendingKey skOut 
) const
overridevirtual

Implements CKeyStore.

Definition at line 48 of file crypter_sapling.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HaveKey()

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

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

Implements CKeyStore.

Definition at line 179 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HaveSaplingSpendingKey()

bool CCryptoKeyStore::HaveSaplingSpendingKey ( const libzcash::SaplingExtendedFullViewingKey extfvk) const
overridevirtual

Implements CKeyStore.

Definition at line 63 of file crypter_sapling.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsCrypted()

bool CCryptoKeyStore::IsCrypted ( ) const
inline

Definition at line 154 of file crypter.h.

Here is the caller graph for this function:

◆ IsLocked()

bool CCryptoKeyStore::IsLocked ( ) const

Definition at line 148 of file crypter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetCrypted()

bool CCryptoKeyStore::SetCrypted ( )
protected

Definition at line 137 of file crypter.cpp.

Here is the caller graph for this function:

◆ UnlockSaplingKeys()

bool CCryptoKeyStore::UnlockSaplingKeys ( const CKeyingMaterial vMasterKeyIn,
bool  fDecryptionThoroughlyChecked 
)
protected

Definition at line 72 of file crypter_sapling.cpp.

Member Data Documentation

◆ fUseCrypto

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

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

Definition at line 131 of file crypter.h.

◆ mapCryptedKeys

CryptedKeyMap CCryptoKeyStore::mapCryptedKeys
protected

Definition at line 144 of file crypter.h.

◆ mapCryptedSaplingSpendingKeys

CryptedSaplingSpendingKeyMap CCryptoKeyStore::mapCryptedSaplingSpendingKeys
protected

Definition at line 137 of file crypter.h.

◆ NotifyStatusChanged

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

Wallet status (encrypted, locked) changed.

Note: Called without locks held.

Definition at line 175 of file crypter.h.

◆ vMasterKey

CKeyingMaterial CCryptoKeyStore::vMasterKey
protected
Todo:
: In the future, move this variable to the wallet class directly following upstream's structure.

Definition at line 135 of file crypter.h.


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