mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
one time garlic encryption for ECIES routers
This commit is contained in:
parent
6362a7bba5
commit
4ba1be2dc0
5 changed files with 66 additions and 31 deletions
|
@ -709,11 +709,20 @@ namespace garlic
|
|||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<I2NPMessage> GarlicDestination::WrapMessage (std::shared_ptr<const i2p::data::RoutingDestination> destination,
|
||||
std::shared_ptr<I2NPMessage> msg, bool attachLeaseSet)
|
||||
std::shared_ptr<I2NPMessage> GarlicDestination::WrapMessageForRouter (std::shared_ptr<const i2p::data::RouterInfo> router,
|
||||
std::shared_ptr<I2NPMessage> msg)
|
||||
{
|
||||
auto session = GetRoutingSession (destination, attachLeaseSet);
|
||||
return session->WrapSingleMessage (msg);
|
||||
if (router->GetEncryptionType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD_RATCHET)
|
||||
{
|
||||
auto session = std::make_shared<ECIESX25519AEADRatchetSession>(this, false);
|
||||
session->SetRemoteStaticKey (router->GetIdentity ()->GetEncryptionPublicKey ());
|
||||
return session->WrapOneTimeMessage (msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto session = GetRoutingSession (router, false);
|
||||
return session->WrapSingleMessage (msg);
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<GarlicRoutingSession> GarlicDestination::GetRoutingSession (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue