mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-16 11:58:00 +00:00
PrepareEncryptionTask: verify client key before entering task
this ensures that whoever's giving invalid keys to the task gets properly blamed
This commit is contained in:
@@ -51,6 +51,9 @@ class PrepareEncryptionTask extends AsyncTask{
|
||||
private string $clientPub,
|
||||
\Closure $onCompletion
|
||||
){
|
||||
//make sure the key is valid before we break the stack trace
|
||||
//TODO: maybe in the future we should require OpenSSLAsymmetricKey here instead of string
|
||||
JwtUtils::parseDerPublicKey($this->clientPub);
|
||||
if(self::$SERVER_PRIVATE_KEY === null){
|
||||
$serverPrivateKey = openssl_pkey_new(["ec" => ["curve_name" => "secp384r1"]]);
|
||||
if($serverPrivateKey === false){
|
||||
|
Reference in New Issue
Block a user