mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
load eepsite keys
This commit is contained in:
parent
59d195c6da
commit
c855d8b413
@ -28,6 +28,13 @@ namespace data
|
|||||||
Identity& operator=(const Keys& keys);
|
Identity& operator=(const Keys& keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct PrivateKeys // for eepsites
|
||||||
|
{
|
||||||
|
Identity pub;
|
||||||
|
uint8_t privateKey[256];
|
||||||
|
uint8_t signingPrivateKey[20];
|
||||||
|
};
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
class IdentHash
|
class IdentHash
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <string>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cryptopp/gzip.h>
|
#include <cryptopp/gzip.h>
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
@ -301,7 +301,6 @@ namespace stream
|
|||||||
|
|
||||||
StreamingDestination::StreamingDestination (): m_LeaseSet (nullptr)
|
StreamingDestination::StreamingDestination (): m_LeaseSet (nullptr)
|
||||||
{
|
{
|
||||||
// TODO: read from file later
|
|
||||||
m_Keys = i2p::data::CreateRandomKeys ();
|
m_Keys = i2p::data::CreateRandomKeys ();
|
||||||
m_Identity = m_Keys;
|
m_Identity = m_Keys;
|
||||||
m_IdentHash = i2p::data::CalculateIdentHash (m_Identity);
|
m_IdentHash = i2p::data::CalculateIdentHash (m_Identity);
|
||||||
@ -310,6 +309,22 @@ namespace stream
|
|||||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this);
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StreamingDestination::StreamingDestination (const std::string& fullPath): m_LeaseSet (nullptr)
|
||||||
|
{
|
||||||
|
std::ifstream s(fullPath.c_str (), std::ifstream::binary);
|
||||||
|
if (s.is_open ())
|
||||||
|
{
|
||||||
|
i2p::data::PrivateKeys keys;
|
||||||
|
s.read ((char *)&keys, sizeof (keys));
|
||||||
|
// TODO: use PrivateKeys
|
||||||
|
m_Identity = keys.pub;
|
||||||
|
memcpy (m_Keys.privateKey, keys.privateKey, 276);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LogPrint ("Can't open file ", fullPath);
|
||||||
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this);
|
||||||
|
}
|
||||||
|
|
||||||
StreamingDestination::~StreamingDestination ()
|
StreamingDestination::~StreamingDestination ()
|
||||||
{
|
{
|
||||||
if (m_LeaseSet)
|
if (m_LeaseSet)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define STREAMING_H__
|
#define STREAMING_H__
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <cryptopp/dsa.h>
|
#include <cryptopp/dsa.h>
|
||||||
@ -106,6 +107,7 @@ namespace stream
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
StreamingDestination ();
|
StreamingDestination ();
|
||||||
|
StreamingDestination (const std::string& fullPath);
|
||||||
~StreamingDestination ();
|
~StreamingDestination ();
|
||||||
|
|
||||||
const i2p::data::Keys& GetKeys () const { return m_Keys; };
|
const i2p::data::Keys& GetKeys () const { return m_Keys; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user