mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-03 16:14:15 +00:00
check if destination keys are correct
This commit is contained in:
parent
9aa9a62ed4
commit
69804c23f1
6
BOB.cpp
6
BOB.cpp
@ -430,8 +430,10 @@ namespace client
|
|||||||
void BOBCommandSession::SetkeysCommandHandler (const char * operand, size_t len)
|
void BOBCommandSession::SetkeysCommandHandler (const char * operand, size_t len)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "BOB: setkeys ", operand);
|
LogPrint (eLogDebug, "BOB: setkeys ", operand);
|
||||||
m_Keys.FromBase64 (operand);
|
if (m_Keys.FromBase64 (operand))
|
||||||
SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ());
|
SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ());
|
||||||
|
else
|
||||||
|
SendReplyError ("invalid keys");
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOBCommandSession::GetkeysCommandHandler (const char * operand, size_t len)
|
void BOBCommandSession::GetkeysCommandHandler (const char * operand, size_t len)
|
||||||
|
@ -455,8 +455,9 @@ namespace data
|
|||||||
|
|
||||||
size_t PrivateKeys::FromBuffer (const uint8_t * buf, size_t len)
|
size_t PrivateKeys::FromBuffer (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
m_Public = std::make_shared<IdentityEx>(buf, len);
|
m_Public = std::make_shared<IdentityEx>();
|
||||||
size_t ret = m_Public->GetFullLen ();
|
size_t ret = m_Public->FromBuffer (buf, len);
|
||||||
|
if (!ret || ret + 256 > len) return 0; // overflow
|
||||||
memcpy (m_PrivateKey, buf + ret, 256); // private key always 256
|
memcpy (m_PrivateKey, buf + ret, 256); // private key always 256
|
||||||
ret += 256;
|
ret += 256;
|
||||||
size_t signingPrivateKeySize = m_Public->GetSigningPrivateKeyLen ();
|
size_t signingPrivateKeySize = m_Public->GetSigningPrivateKeyLen ();
|
||||||
|
2
SAM.cpp
2
SAM.cpp
@ -875,7 +875,7 @@ namespace client
|
|||||||
if (destination != "")
|
if (destination != "")
|
||||||
{
|
{
|
||||||
i2p::data::PrivateKeys keys;
|
i2p::data::PrivateKeys keys;
|
||||||
keys.FromBase64 (destination);
|
if (!keys.FromBase64 (destination)) return nullptr;
|
||||||
localDestination = i2p::client::context.CreateNewLocalDestination (keys, true, params);
|
localDestination = i2p::client::context.CreateNewLocalDestination (keys, true, params);
|
||||||
}
|
}
|
||||||
else // transient
|
else // transient
|
||||||
|
Loading…
x
Reference in New Issue
Block a user