MCPcopy Create free account
hub / github.com/LUX-Core/lux / encrypt

Method encrypt

src/cpp-ethereum/libdevcrypto/CryptoPP.cpp:211–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void 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
233void Secp256k1PP::decrypt(Secret const& _k, bytes& io_text)
234{

Callers

nothing calls this directly

Calls 6

publicToPointFunction · 0.85
InitializeMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
EncryptMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected