mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Move PHP minimum to 8.0
This commit is contained in:
@ -40,13 +40,7 @@ final class EncryptionUtils{
|
||||
//NOOP
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $localPriv
|
||||
* @param \OpenSSLAsymmetricKey|resource $remotePub
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $localPriv
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $remotePub
|
||||
*/
|
||||
public static function generateSharedSecret($localPriv, $remotePub) : \GMP{
|
||||
public static function generateSharedSecret(\OpenSSLAsymmetricKey $localPriv, \OpenSSLAsymmetricKey $remotePub) : \GMP{
|
||||
$hexSecret = openssl_pkey_derive($remotePub, $localPriv, 48);
|
||||
if($hexSecret === false){
|
||||
throw new \InvalidArgumentException("Failed to derive shared secret: " . openssl_error_string());
|
||||
@ -58,11 +52,7 @@ final class EncryptionUtils{
|
||||
return openssl_digest($salt . hex2bin(str_pad(gmp_strval($secret, 16), 96, "0", STR_PAD_LEFT)), 'sha256', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OpenSSLAsymmetricKey|resource $serverPriv
|
||||
* @phpstan-param PhpOpenSSLAsymmetricKey $serverPriv
|
||||
*/
|
||||
public static function generateServerHandshakeJwt($serverPriv, string $salt) : string{
|
||||
public static function generateServerHandshakeJwt(\OpenSSLAsymmetricKey $serverPriv, string $salt) : string{
|
||||
$derPublicKey = JwtUtils::emitDerPublicKey($serverPriv);
|
||||
return JwtUtils::create(
|
||||
[
|
||||
|
@ -38,11 +38,7 @@ class PrepareEncryptionTask extends AsyncTask{
|
||||
|
||||
private const TLS_KEY_ON_COMPLETION = "completion";
|
||||
|
||||
/**
|
||||
* @var \OpenSSLAsymmetricKey|resource|null
|
||||
* @phpstan-var PhpOpenSSLAsymmetricKey|null
|
||||
*/
|
||||
private static $SERVER_PRIVATE_KEY = null;
|
||||
private static ?\OpenSSLAsymmetricKey $SERVER_PRIVATE_KEY = null;
|
||||
|
||||
/** @var string */
|
||||
private $serverPrivateKey;
|
||||
|
Reference in New Issue
Block a user