MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / SetPrivateKey

Method SetPrivateKey

libi2pd/Crypto.cpp:335–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333 }
334
335 void X25519Keys::SetPrivateKey (const uint8_t * priv, bool calculatePublic)
336 {
337 if (m_Ctx) EVP_PKEY_CTX_free (m_Ctx);
338 if (m_Pkey) EVP_PKEY_free (m_Pkey);
339 m_Pkey = EVP_PKEY_new_raw_private_key (EVP_PKEY_X25519, NULL, priv, 32);
340 m_Ctx = EVP_PKEY_CTX_new (m_Pkey, NULL);
341 if (calculatePublic)
342 {
343 size_t len = 32;
344 EVP_PKEY_get_raw_public_key (m_Pkey, m_PublicKey, &len);
345 }
346 }
347
348// ElGamal
349 void ElGamalEncrypt (const uint8_t * key, const uint8_t * data, uint8_t * encrypted)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected