mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
select preferred crypto from LeaseSet2
This commit is contained in:
parent
53a6162b0c
commit
09ed57ad42
5 changed files with 24 additions and 15 deletions
|
@ -25,7 +25,7 @@ namespace client
|
|||
|
||||
I2CPDestination::I2CPDestination (std::shared_ptr<I2CPSession> owner, std::shared_ptr<const i2p::data::IdentityEx> identity, bool isPublic, const std::map<std::string, std::string>& params):
|
||||
RunnableService ("I2CP"), LeaseSetDestination (GetIOService (), isPublic, ¶ms),
|
||||
m_Owner (owner), m_Identity (identity)
|
||||
m_Owner (owner), m_Identity (identity), m_EncryptionKeyType (m_Identity->GetCryptoKeyType ())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,10 @@ namespace client
|
|||
}
|
||||
// TODO: support multiple keys
|
||||
if (currentKey)
|
||||
{
|
||||
m_Destination->SetEncryptionPrivateKey (currentKey);
|
||||
m_Destination->SetEncryptionType (currentKeyType);
|
||||
}
|
||||
|
||||
m_Destination->LeaseSet2Created (storeType, ls.GetBuffer (), ls.GetBufferLen ());
|
||||
}
|
||||
|
|
|
@ -73,12 +73,14 @@ namespace client
|
|||
void Stop ();
|
||||
|
||||
void SetEncryptionPrivateKey (const uint8_t * key);
|
||||
void SetEncryptionType (i2p::data::CryptoKeyType keyType) { m_EncryptionKeyType = keyType; };
|
||||
void LeaseSetCreated (const uint8_t * buf, size_t len); // called from I2CPSession
|
||||
void LeaseSet2Created (uint8_t storeType, const uint8_t * buf, size_t len); // called from I2CPSession
|
||||
void SendMsgTo (const uint8_t * payload, size_t len, const i2p::data::IdentHash& ident, uint32_t nonce); // called from I2CPSession
|
||||
|
||||
// implements LocalDestination
|
||||
bool Decrypt (const uint8_t * encrypted, uint8_t * data, BN_CTX * ctx) const;
|
||||
i2p::data::CryptoKeyType GetEncryptionType () const { return m_EncryptionKeyType; };
|
||||
std::shared_ptr<const i2p::data::IdentityEx> GetIdentity () const { return m_Identity; };
|
||||
|
||||
protected:
|
||||
|
@ -98,6 +100,7 @@ namespace client
|
|||
std::shared_ptr<I2CPSession> m_Owner;
|
||||
std::shared_ptr<const i2p::data::IdentityEx> m_Identity;
|
||||
uint8_t m_EncryptionPrivateKey[256];
|
||||
i2p::data::CryptoKeyType m_EncryptionKeyType;
|
||||
std::shared_ptr<i2p::crypto::CryptoKeyDecryptor> m_Decryptor;
|
||||
uint64_t m_LeaseSetExpirationTime;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue