增加init/update/digest/finish长数据操作
This commit is contained in:
parent
86a784c1ba
commit
009ed41fc3
@ -46,7 +46,7 @@ public class SydApiSM4 {
|
||||
//加密
|
||||
if (plength < 16) {
|
||||
api.SYD_SM4_LongData(iKeyIndex, new byte[0], iPkgNum, iFlag);
|
||||
if (iFlag == 0 && 1 == iKeyIndex) {
|
||||
if (iFlag == 0 && 1 == iPkgNum) {
|
||||
throw new SydApiException("解密的首包不能小于 16 字节", 0);
|
||||
}
|
||||
ByteBuffer bufferResult = ByteBuffer.allocate(sourceWrap.array().length + plength);
|
||||
@ -68,7 +68,7 @@ public class SydApiSM4 {
|
||||
sourceWrap = bufferResult;
|
||||
}
|
||||
byte[] bytes = api.SYD_SM4_LongData(iKeyIndex, pcdataResult, iPkgNum, iFlag);
|
||||
iKeyIndex = 2;
|
||||
iPkgNum = 2;
|
||||
} else {
|
||||
if (16 > pcData.length + sourceWrap.array().length) {
|
||||
ByteBuffer bufferResult = ByteBuffer.allocate(sourceWrap.array().length + plength);
|
||||
@ -83,7 +83,6 @@ public class SydApiSM4 {
|
||||
api.SYD_SM4_LongData(iKeyIndex, bytes, iPkgNum, iFlag);
|
||||
}
|
||||
else {
|
||||
|
||||
ByteBuffer bufferResult = ByteBuffer.allocate(sourceWrap.array().length + plength);
|
||||
bufferResult.put(sourceWrap);
|
||||
bufferResult.put(pcData);
|
||||
@ -117,7 +116,7 @@ public class SydApiSM4 {
|
||||
}
|
||||
|
||||
byte[] bytes = api.SYD_SM4_LongData(iKeyIndex, pcdataResult, iPkgNum, iFlag);
|
||||
sourceWrap = null;
|
||||
// sourceWrap = null;
|
||||
return bytes;
|
||||
}
|
||||
public ByteBuffer bufferResult(int plength,byte[] pcData){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user