Merge branch 'dev' of bvbej/base-php into master

This commit is contained in:
bvbej 2022-01-11 14:35:16 +08:00 committed by Gogs
commit f4794c584f

View File

@ -30,7 +30,7 @@ class BvBeJHandle
*/ */
public function AesEncrypt(string $data, string $key, string $vi): string|false 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 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,11 +110,7 @@ class BvBeJHandle
't' => $timestamp 't' => $timestamp
]); ]);
ksort($form); ksort($form);
$singArr = []; $sign = urlencode(http_build_query($form));
foreach ($form as $k => $v) {
$singArr[urlencode(strval($k))] = urlencode(strval($v));
}
$sign = http_build_query($singArr);
try { try {
$signature = $this->AesEncrypt($sign, $key, $vi); $signature = $this->AesEncrypt($sign, $key, $vi);
if ($signature === false) { if ($signature === false) {