Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
my6521 committed Sep 14, 2023
1 parent 46ff5a3 commit 6fc051e
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 27 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/WWB.Paylink.BaoFooPay/BaoFooPayClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.BaoFooPay/BaoFooPayNotifyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.BaoFooPay/Request/AbstractRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public IDictionary<string, string> PrimaryHandler<T>(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);

Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.BaoFooPay/WWB.Paylink.BaoFooPay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageId>WWB.Paylink.BaoFooPay</PackageId>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<Authors>my6521</Authors>
<Description>惠收钱SDK。</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.BaoFooTransfer/BaoFooTransClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task<T> ExecuteAsync<T>(IBaoFooTransRequest<T> 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<T>();
var response = parser.Parse(realContent);
Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.BaoFooTransfer/Notify/TransferNotify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TransNotifyData>));
Expand Down
6 changes: 3 additions & 3 deletions src/WWB.Paylink.BaoFooTransfer/Request/AbstractRequest.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,7 +24,7 @@ public IDictionary<string, string> PrimaryHandler<T>(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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>WWB.Paylink.BaoFooTransfer</PackageId>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<Authors>my6521</Authors>
<Description>宝付代付SDK。</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.JoinPay/WWB.Paylink.JoinPay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageId>WWB.Paylink.JoinPay</PackageId>
<Version>1.0.0-preview01</Version>
<Version>1.0.2</Version>
<Authors>my6521</Authors>
<Description>汇聚支付SDK</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
13 changes: 7 additions & 6 deletions src/WWB.Paylink.Utility/Security/CertificateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
namespace WWB.Paylink.Utility.Security
{
public static class CertificateHelper
{/// <summary>
/// 读取私钥
/// </summary>
/// <param name="path">证书路径</param>
/// <param name="pwd">证书密码</param>
/// <returns></returns>
{
/// <summary>
/// 读取私钥
/// </summary>
/// <param name="path">证书路径</param>
/// <param name="pwd">证书密码</param>
/// <returns></returns>
public static AsymmetricKeyParameter GetPrivateKeyFromFile(string path, string pwd)
{
var passwd = pwd.ToCharArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace WWB.Paylink.Utility.Security
{
public static class RSAHelper
public static class RSA
{
#region 加密

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace WWB.Paylink.Utility.Security
{
public static class SignatureHelper
public static class RSASignature
{
/// <summary>
/// 公共方法验签
Expand All @@ -14,7 +14,7 @@ public static class SignatureHelper
/// <param name="encryptStr"></param>
/// <param name="signature"></param>
/// <returns></returns>
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);
Expand All @@ -27,10 +27,10 @@ public static bool VerifySignature(string pubCerPath, string encryptStr, string
/// <param name="pfxPath"></param>
/// <param name="priKeyPass"></param>
/// <returns></returns>
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);
}

/// <summary>
Expand All @@ -40,7 +40,7 @@ public static string EncryptByRSA(string encryptStr, string pfxPath, string priK
/// <param name="data"></param>
/// <param name="parameters"></param>
/// <returns></returns>
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);
Expand Down
2 changes: 1 addition & 1 deletion src/WWB.Paylink.Utility/WWB.Paylink.Utility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>WWB.Paylink.Utility</PackageId>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<Authors>my6521</Authors>
<Description>支付帮助类。</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down

0 comments on commit 6fc051e

Please sign in to comment.