|
|
@ -302,8 +302,7 @@ namespace stream |
|
|
|
StreamingDestination::StreamingDestination (): m_LeaseSet (nullptr) |
|
|
|
StreamingDestination::StreamingDestination (): m_LeaseSet (nullptr) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_Keys = i2p::data::CreateRandomKeys (); |
|
|
|
m_Keys = i2p::data::CreateRandomKeys (); |
|
|
|
m_Identity = m_Keys; |
|
|
|
m_IdentHash = i2p::data::CalculateIdentHash (m_Keys.pub); |
|
|
|
m_IdentHash = i2p::data::CalculateIdentHash (m_Identity); |
|
|
|
|
|
|
|
m_SigningPrivateKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag, |
|
|
|
m_SigningPrivateKey.Initialize (i2p::crypto::dsap, i2p::crypto::dsaq, i2p::crypto::dsag, |
|
|
|
CryptoPP::Integer (m_Keys.signingPrivateKey, 20)); |
|
|
|
CryptoPP::Integer (m_Keys.signingPrivateKey, 20)); |
|
|
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this); |
|
|
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this); |
|
|
@ -313,13 +312,7 @@ namespace stream |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::ifstream s(fullPath.c_str (), std::ifstream::binary); |
|
|
|
std::ifstream s(fullPath.c_str (), std::ifstream::binary); |
|
|
|
if (s.is_open ()) |
|
|
|
if (s.is_open ()) |
|
|
|
{ |
|
|
|
s.read ((char *)&m_Keys, sizeof (m_Keys)); |
|
|
|
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 |
|
|
|
else |
|
|
|
LogPrint ("Can't open file ", fullPath); |
|
|
|
LogPrint ("Can't open file ", fullPath); |
|
|
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this); |
|
|
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this); |
|
|
@ -391,8 +384,8 @@ namespace stream |
|
|
|
|
|
|
|
|
|
|
|
uint8_t * buf = m->GetPayload () + sizeof (I2NPDatabaseStoreMsg); |
|
|
|
uint8_t * buf = m->GetPayload () + sizeof (I2NPDatabaseStoreMsg); |
|
|
|
size_t size = 0; |
|
|
|
size_t size = 0; |
|
|
|
memcpy (buf + size, &m_Identity, sizeof (m_Identity)); |
|
|
|
memcpy (buf + size, &m_Keys.pub, sizeof (m_Keys.pub)); |
|
|
|
size += sizeof (m_Identity); // destination
|
|
|
|
size += sizeof (m_Keys.pub); // destination
|
|
|
|
memcpy (buf + size, m_Pool->GetEncryptionPublicKey (), 256); |
|
|
|
memcpy (buf + size, m_Pool->GetEncryptionPublicKey (), 256); |
|
|
|
size += 256; // encryption key
|
|
|
|
size += 256; // encryption key
|
|
|
|
memset (buf + size, 0, 128); |
|
|
|
memset (buf + size, 0, 128); |
|
|
|