mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Fix a bug in message signature
This commit is contained in:
parent
bf3acb9cad
commit
34277e3fbd
2 changed files with 15 additions and 2 deletions
|
|
@ -46,6 +46,7 @@ namespace MinecraftClient.Protocol
|
|||
Gamemode = gamemode;
|
||||
Ping = ping;
|
||||
DisplayName = displayName;
|
||||
lastMessageVerified = false;
|
||||
if (timeStamp != null && publicKey != null && signature != null)
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds((long)timeStamp);
|
||||
|
|
@ -53,13 +54,13 @@ namespace MinecraftClient.Protocol
|
|||
try
|
||||
{
|
||||
PublicKey = new PublicKey(publicKey, signature);
|
||||
lastMessageVerified = true;
|
||||
}
|
||||
catch (System.Security.Cryptography.CryptographicException)
|
||||
{
|
||||
PublicKey = null;
|
||||
}
|
||||
}
|
||||
lastMessageVerified = true;
|
||||
precedingSignature = null;
|
||||
}
|
||||
|
||||
|
|
@ -121,9 +122,15 @@ namespace MinecraftClient.Protocol
|
|||
if (this.lastMessageVerified == false)
|
||||
return false;
|
||||
if (PublicKey == null || IsKeyExpired() || (this.precedingSignature != null && precedingSignature == null))
|
||||
{
|
||||
this.lastMessageVerified = false;
|
||||
return false;
|
||||
}
|
||||
if (this.precedingSignature != null && !this.precedingSignature.SequenceEqual(precedingSignature!))
|
||||
{
|
||||
this.lastMessageVerified = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
DateTimeOffset timeOffset = DateTimeOffset.FromUnixTimeMilliseconds(timestamp);
|
||||
|
||||
|
|
@ -150,9 +157,15 @@ namespace MinecraftClient.Protocol
|
|||
if (this.lastMessageVerified == false)
|
||||
return false;
|
||||
if (PublicKey == null || IsKeyExpired() || (this.precedingSignature != null && precedingSignature == null))
|
||||
{
|
||||
this.lastMessageVerified = false;
|
||||
return false;
|
||||
}
|
||||
if (this.precedingSignature != null && !this.precedingSignature.SequenceEqual(precedingSignature!))
|
||||
{
|
||||
this.lastMessageVerified = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = PublicKey.VerifyHeader(Uuid, ref bodyDigest, ref headerSignature, ref precedingSignature);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue