mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-12-29 09:54:44 +08:00
fix(wxapi): 修复某些场景下生成签名错误
This commit is contained in:
@@ -286,7 +286,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
if (callbackNonce == null) throw new ArgumentNullException(nameof(callbackNonce));
|
||||
if (callbackSignature == null) throw new ArgumentNullException(nameof(callbackSignature));
|
||||
|
||||
ISet<string> set = new SortedSet<string>() { client.Credentials.PushToken!, callbackTimestamp, callbackNonce };
|
||||
ISet<string> set = new SortedSet<string>(StringComparer.Ordinal) { client.Credentials.PushToken!, callbackTimestamp, callbackNonce };
|
||||
string sign = Security.SHA1Utility.Hash(string.Concat(set));
|
||||
return string.Equals(sign, callbackSignature, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
string nonce = Guid.NewGuid().ToString("N");
|
||||
string cardType = "INVOICE";
|
||||
|
||||
SortedSet<string> sortedParams = new SortedSet<string>();
|
||||
ISet<string> sortedParams = new SortedSet<string>(StringComparer.Ordinal);
|
||||
sortedParams.Add(cardType);
|
||||
sortedParams.Add(timestamp);
|
||||
sortedParams.Add(client.Credentials.AppId);
|
||||
|
||||
@@ -231,7 +231,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Utilities
|
||||
if (sNonce == null) throw new ArgumentNullException(nameof(sNonce));
|
||||
if (sMsgEncrypt == null) throw new ArgumentNullException(nameof(sMsgEncrypt));
|
||||
|
||||
ISet<string> set = new SortedSet<string>();
|
||||
ISet<string> set = new SortedSet<string>(StringComparer.Ordinal);
|
||||
set.Add(sToken);
|
||||
set.Add(sTimestamp);
|
||||
set.Add(sNonce);
|
||||
|
||||
Reference in New Issue
Block a user