5 #ifndef BITCOIN_WALLET_CRYPTER_H 6 #define BITCOIN_WALLET_CRYPTER_H 49 READWRITE(obj.vchCryptedKey, obj.vchSalt, obj.nDerivationMethod, obj.nDeriveIterations, obj.vchOtherDerivationParameters);
62 typedef std::vector<unsigned char, secure_allocator<unsigned char> >
CKeyingMaterial;
64 namespace wallet_crypto_tests
74 std::vector<unsigned char, secure_allocator<unsigned char>>
vchKey;
75 std::vector<unsigned char, secure_allocator<unsigned char>>
vchIV;
81 bool SetKeyFromPassphrase(
const SecureString& key_data, std::span<const unsigned char> salt,
const unsigned int rounds,
const unsigned int derivation_method);
111 #endif // BITCOIN_WALLET_CRYPTER_H Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key...
int BytesToKeySHA512AES(std::span< const unsigned char > salt, const SecureString &key_data, int count, unsigned char *key, unsigned char *iv) const
bool DecryptSecret(const CKeyingMaterial &master_key, const std::span< const unsigned char > ciphertext, const uint256 &iv, CKeyingMaterial &plaintext)
std::vector< unsigned char > vchOtherDerivationParameters
Use this for more parameters to key derivation, such as the various parameters to scrypt...
SERIALIZE_METHODS(CMasterKey, obj)
std::vector< unsigned char, secure_allocator< unsigned char > > vchKey
bool Encrypt(const CKeyingMaterial &vchPlaintext, std::vector< unsigned char > &vchCiphertext) const
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
bool SetKeyFromPassphrase(const SecureString &key_data, std::span< const unsigned char > salt, const unsigned int rounds, const unsigned int derivation_method)
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
bool DecryptKey(const CKeyingMaterial &master_key, const std::span< const unsigned char > crypted_secret, const CPubKey &pub_key, CKey &key)
bool SetKey(const CKeyingMaterial &new_key, std::span< const unsigned char > new_iv)
An encapsulated public key.
const unsigned int WALLET_CRYPTO_IV_SIZE
unsigned int nDeriveIterations
bool Decrypt(std::span< const unsigned char > ciphertext, CKeyingMaterial &plaintext) const
unsigned int nDerivationMethod
0 = EVP_sha512() 1 = scrypt()
std::vector< unsigned char, secure_allocator< unsigned char > > vchIV
bool EncryptSecret(const CKeyingMaterial &vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256 &nIV, std::vector< unsigned char > &vchCiphertext)
std::vector< unsigned char > vchSalt
const unsigned int WALLET_CRYPTO_KEY_SIZE
Encryption/decryption context with key information.
friend class wallet_crypto_tests::TestCrypter
std::vector< unsigned char > vchCryptedKey
An encapsulated private key.
const unsigned int WALLET_CRYPTO_SALT_SIZE
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial