|
@@ -37,18 +37,14 @@ function rsaVerify($data, $ali_public_key_path, $sign)
|
|
|
Log::record("pub key path={$ali_public_key_path}",Log::DEBUG);
|
|
|
|
|
|
$pubKey = file_get_contents($ali_public_key_path);
|
|
|
- try{
|
|
|
- $res = openssl_get_publickey($pubKey);
|
|
|
- } catch(Exception $e){
|
|
|
- $msg = $e->getMessage();
|
|
|
- }
|
|
|
- Log::record("sign={$sign}",Log::DEBUG);
|
|
|
-
|
|
|
+ $res = openssl_get_publickey($pubKey);
|
|
|
$sign = urldecode($sign);
|
|
|
$sign = base64_decode($sign);
|
|
|
$result = (bool)openssl_verify($data, $sign, $res);
|
|
|
- $err = openssl_error_string();
|
|
|
- Log::record("openssl last error={$err}",Log::DEBUG);
|
|
|
+ if($result == false) {
|
|
|
+ $err = openssl_error_string();
|
|
|
+ Log::record("openssl last error={$err}",Log::DEBUG);
|
|
|
+ }
|
|
|
openssl_free_key($res);
|
|
|
return $result;
|
|
|
}
|