PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
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)
static

Definition at line 75 of file EncryptionContext.php.

◆ decrypt()

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

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)
static

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.

Definition at line 67 of file EncryptionContext.php.

Member Data Documentation

◆ $ENABLED

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

Definition at line 37 of file EncryptionContext.php.


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