测试文件修改

This commit is contained in:
junj2.liang
2022-09-05 11:26:47 +08:00
parent 602781686b
commit d2aaa8e9ac
7 changed files with 21 additions and 76 deletions
@@ -272,7 +272,7 @@ public interface SydApi {
);
public SydApiSM423 initSM4(int iKeyIndex, int ende);
public SydApiSM4 initSM4(int iKeyIndex, int ende);
public SydApiSM3 initSM3();
@@ -773,9 +773,9 @@ public class SydApi4Database implements SydApi {
@Override
public SydApiSM423 initSM4(int iKeyIndex, int ende) {
public SydApiSM4 initSM4(int iKeyIndex, int ende) {
return new SydApiSM423(this,iKeyIndex,ende);
return new SydApiSM4(this,iKeyIndex,ende);
}
public SydApiSM3 initSM3() {
@@ -1,10 +1,8 @@
package com.sunyard.sge.database;
import com.sunyard.SydApiException;
import com.sunyard.proto.Util;
import com.sunyard.sge.bytes.BytesQueue;
import java.nio.ByteBuffer;
public class SydApiSM4 {
@@ -66,12 +64,12 @@ public class SydApiSM4 {
iPkgNum = 2;
return bytes2;
}
} else {
if (null==queue||null==pcData){
}
else {
if (null == queue || null == pcData) {
throw new IllegalArgumentException();
}
queue.push(pcData);
// int totalLen = queue.getLength() + pcData.length;
if ((queue.getLength()) / 16 < 2) {
return new byte[0];
}
@@ -81,50 +79,6 @@ public class SydApiSM4 {
iPkgNum = 2;
return bytes2;
// ByteBuffer nSourceWrap = ByteBuffer.allocate( sourceWrap.array().length + pcData.length );
// byte[] waitData = sourceWrap.array();
// nSourceWrap.put( waitData );
// nSourceWrap.put( pcData );
// sourceWrap = nSourceWrap;
//
// System.out.println("new sourceWrap=" + Util.bytes2HexString(sourceWrap.array()));
//
// int totalLen = sourceWrap.array().length;
// if ( totalLen / 16 < 2){
// return new byte[0];
// }
//
//
// int com = totalLen % 16;
// int sendBuffLen = totalLen - com -16;
// byte[] sendBuff = new byte[sendBuffLen];
//
//
//
// sourceWrap.position(0);
// sourceWrap.get( sendBuff , 0, sendBuff.length );
// byte[] waitBuff = new byte[ totalLen - sendBuffLen ];
// sourceWrap.get( waitBuff , 0, waitBuff.length );
//
// System.out.println( String.format("debug inDataLen=%d totalDataLen=%d sendDataLen=%d 16=%d iPkgNum=%d",
// pcData.length,
// totalLen,
// sendBuff.length,
// sendBuff.length % 16,
// iPkgNum)
// );
//
// System.out.println( "waitBuff=" + Util.bytes2HexString( waitBuff ) );
//
// if( 0x00 == waitBuff[0] ) {
// System.out.println("eee");
// }
// sourceWrap = ByteBuffer.wrap( waitBuff );
// System.out.println("sourceWrap=" + Util.bytes2HexString(sourceWrap.array()));
// byte[] bytes2 = api.SYD_SM4_LongData(iKeyIndex, sendBuff, iPkgNum, iFlag);
//
// iPkgNum = 2;
// return bytes2;
}
}
@@ -141,23 +95,13 @@ public class SydApiSM4 {
}
byte[] pop = queue.pop();
byte[] bytes = api.SYD_SM4_LongData(iKeyIndex, pop, iPkgNum, iFlag);
return bytes;
byte[] pop = queue.pop();
byte[] bytes = api.SYD_SM4_LongData(iKeyIndex, pop, iPkgNum, iFlag);
queue = null;
return bytes;
// byte[] bytes = api.SYD_SM4_LongData(iKeyIndex, , iPkgNum, iFlag);
// sourceWrap = null;
// return bytes;
}
// public ByteBuffer bufferResult(int plength, byte[] pcData) {
// ByteBuffer bufferResult = ByteBuffer.allocate(sourceWrap.array().length + plength);
// bufferResult.put(sourceWrap);
// bufferResult.put(pcData);
// return bufferResult;
// }
}
@@ -5,7 +5,7 @@ import com.sunyard.proto.Util;
import java.nio.ByteBuffer;
public class SydApiSM423 {
public class SydApiSM4Backup {
private SydApi api;
private int iKeyIndex;
@@ -18,7 +18,7 @@ public class SydApiSM423 {
ByteBuffer sourceWrap = ByteBuffer.wrap(new byte[0]);
public SydApiSM423(SydApi api, int iKeyIndex, int endeFlag) {
public SydApiSM4Backup(SydApi api, int iKeyIndex, int endeFlag) {
this.api = api;
this.iFlag = endeFlag;
this.iKeyIndex = iKeyIndex;