| 119 | } |
| 120 | |
| 121 | bool DecryptSecret(const CKeyingMaterial& master_key, const std::span<const unsigned char> ciphertext, const uint256& iv, CKeyingMaterial& plaintext) |
| 122 | { |
| 123 | CCrypter key_crypter; |
| 124 | static_assert(WALLET_CRYPTO_IV_SIZE <= std::remove_reference_t<decltype(iv)>::size()); |
| 125 | const std::span iv_prefix{iv.data(), WALLET_CRYPTO_IV_SIZE}; |
| 126 | if (!key_crypter.SetKey(master_key, iv_prefix)) { |
| 127 | return false; |
| 128 | } |
| 129 | return key_crypter.Decrypt(ciphertext, plaintext); |
| 130 | } |
| 131 | |
| 132 | bool DecryptKey(const CKeyingMaterial& master_key, const std::span<const unsigned char> crypted_secret, const CPubKey& pub_key, CKey& key) |
| 133 | { |
no test coverage detected