59 nDeriveIterations = 25000;
60 nDerivationMethod = 0;
61 vchOtherDerivationParameters = std::vector<unsigned char>(0);
65 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CKeyingMaterial;
76 bool SetKeyFromPassphrase(
const SecureString &strKeyData,
const std::vector<unsigned char>& chSalt,
const unsigned int nRounds,
const unsigned int nDerivationMethod);
77 bool Encrypt(
const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext);
78 bool Decrypt(
const std::vector<unsigned char>& vchCiphertext, CKeyingMaterial& vchPlaintext);
79 bool SetKey(
const CKeyingMaterial& chNewKey,
const std::vector<unsigned char>& chNewIV);
83 OPENSSL_cleanse(chKey,
sizeof(chKey));
84 OPENSSL_cleanse(chIV,
sizeof(chIV));
108 bool EncryptSecret(
const CKeyingMaterial& vMasterKey,
const CKeyingMaterial &vchPlaintext,
const uint256& nIV, std::vector<unsigned char> &vchCiphertext);
109 bool DecryptSecret(
const CKeyingMaterial& vMasterKey,
const std::vector<unsigned char>& vchCiphertext,
const uint256& nIV, CKeyingMaterial& vchPlaintext);
131 bool Unlock(
const CKeyingMaterial& vMasterKeyIn);
150 result = vMasterKey.empty();
157 virtual bool AddCryptedKey(
const CPubKey &vchPubKey,
const std::vector<unsigned char> &vchCryptedSecret);
165 return mapCryptedKeys.count(address) > 0;
171 void GetKeys(std::set<CKeyID> &setAddress)
const
179 CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
180 while (mi != mapCryptedKeys.end())
182 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.