From 765c1079a83163d175b382ab9a2681a3a0012d07 Mon Sep 17 00:00:00 2001 From: shaoqi Date: Mon, 2 May 2016 02:37:32 +0800 Subject: [PATCH 1/2] Update Crypt.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix:当加密时没有设置失效时间,解密就会失败 --- extend/org/Crypt.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extend/org/Crypt.php b/extend/org/Crypt.php index 0832cd6..a9ab5a4 100644 --- a/extend/org/Crypt.php +++ b/extend/org/Crypt.php @@ -125,9 +125,12 @@ public static function decrypt($value, $key, $target = 'url') $expire = substr($value, self::HMAC_SIZE, self::EXPIRE_SIZE); $iv = substr($value, self::HMAC_SIZE + self::EXPIRE_SIZE, self::IV_SIZE); $value = substr($value, self::HMAC_SIZE + self::EXPIRE_SIZE + self::IV_SIZE); + $expire = hexdec(bin2hex($expire)); // 超出有效期 - if (time() > hexdec(bin2hex($expire))) { - return false; + if($expire!==0){ + if (time() > hexdec(bin2hex($expire))) { + return false; + } } // 验证密文是否被篡改 if (static::compareString(static::hmac($iv, $value, $key), bin2hex($hmac)) === false) { From a96ad2eb47f3725a3612e75fd184529f898c6a68 Mon Sep 17 00:00:00 2001 From: shaoqi Date: Mon, 2 May 2016 02:42:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix 语法错误,在高版本中静态调用提示错误。 --- extend/org/transform/driver/Base64.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extend/org/transform/driver/Base64.php b/extend/org/transform/driver/Base64.php index 85c67d7..b9a504d 100644 --- a/extend/org/transform/driver/Base64.php +++ b/extend/org/transform/driver/Base64.php @@ -32,7 +32,7 @@ class Base64 * @param string $data 欲编码的数据 * @param string $target 编码目标 */ - public function encode($data, $target = '') + public static function encode($data, $target = '') { // 当函数没有特别指定编码目标时, 使用类自身编码目标 if (empty($target)) { @@ -62,7 +62,7 @@ public function encode($data, $target = '') * @param string $data 欲解码的数据 * @param string $target 解码目标 */ - public function decode($data, $target = '') + public static function decode($data, $target = '') { // 当函数没有特别指定解码目标时, 使用类自身解码目标 if (empty($target)) {