diff --git a/src/Lib/Encrypt/DSA.php b/src/Lib/Encrypt/DSA.php index bb6d572..41ae93f 100644 --- a/src/Lib/Encrypt/DSA.php +++ b/src/Lib/Encrypt/DSA.php @@ -22,7 +22,7 @@ public static function signPrivateFromFile($data, $fileName) throw new \Exception('私钥文件格式错误'); } openssl_sign($data, $sign, $res, OPENSSL_ALGO_DSS1); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); } @@ -47,7 +47,7 @@ public static function verifyPublicFromFile($data, $fileName, $sign) throw new \Exception('公钥文件格式错误'); } $result = openssl_verify($data, $sign, $res, OPENSSL_ALGO_DSS1); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); } diff --git a/src/Lib/Encrypt/RSA.php b/src/Lib/Encrypt/RSA.php index 7189d68..6b36303 100644 --- a/src/Lib/Encrypt/RSA.php +++ b/src/Lib/Encrypt/RSA.php @@ -22,7 +22,7 @@ public static function signPrivateFromFile($data, $fileName) throw new \Exception('私钥文件格式错误'); } openssl_sign($data, $sign, $res, \OPENSSL_ALGO_SHA1); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); } @@ -47,7 +47,7 @@ public static function verifyPublicFromFile($data, $fileName, $sign) throw new \Exception('公钥文件格式错误'); } $result = openssl_verify($data, $sign, $res, \OPENSSL_ALGO_SHA1); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); } @@ -63,7 +63,7 @@ public static function encryptPublicFromFile($data, $fileName) throw new \Exception('公钥文件格式错误'); } openssl_public_encrypt($data, $result, $res, \OPENSSL_PKCS1_OAEP_PADDING); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); } diff --git a/src/Lib/Encrypt/RSA2.php b/src/Lib/Encrypt/RSA2.php index c4ee5fd..24d3832 100644 --- a/src/Lib/Encrypt/RSA2.php +++ b/src/Lib/Encrypt/RSA2.php @@ -30,7 +30,7 @@ public static function signPrivateFromFile($data, $fileName) throw new \Exception('私钥文件格式错误'); } openssl_sign($data, $sign, $res, \OPENSSL_ALGO_SHA256); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); } @@ -63,7 +63,7 @@ public static function verifyPublicFromFile($data, $fileName, $sign) throw new \Exception('公钥文件格式错误'); } $result = openssl_verify($data, $sign, $res, \OPENSSL_ALGO_SHA256); - if (PHP_VERSION_ID >= 80000) + if (PHP_VERSION_ID < 80000) { openssl_free_key($res); }