From ab70eb2fa40be5a18e5800fb30c7da1aabc4fef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Sat, 12 Sep 2020 01:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Jwt/Jwt.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/System/Jwt/Jwt.php b/System/Jwt/Jwt.php index 37cb64c4..b0231474 100644 --- a/System/Jwt/Jwt.php +++ b/System/Jwt/Jwt.php @@ -26,6 +26,8 @@ class Jwt extends Component private $timeout = 7200; + private $key = 'www.xshucai.com'; + private $public = '-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6BuML3gtLGde7QKNuNST UCB9gdHC7XIpOc7Wx2I64Esj3UxWHTgp3URj0ge8zpy7A3FfBdppR7d1nwoD6Xad @@ -95,6 +97,14 @@ mlAZUEjsoaT9vjvjGTxl3uCm0TX5KTgtSJIt2kA1tYVjQef+/iZTHxY= $this->timeout = $timeout; } + /** + * @param $timeout + */ + public function setKey(string $timeout) + { + $this->key = $timeout; + } + /** * @param string $privateKey */ @@ -291,7 +301,7 @@ mlAZUEjsoaT9vjvjGTxl3uCm0TX5KTgtSJIt2kA1tYVjQef+/iZTHxY= $_user = str_split(md5($user . md5($user))); ksort($_user); foreach ($_user as $key => $val) { - $str .= md5(sha1($key . $val . 'www.xshucai.com')); + $str .= md5(sha1($key . $val . $this->key)); } foreach ($param as $key => $val) { $str .= md5($str . sha1($key . md5($val)));