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

Method Decrypt

src/wallet/crypter.cpp:94–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94bool CCrypter::Decrypt(const std::span<const unsigned char> ciphertext, CKeyingMaterial& plaintext) const
95{
96 if (!fKeySet)
97 return false;
98
99 // plaintext will always be equal to or lesser than length of ciphertext
100 plaintext.resize(ciphertext.size());
101
102 AES256CBCDecrypt dec(vchKey.data(), vchIV.data(), true);
103 int len = dec.Decrypt(ciphertext.data(), ciphertext.size(), plaintext.data());
104 if (len == 0) {
105 return false;
106 }
107 plaintext.resize(len);
108 return true;
109}
110
111bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
112{

Callers 4

DecryptSecretFunction · 0.45
DecryptMasterKeyFunction · 0.45
TestDecryptMethod · 0.45
crypter.cppFile · 0.45

Calls 3

resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TestDecryptMethod · 0.36