| 58 | } |
| 59 | |
| 60 | bool CCrypter::SetKey(const CKeyingMaterial& chNewKey, const std::vector<unsigned char>& chNewIV) |
| 61 | { |
| 62 | if (chNewKey.size() != WALLET_CRYPTO_KEY_SIZE || chNewIV.size() != WALLET_CRYPTO_IV_SIZE) |
| 63 | return false; |
| 64 | |
| 65 | memcpy(vchKey.data(), chNewKey.data(), chNewKey.size()); |
| 66 | memcpy(vchIV.data(), chNewIV.data(), chNewIV.size()); |
| 67 | |
| 68 | fKeySet = true; |
| 69 | return true; |
| 70 | } |
| 71 | |
| 72 | bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector<unsigned char> &vchCiphertext) const |
| 73 | { |