EncryptionContext
Properties
$ENABLED
php
public static bool $ENABLEDMethods
__construct()
php
public function __construct(string $encryptionKey, string $algorithm, string $iv)cfb8()
php
public static function cfb8(string $encryptionKey) : selfdecrypt()
php
public function decrypt(string $encrypted) : stringencrypt()
php
public function encrypt(string $payload) : stringfakeGCM()
php
public static function fakeGCM(string $encryptionKey) : selfReturns an EncryptionContext suitable for decrypting Minecraft packets from 1.16.220.50 (protocol version 429) and up.
MCPE uses GCM, but without the auth tag, which defeats the whole purpose of using GCM. GCM is just a wrapper around CTR which adds the auth tag, so CTR can replace GCM for this case. However, since GCM passes only the first 12 bytes of the IV followed by 0002, we must do the same for compatibility with MCPE. In PM, we could skip this and just use GCM directly (since we use OpenSSL), but this way is more portable, and better for developers who come digging in the PM code looking for answers.
