5 #ifndef FABCOIN_WALLET_CRYPTER_H 6 #define FABCOIN_WALLET_CRYPTER_H 47 template <
typename Stream,
typename Operation>
60 nDeriveIterations = 25000;
61 nDerivationMethod = 0;
62 vchOtherDerivationParameters = std::vector<unsigned char>(0);
66 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CKeyingMaterial;
76 friend class wallet_crypto::TestCrypter;
78 std::vector<unsigned char, secure_allocator<unsigned char>>
vchKey;
79 std::vector<unsigned char, secure_allocator<unsigned char>>
vchIV;
82 int BytesToKeySHA512AES(
const std::vector<unsigned char>& chSalt,
const SecureString& strKeyData,
int count,
unsigned char *key,
unsigned char *iv)
const;
85 bool SetKeyFromPassphrase(
const SecureString &strKeyData,
const std::vector<unsigned char>& chSalt,
const unsigned int nRounds,
const unsigned int nDerivationMethod);
86 bool Encrypt(
const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext)
const;
87 bool Decrypt(
const std::vector<unsigned char>& vchCiphertext,
CKeyingMaterial& vchPlaintext)
const;
88 bool SetKey(
const CKeyingMaterial& chNewKey,
const std::vector<unsigned char>& chNewIV);
152 result = vMasterKey.empty();
159 virtual bool AddCryptedKey(
const CPubKey &vchPubKey,
const std::vector<unsigned char> &vchCryptedSecret);
160 bool AddKeyPubKey(
const CKey& key,
const CPubKey &pubkey)
override;
167 return mapCryptedKeys.count(address) > 0;
172 bool GetPubKey(
const CKeyID &address,
CPubKey& vchPubKeyOut)
const override;
173 void GetKeys(std::set<CKeyID> &setAddress)
const override 181 CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
182 while (mi != mapCryptedKeys.end())
184 setAddress.insert((*mi).first);
196 #endif // FABCOIN_WALLET_CRYPTER_H
unsigned int nDerivationMethod
0 = EVP_sha512() 1 = scrypt()
bool HaveKey(const CKeyID &address) const override
Check whether a key corresponding to a given address is present in the store.
const unsigned int WALLET_CRYPTO_KEY_SIZE
void GetKeys(std::set< CKeyID > &setAddress) const override
Encryption/decryption context with key information.
std::vector< unsigned char > vchCryptedKey
Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key...
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial
std::vector< unsigned char > vchOtherDerivationParameters
Use this for more parameters to key derivation, such as the various parameters to scrypt...
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial
std::map< CKeyID, std::pair< CPubKey, std::vector< unsigned char > > > CryptedKeyMap
CKeyingMaterial vMasterKey
const unsigned int WALLET_CRYPTO_IV_SIZE
Keystore which keeps the private keys encrypted.
void GetKeys(std::set< CKeyID > &setAddress) const override
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
Wallet status (encrypted, locked) changed.
void memory_cleanse(void *ptr, size_t len)
std::vector< unsigned char, secure_allocator< unsigned char > > vchKey
std::vector< unsigned char, secure_allocator< unsigned char > > vchIV
An encapsulated public key.
const unsigned int WALLET_CRYPTO_SALT_SIZE
CryptedKeyMap mapCryptedKeys
void SerializationOp(Stream &s, Operation ser_action)
A reference to a CKey: the Hash160 of its serialized public key.
std::vector< unsigned char > vchSalt
bool fUseCrypto
if fUseCrypto is true, mapKeys must be empty if fUseCrypto is false, vMasterKey must be empty ...
struct evm_uint160be address(struct evm_env *env)
An encapsulated private key.
unsigned int nDeriveIterations
bool HaveKey(const CKeyID &address) const override
Check whether a key corresponding to a given address is present in the store.
bool fDecryptionThoroughlyChecked
keeps track of whether Unlock has run a thorough check before
Basic key store, that keeps keys in an address->secret map.