22 if(!
count || !key || !iv)
32 for(
int i = 0; i !=
count - 1; i++)
33 di.Reset().Write(buf,
sizeof(buf)).Finalize(buf);
139 if (
secret.size() != 32) {
static const int AES_BLOCKSIZE
int Decrypt(const unsigned char *data, int size, unsigned char *out) const
int Encrypt(const unsigned char *data, int size, unsigned char *out) const
An encapsulated 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.
A hasher class for SHA-512.
static constexpr size_t OUTPUT_SIZE
void Finalize(unsigned char hash[OUTPUT_SIZE])
CSHA512 & Write(const unsigned char *data, size_t len)
constexpr const unsigned char * data() const
Encryption/decryption context with key information.
bool Decrypt(std::span< const unsigned char > ciphertext, CKeyingMaterial &plaintext) const
bool SetKeyFromPassphrase(const SecureString &key_data, std::span< const unsigned char > salt, unsigned int rounds, unsigned int derivation_method)
int BytesToKeySHA512AES(std::span< const unsigned char > salt, const SecureString &key_data, int count, unsigned char *key, unsigned char *iv) const
std::vector< unsigned char, secure_allocator< unsigned char > > vchKey
bool SetKey(const CKeyingMaterial &new_key, std::span< const unsigned char > new_iv)
bool Encrypt(const CKeyingMaterial &vchPlaintext, std::vector< unsigned char > &vchCiphertext) const
std::vector< unsigned char, secure_allocator< unsigned char > > vchIV
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial
const unsigned int WALLET_CRYPTO_KEY_SIZE
bool DecryptSecret(const CKeyingMaterial &master_key, const std::span< const unsigned char > ciphertext, const uint256 &iv, CKeyingMaterial &plaintext)
const unsigned int WALLET_CRYPTO_IV_SIZE
bool DecryptKey(const CKeyingMaterial &master_key, const std::span< const unsigned char > crypted_secret, const CPubKey &pub_key, CKey &key)
const unsigned int WALLET_CRYPTO_SALT_SIZE
bool EncryptSecret(const CKeyingMaterial &vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256 &nIV, std::vector< unsigned char > &vchCiphertext)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
unsigned char * UCharCast(char *c)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.