| 109 | } |
| 110 | |
| 111 | bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext) |
| 112 | { |
| 113 | CCrypter cKeyCrypter; |
| 114 | std::vector<unsigned char> chIV(WALLET_CRYPTO_IV_SIZE); |
| 115 | memcpy(chIV.data(), &nIV, WALLET_CRYPTO_IV_SIZE); |
| 116 | if(!cKeyCrypter.SetKey(vMasterKey, chIV)) |
| 117 | return false; |
| 118 | return cKeyCrypter.Encrypt(vchPlaintext, vchCiphertext); |
| 119 | } |
| 120 | |
| 121 | bool DecryptSecret(const CKeyingMaterial& master_key, const std::span<const unsigned char> ciphertext, const uint256& iv, CKeyingMaterial& plaintext) |
| 122 | { |
no test coverage detected