增加聚合支付托管下单
This commit is contained in:
@@ -18,15 +18,15 @@ use Yeepay\Yop\Sdk\Utils\Http\HttpUtils;
|
||||
class RsaSigner implements Signer
|
||||
{
|
||||
|
||||
private static $yopAuthVersion = 'yop-auth-v3';
|
||||
private static $yopAuthVersion = 'yop-auth-v3';
|
||||
|
||||
private static $defaultHeadersToSign;
|
||||
|
||||
private static $headerJoiner = "\n";
|
||||
private static $headerJoiner = "\n";
|
||||
|
||||
private static $signedHeaderStringJoiner = ';';
|
||||
|
||||
private $logger;
|
||||
private $logger;
|
||||
|
||||
public static function __init()
|
||||
{
|
||||
@@ -41,7 +41,6 @@ class RsaSigner implements Signer
|
||||
strtolower(Headers::YOP_CONTENT_SHA256),
|
||||
strtolower(Headers::YOP_HASH_CRC64ECMA),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
public function sign(Request $request, YopRsaCredentials $credentials = null, SignOptions $options = null)
|
||||
@@ -64,11 +63,11 @@ class RsaSigner implements Signer
|
||||
$signedHeaders = strtolower(trim(implode(self::$signedHeaderStringJoiner, array_keys($headersToSign))));
|
||||
|
||||
$authString = self::$yopAuthVersion.'/'.$accessKeyId.'/'.DateUtils::formatAlternateIso8601Date($timestamp).'/'
|
||||
.$options->getExpirationInSeconds();
|
||||
.$options->getExpirationInSeconds();
|
||||
|
||||
$canonicalURI = $this->getCanonicalURIPath($request->getResourcePath());
|
||||
$canonicalRequest = $authString.self::$headerJoiner.$request->getHttpMethod().self::$headerJoiner.$canonicalURI
|
||||
.self::$headerJoiner.$canonicalQueryString.self::$headerJoiner.$canonicalHeader;
|
||||
.self::$headerJoiner.$canonicalQueryString.self::$headerJoiner.$canonicalHeader;
|
||||
|
||||
$signature = $this->computeSignature($canonicalRequest, $credentials->getPrivateKey(),
|
||||
$options->getDigestAlg());
|
||||
@@ -138,8 +137,8 @@ class RsaSigner implements Signer
|
||||
$v = '';
|
||||
}
|
||||
$headerStrings[] = rawurlencode(
|
||||
strtolower(trim($k))
|
||||
).':'.rawurlencode(trim($v));
|
||||
strtolower(trim($k))
|
||||
).':'.rawurlencode(trim($v));
|
||||
}
|
||||
sort($headerStrings);
|
||||
|
||||
@@ -187,6 +186,8 @@ class RsaSigner implements Signer
|
||||
public function checkSignature(YopHttpResponse $httpResponse, $signature, $publicKey, SignOptions $options)
|
||||
{
|
||||
$content = $httpResponse->readContent();
|
||||
\Log::channel('yeepay')->info($content);
|
||||
|
||||
$content = str_replace([" ", "\n", "\t"], "", $content);
|
||||
if (openssl_verify($content, base64_decode($signature), $publicKey, $options->getDigestAlg()) == 1) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user