mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
don't create ECIESx25519 again if key was not changed
This commit is contained in:
parent
4ae41513ac
commit
55ff6beb7d
|
@ -60,7 +60,11 @@ namespace client
|
||||||
|
|
||||||
void I2CPDestination::SetECIESx25519EncryptionPrivateKey (const uint8_t * key)
|
void I2CPDestination::SetECIESx25519EncryptionPrivateKey (const uint8_t * key)
|
||||||
{
|
{
|
||||||
m_ECIESx25519Decryptor = std::make_shared<i2p::crypto::ECIESX25519AEADRatchetDecryptor>(key, true); // calculate public
|
if (!m_ECIESx25519Decryptor || memcmp (m_ECIESx25519PrivateKey, key, 32)) // new key?
|
||||||
|
{
|
||||||
|
m_ECIESx25519Decryptor = std::make_shared<i2p::crypto::ECIESX25519AEADRatchetDecryptor>(key, true); // calculate public
|
||||||
|
memcpy (m_ECIESx25519PrivateKey, key, 32);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I2CPDestination::Decrypt (const uint8_t * encrypted, uint8_t * data, BN_CTX * ctx, i2p::data::CryptoKeyType preferredCrypto) const
|
bool I2CPDestination::Decrypt (const uint8_t * encrypted, uint8_t * data, BN_CTX * ctx, i2p::data::CryptoKeyType preferredCrypto) const
|
||||||
|
|
|
@ -105,6 +105,7 @@ namespace client
|
||||||
i2p::data::CryptoKeyType m_EncryptionKeyType;
|
i2p::data::CryptoKeyType m_EncryptionKeyType;
|
||||||
std::shared_ptr<i2p::crypto::CryptoKeyDecryptor> m_Decryptor; // standard
|
std::shared_ptr<i2p::crypto::CryptoKeyDecryptor> m_Decryptor; // standard
|
||||||
std::shared_ptr<i2p::crypto::ECIESX25519AEADRatchetDecryptor> m_ECIESx25519Decryptor;
|
std::shared_ptr<i2p::crypto::ECIESX25519AEADRatchetDecryptor> m_ECIESx25519Decryptor;
|
||||||
|
uint8_t m_ECIESx25519PrivateKey[32];
|
||||||
uint64_t m_LeaseSetExpirationTime;
|
uint64_t m_LeaseSetExpirationTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue