diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 05dacf1..351ffc2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -29,9 +29,11 @@ jobs: nuget-version: '5.x' - name: 发布生成包到github和nuget run: | - nuget push ./src/WWB.Paylink.BaoFooPay/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} -NoSymbols + nuget push ./src/WWB.Paylink.BaoFooPay/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} nuget push ./src/WWB.Paylink.BaoFooPay/bin/Release/*.nupkg -Source github -SkipDuplicate - nuget push ./src/WWB.Paylink.BaoFooTransfer/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} -NoSymbols + nuget push ./src/WWB.Paylink.BaoFooTransfer/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} nuget push ./src/WWB.Paylink.BaoFooTransfer/bin/Release/*.nupkg -Source github -SkipDuplicate - nuget push ./src/WWB.Paylink.Utility/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} -NoSymbols + nuget push ./src/WWB.Paylink.Utility/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} nuget push ./src/WWB.Paylink.Utility/bin/Release/*.nupkg -Source github -SkipDuplicate + nuget push ./src/WWB.Paylink.JoinPay/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGETKEY }} + nuget push ./src/WWB.Paylink.JoinPay/bin/Release/*.nupkg -Source github -SkipDuplicate diff --git a/src/WWB.Paylink.BaoFooPay/BaoFooPayClient.cs b/src/WWB.Paylink.BaoFooPay/BaoFooPayClient.cs index 6ad8636..7adbd18 100644 --- a/src/WWB.Paylink.BaoFooPay/BaoFooPayClient.cs +++ b/src/WWB.Paylink.BaoFooPay/BaoFooPayClient.cs @@ -76,7 +76,7 @@ private static void CheckResponseSign(BaseResponse response, BaoFooPayOptions op var signContent = ToolHelper.GetSignContent(parameters, options.Key, Consts.SIGN); - if (!SignatureHelper.VerifySignature(options.CerCertificate, signContent, sign)) + if (!RSASignature.Verify(options.CerCertificate, signContent, sign)) { throw new BaoFooPayException("sign check fail: check Sign and Data Fail!"); } diff --git a/src/WWB.Paylink.BaoFooPay/BaoFooPayNotifyClient.cs b/src/WWB.Paylink.BaoFooPay/BaoFooPayNotifyClient.cs index 79784a7..dd57161 100644 --- a/src/WWB.Paylink.BaoFooPay/BaoFooPayNotifyClient.cs +++ b/src/WWB.Paylink.BaoFooPay/BaoFooPayNotifyClient.cs @@ -93,7 +93,7 @@ private static void CheckNotifySign(BaseNotify notify, BaoFooPayOptions options) var signContent = ToolHelper.GetSignContent(parameters, options.Key, Consts.SIGN); - if (!SignatureHelper.VerifySignature(options.CerCertificate, signContent, sign)) + if (!RSASignature.Verify(options.CerCertificate, signContent, sign)) { throw new BaoFooPayException("sign check fail: check Sign and Data Fail!"); } diff --git a/src/WWB.Paylink.BaoFooPay/Request/AbstractRequest.cs b/src/WWB.Paylink.BaoFooPay/Request/AbstractRequest.cs index 49e13fa..69df1c8 100644 --- a/src/WWB.Paylink.BaoFooPay/Request/AbstractRequest.cs +++ b/src/WWB.Paylink.BaoFooPay/Request/AbstractRequest.cs @@ -40,7 +40,7 @@ public IDictionary PrimaryHandler(T data, BaoFooPayOptions op }; var signContent = ToolHelper.GetSignContent(parameters, options.Key); - var sign = SignatureHelper.EncryptByRSA(signContent, options.PfxCertificate, options.Password); + var sign = RSASignature.Sign(signContent, options.PfxCertificate, options.Password); parameters.Add(Consts.SIGN, sign); diff --git a/src/WWB.Paylink.BaoFooPay/WWB.Paylink.BaoFooPay.csproj b/src/WWB.Paylink.BaoFooPay/WWB.Paylink.BaoFooPay.csproj index fbe67bd..ca556ed 100644 --- a/src/WWB.Paylink.BaoFooPay/WWB.Paylink.BaoFooPay.csproj +++ b/src/WWB.Paylink.BaoFooPay/WWB.Paylink.BaoFooPay.csproj @@ -3,7 +3,7 @@ netcoreapp3.1 WWB.Paylink.BaoFooPay - 1.0.1 + 1.0.2 my6521 惠收钱SDK。 MIT diff --git a/src/WWB.Paylink.BaoFooTransfer/BaoFooTransClient.cs b/src/WWB.Paylink.BaoFooTransfer/BaoFooTransClient.cs index f0eff62..68eae6d 100644 --- a/src/WWB.Paylink.BaoFooTransfer/BaoFooTransClient.cs +++ b/src/WWB.Paylink.BaoFooTransfer/BaoFooTransClient.cs @@ -35,7 +35,7 @@ public async Task ExecuteAsync(IBaoFooTransRequest request, BaoFooTrans var client = _httpClientFactory.CreateClient(Name); var (body, isSuccessStatusCode) = await client.PostAsync(url, contentType, txtParams); //解密 - var realContent = RSAHelper.DecryptByCer(body, options.CerCertificate); + var realContent = RSA.DecryptByCer(body, options.CerCertificate); //反序列化 var parser = new ResponseJsonParser(); var response = parser.Parse(realContent); diff --git a/src/WWB.Paylink.BaoFooTransfer/Notify/TransferNotify.cs b/src/WWB.Paylink.BaoFooTransfer/Notify/TransferNotify.cs index 052f4d2..b2fff96 100644 --- a/src/WWB.Paylink.BaoFooTransfer/Notify/TransferNotify.cs +++ b/src/WWB.Paylink.BaoFooTransfer/Notify/TransferNotify.cs @@ -52,7 +52,7 @@ internal override void Execute(BaoFooTransOptions options) if (string.IsNullOrWhiteSpace(DataContent)) return; //解密data_content - DataContent = RSAHelper.DecryptByCer(DataContent, options.CerCertificate); + DataContent = RSA.DecryptByCer(DataContent, options.CerCertificate); //xml反序列化 var serializer = new XmlSerializer(typeof(TransContent)); diff --git a/src/WWB.Paylink.BaoFooTransfer/Request/AbstractRequest.cs b/src/WWB.Paylink.BaoFooTransfer/Request/AbstractRequest.cs index 77d6b13..a75c1a8 100644 --- a/src/WWB.Paylink.BaoFooTransfer/Request/AbstractRequest.cs +++ b/src/WWB.Paylink.BaoFooTransfer/Request/AbstractRequest.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using Newtonsoft.Json; +using Newtonsoft.Json; +using System.Collections.Generic; using WWB.Paylink.BaoFooTransfer.Constants; using WWB.Paylink.Utility; using WWB.Paylink.Utility.Security; @@ -24,7 +24,7 @@ public IDictionary PrimaryHandler(T data, BaoFooTransOptions }; var encryptStr = JsonConvert.SerializeObject(data); - parameters.Add(Consts.SIGN_CONTENT, RSAHelper.EncryptByPfx(encryptStr, options.PfxCertificate, options.Password)); + parameters.Add(Consts.SIGN_CONTENT, RSA.EncryptByPfx(encryptStr, options.PfxCertificate, options.Password)); return parameters; } diff --git a/src/WWB.Paylink.BaoFooTransfer/WWB.Paylink.BaoFooTransfer.csproj b/src/WWB.Paylink.BaoFooTransfer/WWB.Paylink.BaoFooTransfer.csproj index 55d88aa..3a83bd2 100644 --- a/src/WWB.Paylink.BaoFooTransfer/WWB.Paylink.BaoFooTransfer.csproj +++ b/src/WWB.Paylink.BaoFooTransfer/WWB.Paylink.BaoFooTransfer.csproj @@ -5,7 +5,7 @@ disable enable WWB.Paylink.BaoFooTransfer - 1.0.1 + 1.0.2 my6521 宝付代付SDK。 MIT diff --git a/src/WWB.Paylink.JoinPay/WWB.Paylink.JoinPay.csproj b/src/WWB.Paylink.JoinPay/WWB.Paylink.JoinPay.csproj index 61b07e8..e95382a 100644 --- a/src/WWB.Paylink.JoinPay/WWB.Paylink.JoinPay.csproj +++ b/src/WWB.Paylink.JoinPay/WWB.Paylink.JoinPay.csproj @@ -3,7 +3,7 @@ netcoreapp3.1 WWB.Paylink.JoinPay - 1.0.0-preview01 + 1.0.2 my6521 汇聚支付SDK MIT diff --git a/src/WWB.Paylink.Utility/Security/CertificateHelper.cs b/src/WWB.Paylink.Utility/Security/CertificateHelper.cs index d39032e..a80dc10 100644 --- a/src/WWB.Paylink.Utility/Security/CertificateHelper.cs +++ b/src/WWB.Paylink.Utility/Security/CertificateHelper.cs @@ -9,12 +9,13 @@ namespace WWB.Paylink.Utility.Security { public static class CertificateHelper - {/// - /// 读取私钥 - /// - /// 证书路径 - /// 证书密码 - /// + { + /// + /// 读取私钥 + /// + /// 证书路径 + /// 证书密码 + /// public static AsymmetricKeyParameter GetPrivateKeyFromFile(string path, string pwd) { var passwd = pwd.ToCharArray(); diff --git a/src/WWB.Paylink.Utility/Security/RSAHelper.cs b/src/WWB.Paylink.Utility/Security/RSA.cs similarity index 99% rename from src/WWB.Paylink.Utility/Security/RSAHelper.cs rename to src/WWB.Paylink.Utility/Security/RSA.cs index 5b41393..171e41c 100644 --- a/src/WWB.Paylink.Utility/Security/RSAHelper.cs +++ b/src/WWB.Paylink.Utility/Security/RSA.cs @@ -7,7 +7,7 @@ namespace WWB.Paylink.Utility.Security { - public static class RSAHelper + public static class RSA { #region 加密 diff --git a/src/WWB.Paylink.Utility/Security/SignatureHelper.cs b/src/WWB.Paylink.Utility/Security/RSASignature.cs similarity index 85% rename from src/WWB.Paylink.Utility/Security/SignatureHelper.cs rename to src/WWB.Paylink.Utility/Security/RSASignature.cs index 71cc409..1e0c093 100644 --- a/src/WWB.Paylink.Utility/Security/SignatureHelper.cs +++ b/src/WWB.Paylink.Utility/Security/RSASignature.cs @@ -5,7 +5,7 @@ namespace WWB.Paylink.Utility.Security { - public static class SignatureHelper + public static class RSASignature { /// /// 公共方法验签 @@ -14,7 +14,7 @@ public static class SignatureHelper /// /// /// - public static bool VerifySignature(string pubCerPath, string encryptStr, string signature) + public static bool Verify(string pubCerPath, string encryptStr, string signature) { var publicKey = CertificateHelper.GetPublicKeyFromFile(pubCerPath); return Verify(Encoding.UTF8.GetBytes(encryptStr), publicKey, signature); @@ -27,10 +27,10 @@ public static bool VerifySignature(string pubCerPath, string encryptStr, string /// /// /// - public static string EncryptByRSA(string encryptStr, string pfxPath, string priKeyPass) + public static string Sign(string encryptStr, string pfxPath, string priKeyPass) { var privateKey = CertificateHelper.GetPrivateKeyFromFile(pfxPath, priKeyPass); - return Sing(Encoding.UTF8.GetBytes(encryptStr), privateKey); + return Sign(Encoding.UTF8.GetBytes(encryptStr), privateKey); } /// @@ -40,7 +40,7 @@ public static string EncryptByRSA(string encryptStr, string pfxPath, string priK /// /// /// - private static string Sing(byte[] data, ICipherParameters parameters) + private static string Sign(byte[] data, ICipherParameters parameters) { var signature = SignerUtilities.GetSigner("SHA256withRSA"); signature.Init(true, parameters); diff --git a/src/WWB.Paylink.Utility/WWB.Paylink.Utility.csproj b/src/WWB.Paylink.Utility/WWB.Paylink.Utility.csproj index 449ddbc..d9ba689 100644 --- a/src/WWB.Paylink.Utility/WWB.Paylink.Utility.csproj +++ b/src/WWB.Paylink.Utility/WWB.Paylink.Utility.csproj @@ -3,7 +3,7 @@ netstandard2.0 WWB.Paylink.Utility - 1.0.1 + 1.0.2 my6521 支付帮助类。 MIT