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