| 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 | { |
no test coverage detected