mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 09:26:06 +00:00
VerifyLoginTask: fast-fail by checking header x5u before verifying signature
this is less costly, although it doesn't make any difference except in invalid cases.
This commit is contained in:
@ -115,6 +115,9 @@ class VerifyLoginTask extends AsyncTask{
|
|||||||
|
|
||||||
//First link, check that it is self-signed
|
//First link, check that it is self-signed
|
||||||
$currentPublicKey = $headers["x5u"];
|
$currentPublicKey = $headers["x5u"];
|
||||||
|
}elseif($headers["x5u"] !== $currentPublicKey){
|
||||||
|
//Fast path: if the header key doesn't match what we expected, the signature isn't going to validate anyway
|
||||||
|
throw new VerifyLoginException("%pocketmine.disconnect.invalidSession.badSignature");
|
||||||
}
|
}
|
||||||
|
|
||||||
$plainSignature = base64_decode(strtr($sigB64, '-_', '+/'), true);
|
$plainSignature = base64_decode(strtr($sigB64, '-_', '+/'), true);
|
||||||
|
Reference in New Issue
Block a user