PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\network\mcpe\encryption\EncryptionContext Class Reference
+ Collaboration diagram for pocketmine\network\mcpe\encryption\EncryptionContext:

Public Member Functions

 __construct (string $encryptionKey, string $algorithm, string $iv)
 decrypt (string $encrypted)
 encrypt (string $payload)

Static Public Member Functions

static cfb8 (string $encryptionKey)
static fakeGCM (string $encryptionKey)

Static Public Attributes

static bool $ENABLED = true

Detailed Description

Definition at line 34 of file EncryptionContext.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\network\mcpe\encryption\EncryptionContext::__construct ( string  $encryptionKey,
string  $algorithm,
string  $iv 

Definition at line 47 of file EncryptionContext.php.

Member Function Documentation

◆ cfb8()

static pocketmine\network\mcpe\encryption\EncryptionContext::cfb8 ( string  $encryptionKey)

Definition at line 75 of file EncryptionContext.php.

◆ decrypt()

pocketmine\network\mcpe\encryption\EncryptionContext::decrypt ( string  $encrypted)

Definition at line 86 of file EncryptionContext.php.

◆ encrypt()

pocketmine\network\mcpe\encryption\EncryptionContext::encrypt ( string  $payload)

Definition at line 102 of file EncryptionContext.php.

◆ fakeGCM()

static pocketmine\network\mcpe\encryption\EncryptionContext::fakeGCM ( string  $encryptionKey)

Returns an EncryptionContext suitable for decrypting Minecraft packets from (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.

Definition at line 67 of file EncryptionContext.php.

Member Data Documentation


bool pocketmine\network\mcpe\encryption\EncryptionContext::$ENABLED = true

Definition at line 37 of file EncryptionContext.php.

The documentation for this class was generated from the following file: