batch mac 返回值错误

This commit is contained in:
cheney 2025-07-07 17:41:43 +08:00
parent faef49d504
commit dcd4b91b57

View File

@ -124,6 +124,14 @@ public class SydApiBaseFunction implements SydApi {
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}
if (null == pcData) {
throw new SydApiException("输入内容为 null",19);
}
if ( pcData.length > 1024 ) {
throw new SydApiException("输入内容为空",19);
}
SydApiException le = new SydApiException(-1);
updateLastUseTime();
@ -248,7 +256,15 @@ public class SydApiBaseFunction implements SydApi {
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}
if (Consts.ECB_ENC == iFlag) {
if ( pcData.length > 1024 ) {
throw new SydApiException("输入内容超长",19);
}
} else {
if ( pcData.length > 1040 ) {
throw new SydApiException("输入内容超长",19);
}
}
updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex);
SydApiException le = new SydApiException(-1);
@ -318,13 +334,21 @@ public class SydApiBaseFunction implements SydApi {
if (LogFactory.iLogLevel == 3) {
log.debug("SYD_SM4_BatchData方法接收参数iKeyIndex{},pcData元素个数为{},iFlag{}", iKeyIndex, pcData.size(), iFlag);
}
if (iFlag == Consts.ECB_DEC) {
for (byte[] pcdata : pcData) {
if (null == pcData || pcdata.length == 0) {
if (null == pcData || pcdata.length == 0 || pcdata.length > 1040) {
throw new SydApiException(19);
}
}
} else {
for (byte[] pcdata : pcData) {
if (null == pcData || pcdata.length > 1024) {
throw new SydApiException(19);
}
}
}
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}
@ -722,6 +746,11 @@ public class SydApiBaseFunction implements SydApi {
if (LogFactory.iLogLevel == 3) {
log.debug("SYD_SM4Mac_ShortData方法接收参数iKeyIndex{},pcData{},iFlag{}", iKeyIndex, Arrays.toString(pcData));
}
if ( null == pcData || pcData.length > 1040 ) {
throw new SydApiException("输入内容超长",19);
}
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}
@ -777,6 +806,11 @@ public class SydApiBaseFunction implements SydApi {
if (LogFactory.iLogLevel == 3) {
log.debug("SYD_SM4Mac_ShortData方法接收参数{}", iKeyIndex, Arrays.toString(pcData), pcMac);
}
if ( null == pcData || pcData.length > 1040 ) {
throw new SydApiException("输入内容超长",19);
}
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}