mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Merge branch 'master' of https://github.com/BruceChenQAQ/Minecraft-Console-Client-1.19dev
This commit is contained in:
commit
206a5f1e72
11 changed files with 530 additions and 85 deletions
|
|
@ -602,7 +602,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
bool lastVerifyResult = player.IsMessageChainLegal();
|
||||
verifyResult = player.VerifyMessageHead(ref precedingSignature, ref headerSignature, ref bodyDigest);
|
||||
if (lastVerifyResult && !verifyResult)
|
||||
log.Warn("Player " + player.Name + "'s message chain is broken!");
|
||||
log.Warn(Translations.Get("chat.message_chain_broken", player.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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