MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / EncryptSecret

Function EncryptSecret

src/wallet/crypter.cpp:111–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
112{
113 CCrypter cKeyCrypter;
114 std::vector<unsigned char> chIV(WALLET_CRYPTO_IV_SIZE);
115 memcpy(chIV.data(), &nIV, WALLET_CRYPTO_IV_SIZE);
116 if(!cKeyCrypter.SetKey(vMasterKey, chIV))
117 return false;
118 return cKeyCrypter.Encrypt(vchPlaintext, vchCiphertext);
119}
120
121bool DecryptSecret(const CKeyingMaterial& master_key, const std::span<const unsigned char> ciphertext, const uint256& iv, CKeyingMaterial& plaintext)
122{

Callers 3

EncryptMethod · 0.85
crypter.cppFile · 0.85

Calls 3

dataMethod · 0.45
SetKeyMethod · 0.45
EncryptMethod · 0.45

Tested by

no test coverage detected