| 209 | } |
| 210 | |
| 211 | void Secp256k1PP::encrypt(Public const& _k, bytes& io_cipher) |
| 212 | { |
| 213 | auto& ctx = Secp256k1PPCtx::get(); |
| 214 | ECIES<ECP>::Encryptor e; |
| 215 | { |
| 216 | Guard l(ctx.x_params); |
| 217 | e.AccessKey().Initialize(ctx.m_params, publicToPoint(_k)); |
| 218 | } |
| 219 | |
| 220 | size_t plen = io_cipher.size(); |
| 221 | bytes ciphertext; |
| 222 | ciphertext.resize(e.CiphertextLength(plen)); |
| 223 | |
| 224 | { |
| 225 | Guard l(ctx.x_rng); |
| 226 | e.Encrypt(ctx.m_rng, io_cipher.data(), plen, ciphertext.data()); |
| 227 | } |
| 228 | |
| 229 | memset(io_cipher.data(), 0, io_cipher.size()); |
| 230 | io_cipher = std::move(ciphertext); |
| 231 | } |
| 232 | |
| 233 | void Secp256k1PP::decrypt(Secret const& _k, bytes& io_text) |
| 234 | { |
nothing calls this directly
no test coverage detected