revert(pay): 恢复排除sign_type字段(彩虹易支付标准签名规则)\n\n- 测试包含sign_type后仍失败,改回排除sign_type(文档明确要求)\n- 密钥更新:商户公钥已更新为与新私钥匹配\n- 诊断结果:商户私钥与商户公钥匹配,但与平台公钥不匹配\n- 用户需在支付平台后台核对公钥

This commit is contained in:
ypsdf1
2026-07-15 00:26:42 +08:00
parent efcc0be26a
commit a4d6a5d487
+2 -2
View File
@@ -145,12 +145,12 @@ function opensslLoadKey($pem, $isPrivate) {
}
/**
* RSA(SHA256withRSA) 请求签名:取全部非空参数 → 剔除 sign → 参数名 ASCII 升序 → 原始值 k=v& 拼接 → 私钥签名
* RSA(SHA256withRSA) 请求签名:取全部非空参数 → 剔除 sign/sign_type → 参数名 ASCII 升序 → 原始值 k=v& 拼接 → 私钥签名
*/
function buildSign($params, $privateKeyPem) {
$filtered = [];
foreach ($params as $k => $v) {
if ($k === 'sign') continue; // 只跳过sign字段,保留sign_type
if ($k === 'sign' || $k === 'sign_type') continue;
if ($v === '' || $v === null) continue;
$filtered[$k] = $v;
}