fix(tenpayv3): 修复部分场景下 RSA 加密请求敏感信息字段错误的问题

This commit is contained in:
Fu Diwei 2021-11-26 01:43:43 +08:00
parent a673044479
commit a006582c49
2 changed files with 7 additions and 2 deletions

View File

@ -120,7 +120,11 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
Type propType = childProp.PropertyType;
if (propType == typeof(string))
{
string oldValue = (string)childProp.GetValue(obj, null)!;
object? value = childProp.GetValue(obj, null);
if (value is null)
continue;
string oldValue = (string)value!;
string newValue = replacement(obj, childProp, oldValue);
childProp.SetValue(obj, newValue);
}

View File

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using Org.BouncyCastle.Crypto;
@ -16,7 +17,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
public static class RSAUtility
{
// REF: https://github.com/bcgit/bc-csharp/blob/master/crypto/src/security/CipherUtilities.cs
private const string RSA_CIPHER_ALG = "RSA/ECB/PKCS1";
private const string RSA_CIPHER_ALG = "RSA/ECB/OAEPWITHSHA1ANDMGF1PADDING";
// REF: https://github.com/bcgit/bc-csharp/blob/master/crypto/src/security/SignerUtilities.cs
private const string RSA_SIGNER_ALG = "SHA-256withRSA";