整理测试代码

This commit is contained in:
Cheney Wong
2025-07-03 10:56:40 +08:00
parent dce29927d2
commit b1759df717
10 changed files with 23 additions and 70 deletions
@@ -242,7 +242,7 @@ public class SydApiBaseFunction implements SydApi {
if (LogFactory.iLogLevel == 3) {
log.debug("SYD_SM4_ShortData方法接收参数:iKeyIndex:{},pcData:{},iFlag:{}", iKeyIndex, Arrays.toString(pcData), iFlag);
}
if (iFlag == Consts.ECB_DEC && null == pcData || pcData.length == 0) {
if (iFlag == Consts.ECB_DEC && null == pcData) {
throw new SydApiException(19);
}
if (null == this.hsms || this.hsms.length < 1) {
@@ -793,6 +793,10 @@ public class SydApiBaseFunction implements SydApi {
@Override
public DataAndMac SYD_SM4_EncryptAndMac_ShortData(int iEncKeyIndex, int iMacKeyIndex, byte[] pcData) {
if ( null == pcData || pcData.length > 1024 ) {
throw new SydApiException(19);
}
byte[] enData = SYD_SM4_ShortData(iEncKeyIndex, pcData, Consts.ECB_ENC);
String mac = SYD_SM4Mac_ShortData(iMacKeyIndex, enData);
return new DataAndMac(enData, mac);