小数据测试通过

This commit is contained in:
cheney 2026-06-03 14:08:19 +08:00
parent 02fd07def2
commit 0dc2d7c026
2 changed files with 4 additions and 2 deletions

View File

@ -7059,6 +7059,7 @@ public class SydApi4j implements SydApi {
bb.put((byte) dataType);
if (dataType == 2) { // 私钥
bb.put("999999999999999999999999999".getBytes());
bb.put(ByteUtil.shortToBytes((short) privateKey.length, ByteOrder.BIG_ENDIAN));
bb.put(privateKey);
}

View File

@ -99,8 +99,9 @@ public class FunctionTest {
@Test
public void SYD_SM2_Encrypt(){
byte[] enData = this.api.SYD_SM2Encrypt(publicKey4Ende, orgData);
// byte[] deData = this.api.SYD_SM2Decrypt(publicKey4Ende, enData);
// Assert.assertArrayEquals(enData, deData);
System.out.println("密文=" + Util.bytes2HexString(enData));
byte[] deData = this.api.SYD_SM2Decrypt(privateKey4Ende, enData);
Assert.assertArrayEquals(orgData, deData);
}
}