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

Method NewNTCP2Keys

libi2pd/RouterContext.cpp:297–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295 }
296
297 void RouterContext::NewNTCP2Keys ()
298 {
299 m_NTCP2StaticKeys.reset (new i2p::crypto::X25519Keys ());
300 m_NTCP2StaticKeys->GenerateKeys ();
301 m_NTCP2Keys.reset (new NTCP2PrivateKeys ());
302 m_NTCP2StaticKeys->GetPrivateKey (m_NTCP2Keys->staticPrivateKey);
303 memcpy (m_NTCP2Keys->staticPublicKey, m_NTCP2StaticKeys->GetPublicKey (), 32);
304 RAND_bytes (m_NTCP2Keys->iv, 16);
305 // save
306 std::ofstream fk (i2p::fs::DataDirPath (NTCP2_KEYS), std::ofstream::binary | std::ofstream::out);
307 fk.write ((char *)m_NTCP2Keys.get (), sizeof (NTCP2PrivateKeys));
308 }
309
310 void RouterContext::NewSSU2Keys ()
311 {

Callers

nothing calls this directly

Calls 5

DataDirPathFunction · 0.85
writeMethod · 0.80
GenerateKeysMethod · 0.45
GetPrivateKeyMethod · 0.45
GetPublicKeyMethod · 0.45

Tested by

no test coverage detected