mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-30 08:51:50 +00:00
skip transient signature verification if verified through ECIESx25519 session
This commit is contained in:
parent
9efdc230a9
commit
75dd0d72c6
@ -444,25 +444,42 @@ namespace stream
|
|||||||
LogPrint (eLogInfo, "Streaming: offline signature without identity");
|
LogPrint (eLogInfo, "Streaming: offline signature without identity");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if we have it in LeaseSet already we don't need to parse it again
|
if (sessionVerified)
|
||||||
if (m_RemoteLeaseSet) m_TransientVerifier = m_RemoteLeaseSet->GetTransientVerifier ();
|
|
||||||
if (m_TransientVerifier)
|
|
||||||
{
|
{
|
||||||
// skip option data
|
// skip offline signature
|
||||||
optionData += 6; // timestamp and key type
|
optionData += 4; // timestamp
|
||||||
optionData += m_TransientVerifier->GetPublicKeyLen (); // public key
|
uint16_t keyType = bufbe16toh (optionData); optionData += 2; // key type
|
||||||
|
std::unique_ptr<i2p::crypto::Verifier> transientVerifier (i2p::data::IdentityEx::CreateVerifier (keyType));
|
||||||
|
if (!transientVerifier)
|
||||||
|
{
|
||||||
|
LogPrint (eLogInfo, "Streaming: Unknown offline signature key type ", (int)keyType);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
optionData += transientVerifier->GetPublicKeyLen (); // public key
|
||||||
optionData += m_RemoteIdentity->GetSignatureLen (); // signature
|
optionData += m_RemoteIdentity->GetSignatureLen (); // signature
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// transient key
|
// if we have it in LeaseSet already we don't need to parse it again
|
||||||
size_t offset = 0;
|
if (m_RemoteLeaseSet) m_TransientVerifier = m_RemoteLeaseSet->GetTransientVerifier ();
|
||||||
m_TransientVerifier = i2p::data::ProcessOfflineSignature (m_RemoteIdentity, optionData, optionSize - (optionData - packet->GetOptionData ()), offset);
|
if (m_TransientVerifier)
|
||||||
optionData += offset;
|
|
||||||
if (!m_TransientVerifier)
|
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "Streaming: offline signature failed");
|
// skip option data
|
||||||
return false;
|
optionData += 6; // timestamp and key type
|
||||||
|
optionData += m_TransientVerifier->GetPublicKeyLen (); // public key
|
||||||
|
optionData += m_RemoteIdentity->GetSignatureLen (); // signature
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// transient key
|
||||||
|
size_t offset = 0;
|
||||||
|
m_TransientVerifier = i2p::data::ProcessOfflineSignature (m_RemoteIdentity, optionData, optionSize - (optionData - packet->GetOptionData ()), offset);
|
||||||
|
optionData += offset;
|
||||||
|
if (!m_TransientVerifier)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Streaming: offline signature failed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user