From 794e991b5e3c5600b876a368ff6fb4a41b11dd18 Mon Sep 17 00:00:00 2001 From: bvbej Date: Tue, 11 Jan 2022 14:23:49 +0800 Subject: [PATCH 1/2] [edit] $form --- src/Handles/BvBeJHandle.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Handles/BvBeJHandle.php b/src/Handles/BvBeJHandle.php index 34b1b71..8d95527 100644 --- a/src/Handles/BvBeJHandle.php +++ b/src/Handles/BvBeJHandle.php @@ -110,11 +110,7 @@ class BvBeJHandle 't' => $timestamp ]); ksort($form); - $singArr = []; - foreach ($form as $k => $v) { - $singArr[urlencode(strval($k))] = urlencode(strval($v)); - } - $sign = http_build_query($singArr); + $sign = http_build_query($form); try { $signature = $this->AesEncrypt($sign, $key, $vi); if ($signature === false) { From d97988aae3732ce3cdfb67b83f0b39efb37cc5c9 Mon Sep 17 00:00:00 2001 From: bvbej Date: Tue, 11 Jan 2022 14:34:56 +0800 Subject: [PATCH 2/2] [edit] AesDecrypt --- src/Handles/BvBeJHandle.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Handles/BvBeJHandle.php b/src/Handles/BvBeJHandle.php index 8d95527..d168daa 100644 --- a/src/Handles/BvBeJHandle.php +++ b/src/Handles/BvBeJHandle.php @@ -30,7 +30,7 @@ class BvBeJHandle */ public function AesEncrypt(string $data, string $key, string $vi): string|false { - return $this->Base64UrlEncode(openssl_encrypt($data, 'AES-128-CBC', $key, OPENSSL_CIPHER_AES_128_CBC, $vi)); + return openssl_encrypt($data, 'AES-128-CBC', $key, OPENSSL_CIPHER_AES_128_CBC, $vi); } /** @@ -42,7 +42,7 @@ class BvBeJHandle */ public function AesDecrypt(string $data, string $key, string $vi): string|false { - return openssl_decrypt($this->Base64UrlDecode($data), 'AES-128-CBC', $key, OPENSSL_CIPHER_AES_128_CBC, $vi); + return openssl_decrypt($data, 'AES-128-CBC', $key, OPENSSL_CIPHER_AES_128_CBC, $vi); } /** @@ -110,7 +110,7 @@ class BvBeJHandle 't' => $timestamp ]); ksort($form); - $sign = http_build_query($form); + $sign = urlencode(http_build_query($form)); try { $signature = $this->AesEncrypt($sign, $key, $vi); if ($signature === false) {