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