refactor(tenpayv2): 优化加解密及哈希算法工具类

This commit is contained in:
Fu Diwei
2024-02-04 22:53:24 +08:00
committed by RHQYZ
parent 3a4e65b1c6
commit 69955a1f2b
8 changed files with 70 additions and 56 deletions

View File

@@ -4,6 +4,8 @@ using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
{
using SKIT.FlurlHttpClient.Primitives;
public class TestCase_ToolsAESUtilityTests
{
[Fact(DisplayName = "测试用例AES-ECB 解密")]
@@ -12,7 +14,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.UnitTests
string key = "01234567890abcdefedcba9876543210";
string cipherText = "l/aL5GyVfl/tw3Lww6GvCQ==";
string actualPlain = Utilities.AESUtility.DecryptWithECB(encodingKey: Convert.ToBase64String(Encoding.UTF8.GetBytes(key)), encodingCipherText: cipherText);
string actualPlain = Utilities.AESUtility.DecryptWithECB(encodingKey: (EncodedString)Convert.ToBase64String(Encoding.UTF8.GetBytes(key)), encodingCipher: (EncodedString)cipherText)!;
string expectedPlain = "SKIT is great!";
Assert.Equal(expectedPlain, actualPlain);