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

Method SetEncryptionPrivateKey

libi2pd_client/I2CP.cpp:44–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 }
43
44 void I2CPDestination::SetEncryptionPrivateKey (i2p::data::CryptoKeyType keyType, const uint8_t * key)
45 {
46 bool exist = false;
47 auto it = m_EncryptionKeys.find (keyType);
48 if (it != m_EncryptionKeys.end () && !memcmp (it->second->priv.data (), key, it->second->priv.size ())) // new key?
49 exist = true;
50 if (!exist)
51 {
52 auto encryptionKey = std::make_shared<i2p::crypto::LocalEncryptionKey> (keyType);
53 memcpy (encryptionKey->priv.data (), key, encryptionKey->priv.size ());
54 encryptionKey->CreateDecryptor (); // from private key
55 m_EncryptionKeys.insert_or_assign (keyType, encryptionKey);
56 }
57 }
58
59 void I2CPDestination::SetECIESx25519EncryptionPrivateKey (i2p::data::CryptoKeyType keyType, const uint8_t * key)
60 {

Calls 1

CreateDecryptorMethod · 0.45

Tested by

no test coverage detected