20 if (!
count || !key || !iv) {
31 for (
int i = 0; i !=
count - 1; i++) {
32 di.Reset().Write(buf,
sizeof(buf)).Finalize(buf);
42 const std::vector<uint8_t> &
chSalt,
44 const unsigned int nDerivationMethod) {
50 if (nDerivationMethod == 0) {
66 const std::vector<uint8_t> &
chNewIV) {
static const int AES_BLOCKSIZE
int Decrypt(const uint8_t *data, int size, uint8_t *out) const
int Encrypt(const uint8_t *data, int size, uint8_t *out) const
Encryption/decryption context with key information.
std::vector< uint8_t, secure_allocator< uint8_t > > vchKey
bool Encrypt(const CKeyingMaterial &vchPlaintext, std::vector< uint8_t > &vchCiphertext) const
bool SetKeyFromPassphrase(const SecureString &strKeyData, const std::vector< uint8_t > &chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)
int BytesToKeySHA512AES(const std::vector< uint8_t > &chSalt, const SecureString &strKeyData, int count, uint8_t *key, uint8_t *iv) const
std::vector< uint8_t, secure_allocator< uint8_t > > vchIV
bool Decrypt(const std::vector< uint8_t > &vchCiphertext, CKeyingMaterial &vchPlaintext) const
bool SetKey(const CKeyingMaterial &chNewKey, const std::vector< uint8_t > &chNewIV)
An encapsulated secp256k1 private key.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
bool VerifyPubKey(const CPubKey &vchPubKey) const
Verify thoroughly whether a private key and a public key match.
An encapsulated public key.
bool IsCompressed() const
Check whether this is a compressed public key.
uint256 GetHash() const
Get the 256-bit hash of this public key.
A hasher class for SHA-512.
CSHA512 & Write(const uint8_t *data, size_t len)
static constexpr size_t OUTPUT_SIZE
void Finalize(uint8_t hash[OUTPUT_SIZE])
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
bool DecryptKey(const CKeyingMaterial &vMasterKey, const std::vector< uint8_t > &vchCryptedSecret, const CPubKey &vchPubKey, CKey &key)
bool EncryptSecret(const CKeyingMaterial &vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256 &nIV, std::vector< uint8_t > &vchCiphertext)
bool DecryptSecret(const CKeyingMaterial &vMasterKey, const std::vector< uint8_t > &vchCiphertext, const uint256 &nIV, CKeyingMaterial &vchPlaintext)
const unsigned int WALLET_CRYPTO_IV_SIZE
const unsigned int WALLET_CRYPTO_SALT_SIZE
std::vector< uint8_t, secure_allocator< uint8_t > > CKeyingMaterial
const unsigned int WALLET_CRYPTO_KEY_SIZE
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString