5#ifndef BITCOIN_WALLET_CRYPTER_H
6#define BITCOIN_WALLET_CRYPTER_H
44 READWRITE(obj.vchCryptedKey, obj.vchSalt, obj.nDerivationMethod,
45 obj.nDeriveIterations, obj.vchOtherDerivationParameters);
69 std::vector<uint8_t, secure_allocator<uint8_t>>
vchKey;
70 std::vector<uint8_t, secure_allocator<uint8_t>>
vchIV;
75 uint8_t *key, uint8_t *iv)
const;
79 const std::vector<uint8_t> &chSalt,
80 const unsigned int nRounds,
81 const unsigned int nDerivationMethod);
83 std::vector<uint8_t> &vchCiphertext)
const;
84 bool Decrypt(
const std::vector<uint8_t> &vchCiphertext,
87 const std::vector<uint8_t> &chNewIV);
106 std::vector<uint8_t> &vchCiphertext);
108 const std::vector<uint8_t> &vchCiphertext,
111 const std::vector<uint8_t> &vchCryptedSecret,
Encryption/decryption context with key information.
std::vector< uint8_t, secure_allocator< uint8_t > > vchKey
friend class wallet_crypto_tests::TestCrypter
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.
Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key.
SERIALIZE_METHODS(CMasterKey, obj)
std::vector< uint8_t > vchOtherDerivationParameters
Use this for more parameters to key derivation, such as the various parameters to scrypt.
std::vector< uint8_t > vchSalt
unsigned int nDerivationMethod
0 = EVP_sha512() 1 = scrypt()
unsigned int nDeriveIterations
std::vector< uint8_t > vchCryptedKey
An encapsulated public key.
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)
const unsigned int WALLET_CRYPTO_IV_SIZE
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_SALT_SIZE
std::vector< uint8_t, secure_allocator< uint8_t > > CKeyingMaterial
const unsigned int WALLET_CRYPTO_KEY_SIZE
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString