MCPcopy Create free account
hub / github.com/ElementsProject/elements / Decrypt

Method Decrypt

src/wallet/crypter.cpp:90–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

DecryptSecretFunction · 0.45
UnlockMethod · 0.45
TestDecryptMethod · 0.45

Calls 3

sizeMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45

Tested by 1

TestDecryptMethod · 0.36