Skip to content

Commit

Permalink
[WeChatPay.V3] 修正微信支付公钥验签
Browse files Browse the repository at this point in the history
  • Loading branch information
roc916 committed Nov 4, 2024
1 parent 2e4976e commit 2409408
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Essensoft.Paylink.WeChatPay/V3/WeChatPayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private async Task CheckResponseSignAsync(WeChatPayHeaders headers, string body,
if (!string.IsNullOrEmpty(options.WeChatPayPublicKeyId) && headers.Serial == options.WeChatPayPublicKeyId)
{
var signSourceData = WeChatPayUtility.BuildSignatureSourceData(headers.Timestamp, headers.Nonce, body);
var signCheck = SHA256WithRSA.Verify(options.WeChatPayPublicKey, signSourceData, headers.Signature);
var signCheck = SHA256WithRSA.Verify(signSourceData, headers.Signature, options.WeChatPayPublicKey);
if (!signCheck)
{
throw new WeChatPayException("sign check fail: check Sign and Data Fail!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private async Task CheckNotifySignAsync(WeChatPayHeaders headers, string body, W
if (!string.IsNullOrEmpty(options.WeChatPayPublicKeyId) && headers.Serial == options.WeChatPayPublicKeyId)
{
var signSourceData = WeChatPayUtility.BuildSignatureSourceData(headers.Timestamp, headers.Nonce, body);
var signCheck = SHA256WithRSA.Verify(options.WeChatPayPublicKey, signSourceData, headers.Signature);
var signCheck = SHA256WithRSA.Verify(signSourceData, headers.Signature, options.WeChatPayPublicKey);
if (!signCheck)
{
throw new WeChatPayException("sign check fail: check Sign and Data Fail!");
Expand Down

0 comments on commit 2409408

Please sign in to comment.