This commit is contained in:
Hankin 2026-04-24 17:47:13 +08:00
parent 82410e0f3d
commit 6a043fc827

View File

@ -184,11 +184,12 @@ class WechatPayService
$ciphertext = base64_decode($resource['ciphertext']); $ciphertext = base64_decode($resource['ciphertext']);
$nonce = $resource['nonce']; $nonce = $resource['nonce'];
$associatedData = $resource['associated_data'] ?? ''; $associatedData = $resource['associated_data'] ?? '';
$apiV3Key = config("wechatpay.payment.api3_key");
Log::info("解密数据", ["ciphertext" => $ciphertext, "apiV3Key" => $apiV3Key, "nonce" => $nonce, "associatedData" => $associatedData]);
// PHP 7.1+ 原生支持 AES-256-GCM // PHP 7.1+ 原生支持 AES-256-GCM
$decrypted = AesGcm::decrypt( $decrypted = AesGcm::decrypt(
$ciphertext, // Base64解码后的密文包含tag $ciphertext, // Base64解码后的密文包含tag
config("wechatpay.payment.api3_key"), $apiV3Key,
$nonce, $nonce,
$associatedData $associatedData
); );