|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include "base64.h"
|
|
|
|
|
#include "ElGamal.h"
|
|
|
|
|
#include "Signature.h"
|
|
|
|
@ -219,23 +220,23 @@ namespace data
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
RoutingDestination (): m_ElGamalEncryption (nullptr) {};
|
|
|
|
|
virtual ~RoutingDestination () { delete m_ElGamalEncryption; };
|
|
|
|
|
RoutingDestination () {};
|
|
|
|
|
virtual ~RoutingDestination () {};
|
|
|
|
|
|
|
|
|
|
virtual const IdentHash& GetIdentHash () const = 0;
|
|
|
|
|
virtual const uint8_t * GetEncryptionPublicKey () const = 0;
|
|
|
|
|
virtual bool IsDestination () const = 0; // for garlic
|
|
|
|
|
|
|
|
|
|
const i2p::crypto::ElGamalEncryption * GetElGamalEncryption () const
|
|
|
|
|
std::unique_ptr<const i2p::crypto::ElGamalEncryption>& GetElGamalEncryption () const
|
|
|
|
|
{
|
|
|
|
|
if (!m_ElGamalEncryption)
|
|
|
|
|
m_ElGamalEncryption = new i2p::crypto::ElGamalEncryption (GetEncryptionPublicKey ());
|
|
|
|
|
m_ElGamalEncryption.reset (new i2p::crypto::ElGamalEncryption (GetEncryptionPublicKey ()));
|
|
|
|
|
return m_ElGamalEncryption;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
mutable i2p::crypto::ElGamalEncryption * m_ElGamalEncryption; // use lazy initialization
|
|
|
|
|
mutable std::unique_ptr<const i2p::crypto::ElGamalEncryption> m_ElGamalEncryption; // use lazy initialization
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LocalDestination
|
|
|
|
|