mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-02-11 02:07:49 +08:00
test(tenpayv3): 补充基于国密算法的客户端测试
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
|
||||
@@ -473,6 +473,7 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
|
||||
/// <param name="publicKey">PKCS#8 公钥(PEM 格式)。</param>
|
||||
/// <param name="message">待验证的文本数据。</param>
|
||||
/// <param name="signature">经 Base64 编码的待验证的签名。</param>
|
||||
/// <param name="asn1Encoding">指示签名结果是否为 ASN.1 编码的形式。(默认值:true)</param>
|
||||
/// <returns>验证结果。</returns>
|
||||
public static bool VerifyWithSM3(string publicKey, string message, string signature, bool asn1Encoding = true)
|
||||
{
|
||||
|
||||
@@ -109,7 +109,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
|
||||
|
||||
public void BlockUpdate(byte[] input, int inOff, int length)
|
||||
{
|
||||
//更新当前消息摘要
|
||||
while ((XBufOff != 0) && (length > 0))
|
||||
{
|
||||
Update(input[inOff]);
|
||||
@@ -117,7 +116,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
|
||||
length--;
|
||||
}
|
||||
|
||||
//处理完整的消息摘要
|
||||
while (length > XBuf.Length)
|
||||
{
|
||||
ProcessWord(input, inOff);
|
||||
@@ -127,7 +125,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
|
||||
ByteCount += XBuf.Length;
|
||||
}
|
||||
|
||||
//填充剩余的消息摘要
|
||||
while (length > 0)
|
||||
{
|
||||
Update(input[inOff]);
|
||||
@@ -141,7 +138,6 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Utilities
|
||||
{
|
||||
long bitLength = (ByteCount << 3);
|
||||
|
||||
//添加字节
|
||||
Update(unchecked((byte)128));
|
||||
|
||||
while (XBufOff != 0) Update(unchecked((byte)0));
|
||||
|
||||
Reference in New Issue
Block a user