| 146 | |
| 147 | |
| 148 | bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext) |
| 149 | { |
| 150 | CCrypter cKeyCrypter; |
| 151 | std::vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE); |
| 152 | memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE); |
| 153 | if (!cKeyCrypter.SetKey(vMasterKey, chIV)) |
| 154 | return false; |
| 155 | return cKeyCrypter.Decrypt(vchCiphertext, *((CKeyingMaterial*)&vchPlaintext)); |
| 156 | } |
| 157 | |
| 158 | bool DecryptAES256(const SecureString& sKey, const std::string& sCiphertext, const std::string& sIV, SecureString& sPlaintext) |
| 159 | { |