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!
How to buy and sell Bitcoin on okex
What do full-width characters mean?
The main function of the arithmetic unit in a microcomputer is to perform
WeChat Moments, two dashes and one dot
How to use the print function in python
What are the calling methods of java reflection
How to solve operation timed out
Is Bitcoin legal in China?