This commit is contained in:
junj2.liang 2022-08-08 11:28:28 +08:00
parent bd3fc80c7f
commit a16ae83f4d
2 changed files with 6 additions and 5 deletions

View File

@ -40,6 +40,10 @@ public class SydApi4Database implements SydApi {
@Override
public void SYD_Disconnect_Ex() {
if (isShortLinkMode) {
if ( null == hsms ){
return;
}
SydApi4j api = hsms[0];
if (null != api) {
try {
@ -57,9 +61,6 @@ public class SydApi4Database implements SydApi {
if (LogFactory.iLogLevel==3) {
log.debug("SYD_SM3_Hash_ShortData方法接收参数pcData{}", Arrays.toString(pcData));
}
if (pcData.length==0){
throw new SydApiException(-19);
}
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}

View File

@ -16,7 +16,7 @@ public class Sample
public static void main(String[] args) {
// 路径要以 / \\ 结尾表示目录
SydApi.SYD_SetLogConfig("./logs/",3);
SydApi.SYD_SetLogConfig("./logs/",1);
Logger log = LogFactory.getLogger();
log.info("start");
@ -373,7 +373,7 @@ public class Sample
int keyIdx = 0;
// 测试数据
byte[] data = new byte[16];
byte[] encData = api.SYD_SM4_ShortData( keyIdx , data, Consts.ECB_ENC );
byte[] encData = api.SYD_SM4_ShortData( keyIdx , data, Consts.ECB_DEC );
byte[] orgData = api.SYD_SM4_ShortData( keyIdx , encData, Consts.ECB_DEC );
System.out.println( "HEX=" + Util.bytes2HexString( encData ) );
Assert.assertArrayEquals( orgData, data );