1、优化sm4_cbc加解密接口
This commit is contained in:
@@ -131,14 +131,14 @@ public class SYMEnDeLongData {
|
||||
|
||||
if ( this.isEn ){
|
||||
// this.data = this.api.SYMEncryptData(this.key,this.keyValue,this.alg,this.roundMode,this.fullMode,this.isFirst ? 1 : 2 , data);
|
||||
System.out.println("块号block:"+(this.isFirst ? 1 : 2));
|
||||
RetWrap en = this.api.SM4EncryptDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, data, this.iv, this.isFirst ? 1 : 2);
|
||||
// System.out.println("块号block:"+(this.isFirst ? 1 : 2));
|
||||
RetWrap en = this.api.SM4EncDecDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, data, this.iv, this.isFirst ? 1 : 2);
|
||||
this.data = (byte[]) en.get("msg_all");
|
||||
this.iv = (byte[]) en.get("iv");
|
||||
System.out.println("下一IV长度:"+this.iv.length);
|
||||
System.out.println("iv---"+ Util.bytes2HexString(this.iv));
|
||||
// System.out.println("下一IV长度:"+this.iv.length);
|
||||
// System.out.println("iv---"+ Util.bytes2HexString(this.iv));
|
||||
} else {
|
||||
RetWrap de = this.api.SM4EncryptDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, data, this.iv, this.isFirst ? 1 : 2);
|
||||
RetWrap de = this.api.SM4EncDecDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, data, this.iv, this.isFirst ? 1 : 2);
|
||||
this.data = (byte[]) de.get("msg_all");
|
||||
this.iv = (byte[]) de.get("iv");
|
||||
}
|
||||
@@ -181,11 +181,11 @@ public class SYMEnDeLongData {
|
||||
if (last.length>0){
|
||||
|
||||
if ( this.isEn ){
|
||||
System.out.println("block:"+block);
|
||||
this.data = (byte[]) this.api.SM4EncryptDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, last, this.iv, block).get("msg_all");
|
||||
// System.out.println("block:"+block);
|
||||
this.data = (byte[]) this.api.SM4EncDecDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, last, this.iv, block).get("msg_all");
|
||||
} else {
|
||||
System.out.println("block:"+block);
|
||||
this.data = (byte[]) this.api.SM4EncryptDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, last, this.iv, block).get("msg_all");
|
||||
// System.out.println("block:"+block);
|
||||
this.data = (byte[]) this.api.SM4EncDecDataCBC(this.isEn, this.keyType, this.keyValue, this.inType, this.outType, last, this.iv, block).get("msg_all");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user