Move PHP minimum to 8.0

This commit is contained in:
Dylan K. Taylor
2021-07-26 20:29:39 +01:00
parent 09eac0e129
commit 2b5667a56b
15 changed files with 37 additions and 171 deletions

View File

@ -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(
[

View File

@ -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;