Skip to content

EncryptionContext ​

class · pocketmine\network\mcpe\encryption\EncryptionContext · source

Properties ​

$ENABLED ​

php
public static bool $ENABLED

Methods ​

__construct() ​

php
public function __construct(string $encryptionKey, string $algorithm, string $iv)

cfb8() ​

php
public static function cfb8(string $encryptionKey) : self

decrypt() ​

php
public function decrypt(string $encrypted) : string

encrypt() ​

php
public function encrypt(string $payload) : string

fakeGCM() ​

php
public static function fakeGCM(string $encryptionKey) : self

Returns 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.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.