Rename NetworkCipher -> EncryptionContext

This commit is contained in:
Dylan K. Taylor 2020-06-18 11:37:53 +01:00
parent 82b3e3398b
commit edc3156bea
3 changed files with 7 additions and 7 deletions

View File

@ -51,7 +51,7 @@ use pocketmine\network\mcpe\compression\CompressBatchPromise;
use pocketmine\network\mcpe\compression\CompressBatchTask; use pocketmine\network\mcpe\compression\CompressBatchTask;
use pocketmine\network\mcpe\compression\Compressor; use pocketmine\network\mcpe\compression\Compressor;
use pocketmine\network\mcpe\compression\ZlibCompressor; use pocketmine\network\mcpe\compression\ZlibCompressor;
use pocketmine\network\mcpe\encryption\NetworkCipher; use pocketmine\network\mcpe\encryption\EncryptionContext;
use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\ClientboundPacket; use pocketmine\network\mcpe\protocol\ClientboundPacket;
use pocketmine\network\mcpe\protocol\ProtocolInfo; use pocketmine\network\mcpe\protocol\ProtocolInfo;
@ -880,7 +880,7 @@ class Server{
$this->networkCompressionAsync = (bool) $this->configGroup->getProperty("network.async-compression", true); $this->networkCompressionAsync = (bool) $this->configGroup->getProperty("network.async-compression", true);
NetworkCipher::$ENABLED = (bool) $this->configGroup->getProperty("network.enable-encryption", true); EncryptionContext::$ENABLED = (bool) $this->configGroup->getProperty("network.enable-encryption", true);
$this->doTitleTick = ((bool) $this->configGroup->getProperty("console.title-tick", true)) && Terminal::hasFormattingCodes(); $this->doTitleTick = ((bool) $this->configGroup->getProperty("console.title-tick", true)) && Terminal::hasFormattingCodes();

View File

@ -42,7 +42,7 @@ use pocketmine\network\mcpe\compression\DecompressionException;
use pocketmine\network\mcpe\convert\SkinAdapterSingleton; use pocketmine\network\mcpe\convert\SkinAdapterSingleton;
use pocketmine\network\mcpe\convert\TypeConverter; use pocketmine\network\mcpe\convert\TypeConverter;
use pocketmine\network\mcpe\encryption\DecryptionException; use pocketmine\network\mcpe\encryption\DecryptionException;
use pocketmine\network\mcpe\encryption\NetworkCipher; use pocketmine\network\mcpe\encryption\EncryptionContext;
use pocketmine\network\mcpe\encryption\PrepareEncryptionTask; use pocketmine\network\mcpe\encryption\PrepareEncryptionTask;
use pocketmine\network\mcpe\handler\DeathPacketHandler; use pocketmine\network\mcpe\handler\DeathPacketHandler;
use pocketmine\network\mcpe\handler\HandshakePacketHandler; use pocketmine\network\mcpe\handler\HandshakePacketHandler;
@ -148,7 +148,7 @@ class NetworkSession{
/** @var int */ /** @var int */
private $connectTime; private $connectTime;
/** @var NetworkCipher */ /** @var EncryptionContext */
private $cipher; private $cipher;
/** @var PacketBatch|null */ /** @var PacketBatch|null */
@ -588,14 +588,14 @@ class NetworkSession{
$this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO")); $this->logger->debug("Xbox Live authenticated: " . ($this->authenticated ? "YES" : "NO"));
if($this->manager->kickDuplicates($this)){ if($this->manager->kickDuplicates($this)){
if(NetworkCipher::$ENABLED){ if(EncryptionContext::$ENABLED){
$this->server->getAsyncPool()->submitTask(new PrepareEncryptionTask($clientPubKey, function(string $encryptionKey, string $handshakeJwt) : void{ $this->server->getAsyncPool()->submitTask(new PrepareEncryptionTask($clientPubKey, function(string $encryptionKey, string $handshakeJwt) : void{
if(!$this->connected){ if(!$this->connected){
return; return;
} }
$this->sendDataPacket(ServerToClientHandshakePacket::create($handshakeJwt), true); //make sure this gets sent before encryption is enabled $this->sendDataPacket(ServerToClientHandshakePacket::create($handshakeJwt), true); //make sure this gets sent before encryption is enabled
$this->cipher = new NetworkCipher($encryptionKey); $this->cipher = new EncryptionContext($encryptionKey);
$this->setHandler(new HandshakePacketHandler(function() : void{ $this->setHandler(new HandshakePacketHandler(function() : void{
$this->onLoginSuccess(); $this->onLoginSuccess();

View File

@ -30,7 +30,7 @@ use function openssl_digest;
use function strlen; use function strlen;
use function substr; use function substr;
class NetworkCipher{ class EncryptionContext{
private const ENCRYPTION_SCHEME = "AES-256-CFB8"; private const ENCRYPTION_SCHEME = "AES-256-CFB8";
private const CHECKSUM_ALGO = "sha256"; private const CHECKSUM_ALGO = "sha256";