mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-29 22:59:59 +00:00
EncryptionContext: provide the packet ID in the exception message
This commit is contained in:
parent
6a266bcbd1
commit
e23379c34b
@ -75,8 +75,10 @@ class EncryptionContext{
|
|||||||
$decrypted = $this->decryptCipher->decryptUpdate($encrypted);
|
$decrypted = $this->decryptCipher->decryptUpdate($encrypted);
|
||||||
$payload = substr($decrypted, 0, -8);
|
$payload = substr($decrypted, 0, -8);
|
||||||
|
|
||||||
if(($expected = $this->calculateChecksum($this->decryptCounter++, $payload)) !== ($actual = substr($decrypted, -8))){
|
$packetCounter = $this->decryptCounter++;
|
||||||
throw new DecryptionException("Encrypted payload has invalid checksum (expected " . bin2hex($expected) . ", got " . bin2hex($actual) . ")");
|
|
||||||
|
if(($expected = $this->calculateChecksum($packetCounter, $payload)) !== ($actual = substr($decrypted, -8))){
|
||||||
|
throw new DecryptionException("Encrypted packet $packetCounter has invalid checksum (expected " . bin2hex($expected) . ", got " . bin2hex($actual) . ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $payload;
|
return $payload;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user