58 nDeriveIterations = 25000;
59 nDerivationMethod = 0;
60 vchOtherDerivationParameters = std::vector<unsigned char>(0);
64 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CKeyingMaterial;
75 bool SetKeyFromPassphrase(
const SecureString &strKeyData,
const std::vector<unsigned char>& chSalt,
const unsigned int nRounds,
const unsigned int nDerivationMethod);
76 bool Encrypt(
const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext);
77 bool Decrypt(
const std::vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext);
78 bool SetKey(
const CKeyingMaterial& chNewKey,
const std::vector<unsigned char>& chNewIV);
82 OPENSSL_cleanse(chKey,
sizeof(chKey));
83 OPENSSL_cleanse(chIV,
sizeof(chIV));
107 bool EncryptSecret(
const CKeyingMaterial& vMasterKey,
const CKeyingMaterial &vchPlaintext,
const uint256& nIV, std::vector<unsigned char> &vchCiphertext);
108 bool DecryptSecret(
const CKeyingMaterial& vMasterKey,
const std::vector<unsigned char>& vchCiphertext,
const uint256& nIV, CKeyingMaterial& vchPlaintext);
130 bool Unlock(
const CKeyingMaterial& vMasterKeyIn);
149 result = vMasterKey.empty();
156 virtual bool AddCryptedKey(
const CPubKey &vchPubKey,
const std::vector<unsigned char> &vchCryptedSecret);
164 return mapCryptedKeys.count(address) > 0;
170 void GetKeys(std::set<CKeyID> &setAddress)
const
178 CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
179 while (mi != mapCryptedKeys.end())
181 setAddress.insert((*mi).first);
bool SetKeyFromPassphrase(const SecureString &strKeyData, const std::vector< unsigned char > &chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
unsigned int nDerivationMethod
CCriticalSection cs_KeyStore
bool HaveKey(const CKeyID &address) const
bool Encrypt(const CKeyingMaterial &vchPlaintext, std::vector< unsigned char > &vchCiphertext)
const unsigned int WALLET_CRYPTO_KEY_SIZE
void LockRange(void *p, size_t size)
unsigned char chIV[WALLET_CRYPTO_KEY_SIZE]
bool SetKey(const CKeyingMaterial &chNewKey, const std::vector< unsigned char > &chNewIV)
Encryption/decryption context with key information.
void GetKeys(std::set< CKeyID > &setAddress) const
std::vector< unsigned char > vchCryptedKey
bool HaveKey(const CKeyID &address) const
Master key for wallet encryption.
std::vector< unsigned char > vchOtherDerivationParameters
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial
bool DecryptSecret(const CKeyingMaterial &vMasterKey, const std::vector< unsigned char > &vchCiphertext, const uint256 &nIV, CKeyingMaterial &vchPlaintext)
std::map< CKeyID, std::pair< CPubKey, std::vector< unsigned char > > > CryptedKeyMap
bool EncryptKeys(CKeyingMaterial &vMasterKeyIn)
IMPLEMENT_SERIALIZE(READWRITE(vchCryptedKey);READWRITE(vchSalt);READWRITE(nDerivationMethod);READWRITE(nDeriveIterations);READWRITE(vchOtherDerivationParameters);) CMasterKey()
CKeyingMaterial vMasterKey
virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
Keystore which keeps the private keys encrypted.
bool GetKey(const CKeyID &address, CKey &keyOut) const
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
void GetKeys(std::set< CKeyID > &setAddress) const
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
An encapsulated public key.
bool Unlock(const CKeyingMaterial &vMasterKeyIn)
bool Decrypt(const std::vector< unsigned char > &vchCiphertext, CKeyingMaterial &vchPlaintext)
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)
unsigned char chKey[WALLET_CRYPTO_KEY_SIZE]
static LockedPageManager & Instance()
const unsigned int WALLET_CRYPTO_SALT_SIZE
CryptedKeyMap mapCryptedKeys
void UnlockRange(void *p, size_t size)
A reference to a CKey: the Hash160 of its serialized public key.
std::vector< unsigned char > vchSalt
bool EncryptSecret(const CKeyingMaterial &vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256 &nIV, std::vector< unsigned char > &vchCiphertext)
An encapsulated private key.
unsigned int nDeriveIterations
Basic key store, that keeps keys in an address->secret map.