Change encryption to use CTR instead of GCM

despite MCPE claiming to use GCM, it omits the auth tag, which defeats the whole point of using GCM.
CTR can be used instead, with the final 4 bytes of the IV being 0002.
This commit is contained in:
Dylan K. Taylor
2021-06-13 21:57:23 +01:00
parent 0df2677464
commit 04a6e89d6f
2 changed files with 30 additions and 7 deletions

View File

@@ -670,7 +670,7 @@ class NetworkSession{
}
$this->sendDataPacket(ServerToClientHandshakePacket::create($handshakeJwt), true); //make sure this gets sent before encryption is enabled
$this->cipher = new EncryptionContext($encryptionKey, EncryptionContext::ENCRYPTION_SCHEME);
$this->cipher = EncryptionContext::fakeGCM($encryptionKey);
$this->setHandler(new HandshakePacketHandler(function() : void{
$this->onServerLoginSuccess();