Alipay service window php demo reports error Warning: openssl_sign() [function.openssl...

Empty
Release: 2023-03-15 14:48:02
Original
1621 people have browsed it

Recently I worked on the Alipay service window for a customer and encountered an error:

Warning: openssl_sign() [function.openssl-sign]: Unknown signature algorithm. in

After checking, I found that the PHP environment on my server supports openssl_sign() but does not support parameters such as OPENSSL_ALGO_SHA256. After asking the boss, I found that this parameter is only supported in php5.4.8 or above, and lower versions are I used SHA256, so I tried it and got it!

The reason for the error is that the AopClient.php file in Alipay's demo uses such a statement:

if ("RSA2" == $signType) {

openssl_sign($data, $sign, $res,OPENSSL_ALGO_SHA256);

} else {

openssl_sign($data, $sign, $ res);

}

The solution is to change OPENSSL_ALGO_SHA256 to SHA256


if ( "RSA2" == $signType) {

openssl_sign($data, $sign, $res,SHA256);

} else {

openssl_sign($data, $sign, $res);

}

Note: There are three places in this file, all must be modified!


The above is the detailed content of Alipay service window php demo reports error Warning: openssl_sign() [function.openssl.... For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!