diff --git a/DProto/6C.xml b/DProto/6C.xml
index 6bd757e..3b3af7b 100644
--- a/DProto/6C.xml
+++ b/DProto/6C.xml
@@ -32,6 +32,10 @@
可选项,只针对“证书模式”为 1时有。
+
+ 可以没有,如果有一定是 ‘P’,表示后续值是 SM3HASH
+
+
数据长度
diff --git a/DProto/6D.xml b/DProto/6D.xml
index b61b4eb..bd42b56 100644
--- a/DProto/6D.xml
+++ b/DProto/6D.xml
@@ -39,6 +39,10 @@
可选项,只针对“证书模式”为2 时有。
+
+ 可以没有,如果有一定是 ‘P’,表示后续值是 SM3HASH
+
+
数据长度
diff --git a/src/main/java/com/sunyard/inf/customize/SydUnionPayApi.java b/src/main/java/com/sunyard/inf/customize/SydUnionPayApi.java
index 00ea8f7..2f372a8 100644
--- a/src/main/java/com/sunyard/inf/customize/SydUnionPayApi.java
+++ b/src/main/java/com/sunyard/inf/customize/SydUnionPayApi.java
@@ -12,7 +12,7 @@ public interface SydUnionPayApi {
* @param pOrgData 输入。 待签名的原始数据。
* @return 签名数据(BASE64 编码)。
*/
- String netSign(String pCertSerial, String userId, byte[] pOrgData);
+ String unPSign(String pCertSerial, String userId, byte[] pOrgData);
/**
@@ -24,5 +24,5 @@ public interface SydUnionPayApi {
* @param pSignData 输入。 签名数据(BASE64 编码)。
* @return true 表示验证正确;false 表示失败;
*/
- boolean netVerify(String pCertSerial, String userId, byte[] pOrgData, String pSignData);
+ boolean unPVerify(String pCertSerial, String userId, byte[] pOrgData, String pSignData);
}
diff --git a/src/main/java/racal/sunyard/main/SydApi4j.java b/src/main/java/racal/sunyard/main/SydApi4j.java
index b0a0056..f6af4c9 100644
--- a/src/main/java/racal/sunyard/main/SydApi4j.java
+++ b/src/main/java/racal/sunyard/main/SydApi4j.java
@@ -2242,7 +2242,7 @@ public class SydApi4j implements SydApi {
* @return 签名数据(BASE64 编码)。
*/
@Override
- public String netSign(String pCertSerial, String userId, byte[] pOrgData) {
+ public String unPSign(String pCertSerial, String userId, byte[] pOrgData) {
// 针对传化需求定制
// 获取协议
@@ -2296,7 +2296,7 @@ public class SydApi4j implements SydApi {
* @return true 表示验证正确;false 表示失败;
*/
@Override
- public boolean netVerify(String pCertSerial, String userId, byte[] pOrgData, String pSignData) {
+ public boolean unPVerify(String pCertSerial, String userId, byte[] pOrgData, String pSignData) {
// 获取协议
Proto6D proto=new Proto6D();
@@ -2346,7 +2346,46 @@ public class SydApi4j implements SydApi {
*/
@Override
public String netSign(String pCertSerial, byte[] pOrgData) {
- return netSign(pCertSerial, null, pOrgData);
+ // 针对传化需求定制
+ // 获取协议
+ //ProtocolRender render = pset.getProtocolReqRender("6C");
+ Proto6C proto = new Proto6C();
+
+ // 先进行 HASH
+ pOrgData = SM3HashSNaId( pCertSerial, null, pOrgData );
+
+ // 填充数据
+ PacketSN sn = PacketSN.gen();
+ HashMap packet = new HashMap();
+ packet.put("header", sn.getSn().array());
+ HashMap data = new HashMap();
+ data.put("certificateModel$option", 0);
+ data.put("certificateSn", pCertSerial);
+ data.put("inData", pOrgData);
+ packet.put("data", data);
+
+ // 渲染发送
+ ByteBuffer bb = proto.rend(packet);
+ synchronized (this) {
+ // 响应解析
+ bb = syncRead(syncSend(bb));
+ }
+
+ //ProtocolParser parser = pset.getProtocolResParse();
+ Packet p = proto.parse(bb);
+ Map ret = p.toMap();
+ if (
+ !Arrays.equals(sn.getSn().array(), ((PacketSection) ret.get("header")).getBytes())
+ ) {
+ throw new SydApiException("包序号不匹配", -4);
+ }
+ ret = (Map) ret.get("data");
+ PacketSection error = (PacketSection) ret.get("error");
+ if (!"00".equals(error.getString())) {
+ throw new SydApiException(error.getInfo(), error.autoInt());
+ }
+
+ return ((PacketSection) ret.get("sign")).getString();
}
/**
@@ -2359,7 +2398,44 @@ public class SydApi4j implements SydApi {
*/
@Override
public boolean netVerify(String pCertSerial, byte[] pOrgData, String pSignData) {
- return netVerify(pCertSerial, null, pOrgData, pSignData);
+ // 获取协议
+ //ProtocolRender render = pset.getProtocolReqRender("6D");
+ Proto6D proto=new Proto6D();
+
+ pOrgData = SM3HashSNaId( pCertSerial, null, pOrgData );
+
+ // 填充数据
+ PacketSN sn = PacketSN.gen();
+ HashMap packet = new HashMap();
+ packet.put("header", sn.getSn().array());
+ HashMap data = new HashMap();
+ data.put("certificateModel$option", 0);
+ data.put("certificateSn", pCertSerial);
+ data.put("inData", pOrgData);
+ data.put("sign", pSignData);
+ packet.put("data", data);
+
+ // 渲染发送
+ ByteBuffer bb = proto.rend(packet);
+ synchronized (this) {
+ // 响应解析
+ bb = syncRead( syncSend(bb) );
+ }
+ //ProtocolParser parser = pset.getProtocolResParse();
+ Packet p = proto.parse(bb);
+ Map ret = p.toMap();
+ if (
+ !Arrays.equals(sn.getSn().array(), ((PacketSection) ret.get("header")).getBytes())
+ ) {
+ throw new SydApiException("包序号不匹配", -4);
+ }
+ ret = (Map) ret.get("data");
+ PacketSection error = (PacketSection) ret.get("error");
+ if (!"00".equals(error.getString())) {
+ throw new SydApiException(error.getInfo(), error.autoInt());
+ }
+
+ return true;
}
diff --git a/src/main/java/racal/sunyard/main/dto/DTO4D41.java b/src/main/java/racal/sunyard/main/dto/DTO4D41.java
deleted file mode 100644
index 230aa5a..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO4D41.java
+++ /dev/null
@@ -1,1015 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO4D41 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] tag = null;
- private byte[] alg = null;
- private byte[] type = null;
- private byte[] full = null;
- private byte[] macLen = null;
- private byte[] key = null;
- private byte[] mACData = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getTagAsBin( ) {
-
- return this.tag;
- }
-
-
- public String getTagAsStr( ) {
-
- if( null == this.tag) return null;
- return Arrays.toString(this.tag);
- }
-
-
- public String getTagAsHex( ) {
-
- if( null == this.tag) return null;
- return Util.bytes2HexString(tag);
- }
-
-
- public Data setTag( byte[] bytes ) {
-
- this.tag = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPV3DES(Util.hexString2Bytes("31")),
- OPVSM4(Util.hexString2Bytes("32"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "3DES";
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getTypeAsBin( ) {
-
- return this.type;
- }
-
-
- public String getTypeAsStr( ) {
-
- if( null == this.type) return null;
- return Arrays.toString(this.type);
- }
-
-
- public String getTypeAsHex( ) {
-
- if( null == this.type) return null;
- return Util.bytes2HexString(type);
- }
-
-
- public Data setType( byte[] bytes ) {
-
- this.type = bytes;
- return this;
- }
-public enum TypeOptions {
-
- OPVZAK13DES认证密钥(Util.hexString2Bytes("30")),
- OPVZAK2SM4认证密钥(Util.hexString2Bytes("31"));
- private byte[] bin;
- TypeOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getTypeCn( ) {
-
- if( null == type) { return null; }
- if( "30".equals(Util.bytes2HexString(this.type))) {
- return "ZAK1(3DES 认证密钥) ";
- }
- if( "31".equals(Util.bytes2HexString(this.type))) {
- return "ZAK2(SM4 认证密钥) ";
- }
- return null;
- }
-
-
- public Integer getTypeOptionIndex( ) {
-
- if( null == type) { return null; }
- if( "30".equals(Util.bytes2HexString(this.type))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.type))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getFullAsBin( ) {
-
- return this.full;
- }
-
-
- public String getFullAsStr( ) {
-
- if( null == this.full) return null;
- return Arrays.toString(this.full);
- }
-
-
- public String getFullAsHex( ) {
-
- if( null == this.full) return null;
- return Util.bytes2HexString(full);
- }
-
-
- public Data setFull( byte[] bytes ) {
-
- this.full = bytes;
- return this;
- }
-
-
- public byte[] getMacLenAsBin( ) {
-
- return this.macLen;
- }
-
-
- public String getMacLenAsStr( ) {
-
- if( null == this.macLen) return null;
- return Arrays.toString(this.macLen);
- }
-
-
- public String getMacLenAsHex( ) {
-
- if( null == this.macLen) return null;
- return Util.bytes2HexString(macLen);
- }
-
-
- public Data setMacLen( byte[] bytes ) {
-
- this.macLen = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getMACDataAsBin( ) {
-
- return this.mACData;
- }
-
-
- public String getMACDataAsStr( ) {
-
- if( null == this.mACData) return null;
- return Arrays.toString(this.mACData);
- }
-
-
- public String getMACDataAsHex( ) {
-
- if( null == this.mACData) return null;
- return Util.bytes2HexString(mACData);
- }
-
-
- public Data setMACData( byte[] bytes ) {
-
- this.mACData = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- soup.put("tag", Util.hexString2Bytes("50"));
- if( null != tag ){
- soup.put("tag", this.tag);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != type ){
- soup.put("type", this.type);
- soup.put("type$option", getTypeOptionIndex());
- }
-
- if( null != full ){
- soup.put("full", this.full);
- }
-
- if( null != macLen ){
- soup.put("macLen", this.macLen);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != mACData ){
- soup.put("MACData", this.mACData);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- this.tag = Util.hexString2Bytes("50");
- if( soup.containsKey("tag") ){
- this.tag = ((PacketSection) soup.get("tag")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("type") ){
- this.type = ((PacketSection) soup.get("type")).getBytes();
- }
-
- if( soup.containsKey("full") ){
- this.full = ((PacketSection) soup.get("full")).getBytes();
- }
-
- if( soup.containsKey("macLen") ){
- this.macLen = ((PacketSection) soup.get("macLen")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("MACData") ){
- this.mACData = ((PacketSection) soup.get("MACData")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("4D41"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("4D41");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] mAC = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPVMAC校验错(Util.hexString2Bytes("3031")),
- OPVTAK奇偶校验错(Util.hexString2Bytes("3130")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误报告给管理员(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV密钥方案错误(Util.hexString2Bytes("3236")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3031".equals(Util.bytes2HexString(this.error))) {
- return "MAC校验错";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "TAK奇偶校验错";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK错误;报告给管理员";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "密钥方案错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3031".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- return null;
- }
-
-
- public byte[] getMACAsBin( ) {
-
- return this.mAC;
- }
-
-
- public String getMACAsStr( ) {
-
- if( null == this.mAC) return null;
- return Arrays.toString(this.mAC);
- }
-
-
- public String getMACAsHex( ) {
-
- if( null == this.mAC) return null;
- return Util.bytes2HexString(mAC);
- }
-
-
- public Data setMAC( byte[] bytes ) {
-
- this.mAC = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != mAC ){
- soup.put("MAC", this.mAC);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("MAC") ){
- this.mAC = ((PacketSection) soup.get("MAC")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("4D42"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("4D42");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO4D43.java b/src/main/java/racal/sunyard/main/dto/DTO4D43.java
deleted file mode 100644
index 916c8e2..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO4D43.java
+++ /dev/null
@@ -1,1015 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO4D43 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] tag = null;
- private byte[] alg = null;
- private byte[] type = null;
- private byte[] full = null;
- private byte[] macLen = null;
- private byte[] key = null;
- private byte[] mAC = null;
- private byte[] mACData = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getTagAsBin( ) {
-
- return this.tag;
- }
-
-
- public String getTagAsStr( ) {
-
- if( null == this.tag) return null;
- return Arrays.toString(this.tag);
- }
-
-
- public String getTagAsHex( ) {
-
- if( null == this.tag) return null;
- return Util.bytes2HexString(tag);
- }
-
-
- public Data setTag( byte[] bytes ) {
-
- this.tag = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPV3DES(Util.hexString2Bytes("31")),
- OPVSM4(Util.hexString2Bytes("32"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "3DES";
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getTypeAsBin( ) {
-
- return this.type;
- }
-
-
- public String getTypeAsStr( ) {
-
- if( null == this.type) return null;
- return Arrays.toString(this.type);
- }
-
-
- public String getTypeAsHex( ) {
-
- if( null == this.type) return null;
- return Util.bytes2HexString(type);
- }
-
-
- public Data setType( byte[] bytes ) {
-
- this.type = bytes;
- return this;
- }
-public enum TypeOptions {
-
- OPVZAK13DES认证密钥(Util.hexString2Bytes("30")),
- OPVZAK2SM4认证密钥(Util.hexString2Bytes("31"));
- private byte[] bin;
- TypeOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getTypeCn( ) {
-
- if( null == type) { return null; }
- if( "30".equals(Util.bytes2HexString(this.type))) {
- return "ZAK1(3DES 认证密钥) ";
- }
- if( "31".equals(Util.bytes2HexString(this.type))) {
- return "ZAK2(SM4 认证密钥) ";
- }
- return null;
- }
-
-
- public Integer getTypeOptionIndex( ) {
-
- if( null == type) { return null; }
- if( "30".equals(Util.bytes2HexString(this.type))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.type))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getFullAsBin( ) {
-
- return this.full;
- }
-
-
- public String getFullAsStr( ) {
-
- if( null == this.full) return null;
- return Arrays.toString(this.full);
- }
-
-
- public String getFullAsHex( ) {
-
- if( null == this.full) return null;
- return Util.bytes2HexString(full);
- }
-
-
- public Data setFull( byte[] bytes ) {
-
- this.full = bytes;
- return this;
- }
-
-
- public byte[] getMacLenAsBin( ) {
-
- return this.macLen;
- }
-
-
- public String getMacLenAsStr( ) {
-
- if( null == this.macLen) return null;
- return Arrays.toString(this.macLen);
- }
-
-
- public String getMacLenAsHex( ) {
-
- if( null == this.macLen) return null;
- return Util.bytes2HexString(macLen);
- }
-
-
- public Data setMacLen( byte[] bytes ) {
-
- this.macLen = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getMACAsBin( ) {
-
- return this.mAC;
- }
-
-
- public String getMACAsStr( ) {
-
- if( null == this.mAC) return null;
- return Arrays.toString(this.mAC);
- }
-
-
- public String getMACAsHex( ) {
-
- if( null == this.mAC) return null;
- return Util.bytes2HexString(mAC);
- }
-
-
- public Data setMAC( byte[] bytes ) {
-
- this.mAC = bytes;
- return this;
- }
-
-
- public byte[] getMACDataAsBin( ) {
-
- return this.mACData;
- }
-
-
- public String getMACDataAsStr( ) {
-
- if( null == this.mACData) return null;
- return Arrays.toString(this.mACData);
- }
-
-
- public String getMACDataAsHex( ) {
-
- if( null == this.mACData) return null;
- return Util.bytes2HexString(mACData);
- }
-
-
- public Data setMACData( byte[] bytes ) {
-
- this.mACData = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- soup.put("tag", Util.hexString2Bytes("50"));
- if( null != tag ){
- soup.put("tag", this.tag);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != type ){
- soup.put("type", this.type);
- soup.put("type$option", getTypeOptionIndex());
- }
-
- if( null != full ){
- soup.put("full", this.full);
- }
-
- if( null != macLen ){
- soup.put("macLen", this.macLen);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != mAC ){
- soup.put("MAC", this.mAC);
- }
-
- if( null != mACData ){
- soup.put("MACData", this.mACData);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- this.tag = Util.hexString2Bytes("50");
- if( soup.containsKey("tag") ){
- this.tag = ((PacketSection) soup.get("tag")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("type") ){
- this.type = ((PacketSection) soup.get("type")).getBytes();
- }
-
- if( soup.containsKey("full") ){
- this.full = ((PacketSection) soup.get("full")).getBytes();
- }
-
- if( soup.containsKey("macLen") ){
- this.macLen = ((PacketSection) soup.get("macLen")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("MAC") ){
- this.mAC = ((PacketSection) soup.get("MAC")).getBytes();
- }
-
- if( soup.containsKey("MACData") ){
- this.mACData = ((PacketSection) soup.get("MACData")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("4D43"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("4D43");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPVMAC校验错(Util.hexString2Bytes("3031")),
- OPVTAK奇偶校验错(Util.hexString2Bytes("3130")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误报告给管理员(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV密钥方案错误(Util.hexString2Bytes("3236")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3031".equals(Util.bytes2HexString(this.error))) {
- return "MAC校验错";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "TAK奇偶校验错";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK错误;报告给管理员";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "密钥方案错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3031".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- return null;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("4D44"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("4D44");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO60.java b/src/main/java/racal/sunyard/main/dto/DTO60.java
deleted file mode 100644
index d6d4327..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO60.java
+++ /dev/null
@@ -1,735 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO60 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3630"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3630");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] dK = null;
- private byte[] keyCheck = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV无效的成份号(Util.hexString2Bytes("3033")),
- OPV成份奇偶校验错(Util.hexString2Bytes("3130")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV不在授权状态(Util.hexString2Bytes("3137")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV无效的密钥方案(Util.hexString2Bytes("3236")),
- OPV传输保护秘钥校验值和和实际不一致(Util.hexString2Bytes("3537")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3033".equals(Util.bytes2HexString(this.error))) {
- return "无效的成份号";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "成份奇偶校验错";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return "不在授权状态";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "无效的密钥方案";
- }
- if( "3537".equals(Util.bytes2HexString(this.error))) {
- return "传输保护秘钥校验值和和实际不一致";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3033".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- if( "3537".equals(Util.bytes2HexString(this.error))) {
- return 9;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 10;
- }
- return null;
- }
-
-
- public byte[] getDKAsBin( ) {
-
- return this.dK;
- }
-
-
- public String getDKAsStr( ) {
-
- if( null == this.dK) return null;
- return Arrays.toString(this.dK);
- }
-
-
- public String getDKAsHex( ) {
-
- if( null == this.dK) return null;
- return Util.bytes2HexString(dK);
- }
-
-
- public Data setDK( byte[] bytes ) {
-
- this.dK = bytes;
- return this;
- }
-
-
- public byte[] getKeyCheckAsBin( ) {
-
- return this.keyCheck;
- }
-
-
- public String getKeyCheckAsStr( ) {
-
- if( null == this.keyCheck) return null;
- return Arrays.toString(this.keyCheck);
- }
-
-
- public String getKeyCheckAsHex( ) {
-
- if( null == this.keyCheck) return null;
- return Util.bytes2HexString(keyCheck);
- }
-
-
- public Data setKeyCheck( byte[] bytes ) {
-
- this.keyCheck = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != dK ){
- soup.put("DK", this.dK);
- }
-
- if( null != keyCheck ){
- soup.put("keyCheck", this.keyCheck);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("DK") ){
- this.dK = ((PacketSection) soup.get("DK")).getBytes();
- }
-
- if( soup.containsKey("keyCheck") ){
- this.keyCheck = ((PacketSection) soup.get("keyCheck")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3631"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3631");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO61.java b/src/main/java/racal/sunyard/main/dto/DTO61.java
deleted file mode 100644
index 1d16cbe..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO61.java
+++ /dev/null
@@ -1,771 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO61 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] roleInfo = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getRoleInfoAsBin( ) {
-
- return this.roleInfo;
- }
-
-
- public String getRoleInfoAsStr( ) {
-
- if( null == this.roleInfo) return null;
- return Arrays.toString(this.roleInfo);
- }
-
-
- public String getRoleInfoAsHex( ) {
-
- if( null == this.roleInfo) return null;
- return Util.bytes2HexString(roleInfo);
- }
-
-
- public Data setRoleInfo( byte[] bytes ) {
-
- this.roleInfo = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != roleInfo ){
- soup.put("roleInfo", this.roleInfo);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("roleInfo") ){
- this.roleInfo = ((PacketSection) soup.get("roleInfo")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3631"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3631");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] roleType = null;
- private byte[] roleId = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV验证失败(Util.hexString2Bytes("3032")),
- OPV无效的成份号(Util.hexString2Bytes("3033")),
- OPV成份奇偶校验错(Util.hexString2Bytes("3130")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误报告给管理员(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV不在授权状态(Util.hexString2Bytes("3137")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV无效的密钥方案(Util.hexString2Bytes("3236")),
- OPV数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3032".equals(Util.bytes2HexString(this.error))) {
- return "验证失败";
- }
- if( "3033".equals(Util.bytes2HexString(this.error))) {
- return "无效的成份号";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "成份奇偶校验错";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK错误;报告给管理员";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return "不在授权状态";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "无效的密钥方案";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3032".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3033".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 9;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 10;
- }
- return null;
- }
-
-
- public byte[] getRoleTypeAsBin( ) {
-
- return this.roleType;
- }
-
-
- public String getRoleTypeAsStr( ) {
-
- if( null == this.roleType) return null;
- return Arrays.toString(this.roleType);
- }
-
-
- public String getRoleTypeAsHex( ) {
-
- if( null == this.roleType) return null;
- return Util.bytes2HexString(roleType);
- }
-
-
- public Data setRoleType( byte[] bytes ) {
-
- this.roleType = bytes;
- return this;
- }
-
-
- public byte[] getRoleIdAsBin( ) {
-
- return this.roleId;
- }
-
-
- public String getRoleIdAsStr( ) {
-
- if( null == this.roleId) return null;
- return Arrays.toString(this.roleId);
- }
-
-
- public String getRoleIdAsHex( ) {
-
- if( null == this.roleId) return null;
- return Util.bytes2HexString(roleId);
- }
-
-
- public Data setRoleId( byte[] bytes ) {
-
- this.roleId = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != roleType ){
- soup.put("roleType", this.roleType);
- }
-
- if( null != roleId ){
- soup.put("roleId", this.roleId);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("roleType") ){
- this.roleType = ((PacketSection) soup.get("roleType")).getBytes();
- }
-
- if( soup.containsKey("roleId") ){
- this.roleId = ((PacketSection) soup.get("roleId")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3632"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3632");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO62.java b/src/main/java/racal/sunyard/main/dto/DTO62.java
deleted file mode 100644
index 4b405b1..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO62.java
+++ /dev/null
@@ -1,999 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO62 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] keyType = null;
- private byte[] key = null;
- private byte[] algorithmKey = null;
- private byte[] alg = null;
- private byte[] outputFormat = null;
- private byte[] dataLength = null;
- private byte[] infoData = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getKeyTypeAsBin( ) {
-
- return this.keyType;
- }
-
-
- public String getKeyTypeAsStr( ) {
-
- if( null == this.keyType) return null;
- return Arrays.toString(this.keyType);
- }
-
-
- public String getKeyTypeAsHex( ) {
-
- if( null == this.keyType) return null;
- return Util.bytes2HexString(keyType);
- }
-
-
- public Data setKeyType( byte[] bytes ) {
-
- this.keyType = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getAlgorithmKeyAsBin( ) {
-
- return this.algorithmKey;
- }
-
-
- public String getAlgorithmKeyAsStr( ) {
-
- if( null == this.algorithmKey) return null;
- return Arrays.toString(this.algorithmKey);
- }
-
-
- public String getAlgorithmKeyAsHex( ) {
-
- if( null == this.algorithmKey) return null;
- return Util.bytes2HexString(algorithmKey);
- }
-
-
- public Data setAlgorithmKey( byte[] bytes ) {
-
- this.algorithmKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVIDEA(Util.hexString2Bytes("30")),
- OPVSM1(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "IDEA";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM1";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getOutputFormatAsBin( ) {
-
- return this.outputFormat;
- }
-
-
- public String getOutputFormatAsStr( ) {
-
- if( null == this.outputFormat) return null;
- return Arrays.toString(this.outputFormat);
- }
-
-
- public String getOutputFormatAsHex( ) {
-
- if( null == this.outputFormat) return null;
- return Util.bytes2HexString(outputFormat);
- }
-
-
- public Data setOutputFormat( byte[] bytes ) {
-
- this.outputFormat = bytes;
- return this;
- }
-public enum OutputFormatOptions {
-
- OPV软MD5后前8与后8异或后加密密押取前4位并转为8字节的HEX格式(Util.hexString2Bytes("30")),
- OPV软MD5后取前8字节加密输出8节的BIN格式(Util.hexString2Bytes("31"));
- private byte[] bin;
- OutputFormatOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getOutputFormatCn( ) {
-
- if( null == outputFormat) { return null; }
- if( "30".equals(Util.bytes2HexString(this.outputFormat))) {
- return "软MD5后前8与后8异或后加密,密押取前4位并转为8字节的HEX格式";
- }
- if( "31".equals(Util.bytes2HexString(this.outputFormat))) {
- return "软MD5后取前8字节加密,输出8节的BIN格式";
- }
- return null;
- }
-
-
- public Integer getOutputFormatOptionIndex( ) {
-
- if( null == outputFormat) { return null; }
- if( "30".equals(Util.bytes2HexString(this.outputFormat))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.outputFormat))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getDataLengthAsBin( ) {
-
- return this.dataLength;
- }
-
-
- public String getDataLengthAsStr( ) {
-
- if( null == this.dataLength) return null;
- return Arrays.toString(this.dataLength);
- }
-
-
- public String getDataLengthAsHex( ) {
-
- if( null == this.dataLength) return null;
- return Util.bytes2HexString(dataLength);
- }
-
-
- public Data setDataLength( byte[] bytes ) {
-
- this.dataLength = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataAsBin( ) {
-
- return this.infoData;
- }
-
-
- public String getInfoDataAsStr( ) {
-
- if( null == this.infoData) return null;
- return Arrays.toString(this.infoData);
- }
-
-
- public String getInfoDataAsHex( ) {
-
- if( null == this.infoData) return null;
- return Util.bytes2HexString(infoData);
- }
-
-
- public Data setInfoData( byte[] bytes ) {
-
- this.infoData = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != keyType ){
- soup.put("keyType", this.keyType);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != algorithmKey ){
- soup.put("AlgorithmKey", this.algorithmKey);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != outputFormat ){
- soup.put("outputFormat", this.outputFormat);
- soup.put("outputFormat$option", getOutputFormatOptionIndex());
- }
-
- if( null != dataLength ){
- soup.put("dataLength", this.dataLength);
- }
-
- if( null != infoData ){
- soup.put("infoData", this.infoData);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("keyType") ){
- this.keyType = ((PacketSection) soup.get("keyType")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey") ){
- this.algorithmKey = ((PacketSection) soup.get("AlgorithmKey")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("outputFormat") ){
- this.outputFormat = ((PacketSection) soup.get("outputFormat")).getBytes();
- }
-
- if( soup.containsKey("dataLength") ){
- this.dataLength = ((PacketSection) soup.get("dataLength")).getBytes();
- }
-
- if( soup.containsKey("infoData") ){
- this.infoData = ((PacketSection) soup.get("infoData")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3632"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3632");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] mAC = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV密钥方案错误(Util.hexString2Bytes("3236")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "密钥方案错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- return null;
- }
-
-
- public byte[] getMACAsBin( ) {
-
- return this.mAC;
- }
-
-
- public String getMACAsStr( ) {
-
- if( null == this.mAC) return null;
- return Arrays.toString(this.mAC);
- }
-
-
- public String getMACAsHex( ) {
-
- if( null == this.mAC) return null;
- return Util.bytes2HexString(mAC);
- }
-
-
- public Data setMAC( byte[] bytes ) {
-
- this.mAC = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != mAC ){
- soup.put("MAC", this.mAC);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("MAC") ){
- this.mAC = ((PacketSection) soup.get("MAC")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3633"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3633");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO63.java b/src/main/java/racal/sunyard/main/dto/DTO63.java
deleted file mode 100644
index 5548a12..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO63.java
+++ /dev/null
@@ -1,999 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO63 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] keyType = null;
- private byte[] key = null;
- private byte[] algorithmKey = null;
- private byte[] alg = null;
- private byte[] outputFormat = null;
- private byte[] secret = null;
- private byte[] dataLength = null;
- private byte[] infoData = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getKeyTypeAsBin( ) {
-
- return this.keyType;
- }
-
-
- public String getKeyTypeAsStr( ) {
-
- if( null == this.keyType) return null;
- return Arrays.toString(this.keyType);
- }
-
-
- public String getKeyTypeAsHex( ) {
-
- if( null == this.keyType) return null;
- return Util.bytes2HexString(keyType);
- }
-
-
- public Data setKeyType( byte[] bytes ) {
-
- this.keyType = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getAlgorithmKeyAsBin( ) {
-
- return this.algorithmKey;
- }
-
-
- public String getAlgorithmKeyAsStr( ) {
-
- if( null == this.algorithmKey) return null;
- return Arrays.toString(this.algorithmKey);
- }
-
-
- public String getAlgorithmKeyAsHex( ) {
-
- if( null == this.algorithmKey) return null;
- return Util.bytes2HexString(algorithmKey);
- }
-
-
- public Data setAlgorithmKey( byte[] bytes ) {
-
- this.algorithmKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVIDEA(Util.hexString2Bytes("30")),
- OPVSM1(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "IDEA";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM1";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getOutputFormatAsBin( ) {
-
- return this.outputFormat;
- }
-
-
- public String getOutputFormatAsStr( ) {
-
- if( null == this.outputFormat) return null;
- return Arrays.toString(this.outputFormat);
- }
-
-
- public String getOutputFormatAsHex( ) {
-
- if( null == this.outputFormat) return null;
- return Util.bytes2HexString(outputFormat);
- }
-
-
- public Data setOutputFormat( byte[] bytes ) {
-
- this.outputFormat = bytes;
- return this;
- }
-public enum OutputFormatOptions {
-
- OPV软MD5后前8与后8异或后加密密押取前4位并转为8字节的HEX格式(Util.hexString2Bytes("30")),
- OPV软MD5后取前8字节加密输出8节的BIN格式(Util.hexString2Bytes("31"));
- private byte[] bin;
- OutputFormatOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getOutputFormatCn( ) {
-
- if( null == outputFormat) { return null; }
- if( "30".equals(Util.bytes2HexString(this.outputFormat))) {
- return "软MD5后前8与后8异或后加密,密押取前4位并转为8字节的HEX格式";
- }
- if( "31".equals(Util.bytes2HexString(this.outputFormat))) {
- return "软MD5后取前8字节加密,输出8节的BIN格式";
- }
- return null;
- }
-
-
- public Integer getOutputFormatOptionIndex( ) {
-
- if( null == outputFormat) { return null; }
- if( "30".equals(Util.bytes2HexString(this.outputFormat))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.outputFormat))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getSecretAsBin( ) {
-
- return this.secret;
- }
-
-
- public String getSecretAsStr( ) {
-
- if( null == this.secret) return null;
- return Arrays.toString(this.secret);
- }
-
-
- public String getSecretAsHex( ) {
-
- if( null == this.secret) return null;
- return Util.bytes2HexString(secret);
- }
-
-
- public Data setSecret( byte[] bytes ) {
-
- this.secret = bytes;
- return this;
- }
-
-
- public byte[] getDataLengthAsBin( ) {
-
- return this.dataLength;
- }
-
-
- public String getDataLengthAsStr( ) {
-
- if( null == this.dataLength) return null;
- return Arrays.toString(this.dataLength);
- }
-
-
- public String getDataLengthAsHex( ) {
-
- if( null == this.dataLength) return null;
- return Util.bytes2HexString(dataLength);
- }
-
-
- public Data setDataLength( byte[] bytes ) {
-
- this.dataLength = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataAsBin( ) {
-
- return this.infoData;
- }
-
-
- public String getInfoDataAsStr( ) {
-
- if( null == this.infoData) return null;
- return Arrays.toString(this.infoData);
- }
-
-
- public String getInfoDataAsHex( ) {
-
- if( null == this.infoData) return null;
- return Util.bytes2HexString(infoData);
- }
-
-
- public Data setInfoData( byte[] bytes ) {
-
- this.infoData = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != keyType ){
- soup.put("keyType", this.keyType);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != algorithmKey ){
- soup.put("AlgorithmKey", this.algorithmKey);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != outputFormat ){
- soup.put("outputFormat", this.outputFormat);
- soup.put("outputFormat$option", getOutputFormatOptionIndex());
- }
-
- if( null != secret ){
- soup.put("secret", this.secret);
- }
-
- if( null != dataLength ){
- soup.put("dataLength", this.dataLength);
- }
-
- if( null != infoData ){
- soup.put("infoData", this.infoData);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("keyType") ){
- this.keyType = ((PacketSection) soup.get("keyType")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey") ){
- this.algorithmKey = ((PacketSection) soup.get("AlgorithmKey")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("outputFormat") ){
- this.outputFormat = ((PacketSection) soup.get("outputFormat")).getBytes();
- }
-
- if( soup.containsKey("secret") ){
- this.secret = ((PacketSection) soup.get("secret")).getBytes();
- }
-
- if( soup.containsKey("dataLength") ){
- this.dataLength = ((PacketSection) soup.get("dataLength")).getBytes();
- }
-
- if( soup.containsKey("infoData") ){
- this.infoData = ((PacketSection) soup.get("infoData")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3633"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3633");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV密钥方案错误(Util.hexString2Bytes("3236")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "密钥方案错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- return null;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3634"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3634");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO64.java b/src/main/java/racal/sunyard/main/dto/DTO64.java
deleted file mode 100644
index 22b2ddb..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO64.java
+++ /dev/null
@@ -1,1049 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO64 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] keyType = null;
- private byte[] key = null;
- private byte[] log = null;
- private byte[] algorithmKey = null;
- private byte[] alg = null;
- private byte[] dataLength = null;
- private byte[] infoData = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getKeyTypeAsBin( ) {
-
- return this.keyType;
- }
-
-
- public String getKeyTypeAsStr( ) {
-
- if( null == this.keyType) return null;
- return Arrays.toString(this.keyType);
- }
-
-
- public String getKeyTypeAsHex( ) {
-
- if( null == this.keyType) return null;
- return Util.bytes2HexString(keyType);
- }
-
-
- public Data setKeyType( byte[] bytes ) {
-
- this.keyType = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getLogAsBin( ) {
-
- return this.log;
- }
-
-
- public String getLogAsStr( ) {
-
- if( null == this.log) return null;
- return Arrays.toString(this.log);
- }
-
-
- public String getLogAsHex( ) {
-
- if( null == this.log) return null;
- return Util.bytes2HexString(log);
- }
-
-
- public Data setLog( byte[] bytes ) {
-
- this.log = bytes;
- return this;
- }
-public enum LogOptions {
-
- OPV加密(Util.hexString2Bytes("30")),
- OPV解密(Util.hexString2Bytes("31"));
- private byte[] bin;
- LogOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getLogCn( ) {
-
- if( null == log) { return null; }
- if( "30".equals(Util.bytes2HexString(this.log))) {
- return "加密";
- }
- if( "31".equals(Util.bytes2HexString(this.log))) {
- return "解密";
- }
- return null;
- }
-
-
- public Integer getLogOptionIndex( ) {
-
- if( null == log) { return null; }
- if( "30".equals(Util.bytes2HexString(this.log))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.log))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getAlgorithmKeyAsBin( ) {
-
- return this.algorithmKey;
- }
-
-
- public String getAlgorithmKeyAsStr( ) {
-
- if( null == this.algorithmKey) return null;
- return Arrays.toString(this.algorithmKey);
- }
-
-
- public String getAlgorithmKeyAsHex( ) {
-
- if( null == this.algorithmKey) return null;
- return Util.bytes2HexString(algorithmKey);
- }
-
-
- public Data setAlgorithmKey( byte[] bytes ) {
-
- this.algorithmKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVIDEA(Util.hexString2Bytes("30")),
- OPVSM1(Util.hexString2Bytes("31")),
- OPV3DES(Util.hexString2Bytes("32")),
- OPVSM4(Util.hexString2Bytes("33"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "IDEA";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM1";
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return "3DES";
- }
- if( "33".equals(Util.bytes2HexString(this.alg))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return 2;
- }
- if( "33".equals(Util.bytes2HexString(this.alg))) {
- return 3;
- }
- return null;
- }
-
-
- public byte[] getDataLengthAsBin( ) {
-
- return this.dataLength;
- }
-
-
- public String getDataLengthAsStr( ) {
-
- if( null == this.dataLength) return null;
- return Arrays.toString(this.dataLength);
- }
-
-
- public String getDataLengthAsHex( ) {
-
- if( null == this.dataLength) return null;
- return Util.bytes2HexString(dataLength);
- }
-
-
- public Data setDataLength( byte[] bytes ) {
-
- this.dataLength = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataAsBin( ) {
-
- return this.infoData;
- }
-
-
- public String getInfoDataAsStr( ) {
-
- if( null == this.infoData) return null;
- return Arrays.toString(this.infoData);
- }
-
-
- public String getInfoDataAsHex( ) {
-
- if( null == this.infoData) return null;
- return Util.bytes2HexString(infoData);
- }
-
-
- public Data setInfoData( byte[] bytes ) {
-
- this.infoData = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != keyType ){
- soup.put("keyType", this.keyType);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != log ){
- soup.put("log", this.log);
- soup.put("log$option", getLogOptionIndex());
- }
-
- if( null != algorithmKey ){
- soup.put("AlgorithmKey", this.algorithmKey);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != dataLength ){
- soup.put("dataLength", this.dataLength);
- }
-
- if( null != infoData ){
- soup.put("infoData", this.infoData);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("keyType") ){
- this.keyType = ((PacketSection) soup.get("keyType")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("log") ){
- this.log = ((PacketSection) soup.get("log")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey") ){
- this.algorithmKey = ((PacketSection) soup.get("AlgorithmKey")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("dataLength") ){
- this.dataLength = ((PacketSection) soup.get("dataLength")).getBytes();
- }
-
- if( soup.containsKey("infoData") ){
- this.infoData = ((PacketSection) soup.get("infoData")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3634"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3634");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] infoLen = null;
- private byte[] info = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV密钥方案错误(Util.hexString2Bytes("3236")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "密钥方案错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- return null;
- }
-
-
- public byte[] getInfoLenAsBin( ) {
-
- return this.infoLen;
- }
-
-
- public String getInfoLenAsStr( ) {
-
- if( null == this.infoLen) return null;
- return Arrays.toString(this.infoLen);
- }
-
-
- public String getInfoLenAsHex( ) {
-
- if( null == this.infoLen) return null;
- return Util.bytes2HexString(infoLen);
- }
-
-
- public Data setInfoLen( byte[] bytes ) {
-
- this.infoLen = bytes;
- return this;
- }
-
-
- public byte[] getInfoAsBin( ) {
-
- return this.info;
- }
-
-
- public String getInfoAsStr( ) {
-
- if( null == this.info) return null;
- return Arrays.toString(this.info);
- }
-
-
- public String getInfoAsHex( ) {
-
- if( null == this.info) return null;
- return Util.bytes2HexString(info);
- }
-
-
- public Data setInfo( byte[] bytes ) {
-
- this.info = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != infoLen ){
- soup.put("infoLen", this.infoLen);
- }
-
- if( null != info ){
- soup.put("info", this.info);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("infoLen") ){
- this.infoLen = ((PacketSection) soup.get("infoLen")).getBytes();
- }
-
- if( soup.containsKey("info") ){
- this.info = ((PacketSection) soup.get("info")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3635"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3635");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO65.java b/src/main/java/racal/sunyard/main/dto/DTO65.java
deleted file mode 100644
index 8d6cbf0..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO65.java
+++ /dev/null
@@ -1,1011 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO65 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] keyType = null;
- private byte[] srcKey = null;
- private byte[] aimKey = null;
- private byte[] algorithmKey = null;
- private byte[] alg = null;
- private byte[] dataLength = null;
- private byte[] infoData = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getKeyTypeAsBin( ) {
-
- return this.keyType;
- }
-
-
- public String getKeyTypeAsStr( ) {
-
- if( null == this.keyType) return null;
- return Arrays.toString(this.keyType);
- }
-
-
- public String getKeyTypeAsHex( ) {
-
- if( null == this.keyType) return null;
- return Util.bytes2HexString(keyType);
- }
-
-
- public Data setKeyType( byte[] bytes ) {
-
- this.keyType = bytes;
- return this;
- }
-
-
- public byte[] getSrcKeyAsBin( ) {
-
- return this.srcKey;
- }
-
-
- public String getSrcKeyAsStr( ) {
-
- if( null == this.srcKey) return null;
- return Arrays.toString(this.srcKey);
- }
-
-
- public String getSrcKeyAsHex( ) {
-
- if( null == this.srcKey) return null;
- return Util.bytes2HexString(srcKey);
- }
-
-
- public Data setSrcKey( byte[] bytes ) {
-
- this.srcKey = bytes;
- return this;
- }
-
-
- public byte[] getAimKeyAsBin( ) {
-
- return this.aimKey;
- }
-
-
- public String getAimKeyAsStr( ) {
-
- if( null == this.aimKey) return null;
- return Arrays.toString(this.aimKey);
- }
-
-
- public String getAimKeyAsHex( ) {
-
- if( null == this.aimKey) return null;
- return Util.bytes2HexString(aimKey);
- }
-
-
- public Data setAimKey( byte[] bytes ) {
-
- this.aimKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgorithmKeyAsBin( ) {
-
- return this.algorithmKey;
- }
-
-
- public String getAlgorithmKeyAsStr( ) {
-
- if( null == this.algorithmKey) return null;
- return Arrays.toString(this.algorithmKey);
- }
-
-
- public String getAlgorithmKeyAsHex( ) {
-
- if( null == this.algorithmKey) return null;
- return Util.bytes2HexString(algorithmKey);
- }
-
-
- public Data setAlgorithmKey( byte[] bytes ) {
-
- this.algorithmKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVIDEA(Util.hexString2Bytes("30")),
- OPVSM1(Util.hexString2Bytes("31")),
- OPV3DES(Util.hexString2Bytes("32")),
- OPVSM4(Util.hexString2Bytes("33"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "IDEA";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM1";
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return "3DES";
- }
- if( "33".equals(Util.bytes2HexString(this.alg))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- if( "32".equals(Util.bytes2HexString(this.alg))) {
- return 2;
- }
- if( "33".equals(Util.bytes2HexString(this.alg))) {
- return 3;
- }
- return null;
- }
-
-
- public byte[] getDataLengthAsBin( ) {
-
- return this.dataLength;
- }
-
-
- public String getDataLengthAsStr( ) {
-
- if( null == this.dataLength) return null;
- return Arrays.toString(this.dataLength);
- }
-
-
- public String getDataLengthAsHex( ) {
-
- if( null == this.dataLength) return null;
- return Util.bytes2HexString(dataLength);
- }
-
-
- public Data setDataLength( byte[] bytes ) {
-
- this.dataLength = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataAsBin( ) {
-
- return this.infoData;
- }
-
-
- public String getInfoDataAsStr( ) {
-
- if( null == this.infoData) return null;
- return Arrays.toString(this.infoData);
- }
-
-
- public String getInfoDataAsHex( ) {
-
- if( null == this.infoData) return null;
- return Util.bytes2HexString(infoData);
- }
-
-
- public Data setInfoData( byte[] bytes ) {
-
- this.infoData = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != keyType ){
- soup.put("keyType", this.keyType);
- }
-
- if( null != srcKey ){
- soup.put("srcKey", this.srcKey);
- }
-
- if( null != aimKey ){
- soup.put("aimKey", this.aimKey);
- }
-
- if( null != algorithmKey ){
- soup.put("AlgorithmKey", this.algorithmKey);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != dataLength ){
- soup.put("dataLength", this.dataLength);
- }
-
- if( null != infoData ){
- soup.put("infoData", this.infoData);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("keyType") ){
- this.keyType = ((PacketSection) soup.get("keyType")).getBytes();
- }
-
- if( soup.containsKey("srcKey") ){
- this.srcKey = ((PacketSection) soup.get("srcKey")).getBytes();
- }
-
- if( soup.containsKey("aimKey") ){
- this.aimKey = ((PacketSection) soup.get("aimKey")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey") ){
- this.algorithmKey = ((PacketSection) soup.get("AlgorithmKey")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("dataLength") ){
- this.dataLength = ((PacketSection) soup.get("dataLength")).getBytes();
- }
-
- if( soup.containsKey("infoData") ){
- this.infoData = ((PacketSection) soup.get("infoData")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3635"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3635");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] infoLen = null;
- private byte[] info = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV用户存储区没有装载密钥(Util.hexString2Bytes("3132")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV无效的用户存储索引(Util.hexString2Bytes("3231")),
- OPV密钥方案错误(Util.hexString2Bytes("3236")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return "用户存储区没有装载密钥";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return "无效的用户存储索引";
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return "密钥方案错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3132".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3231".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3236".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- return null;
- }
-
-
- public byte[] getInfoLenAsBin( ) {
-
- return this.infoLen;
- }
-
-
- public String getInfoLenAsStr( ) {
-
- if( null == this.infoLen) return null;
- return Arrays.toString(this.infoLen);
- }
-
-
- public String getInfoLenAsHex( ) {
-
- if( null == this.infoLen) return null;
- return Util.bytes2HexString(infoLen);
- }
-
-
- public Data setInfoLen( byte[] bytes ) {
-
- this.infoLen = bytes;
- return this;
- }
-
-
- public byte[] getInfoAsBin( ) {
-
- return this.info;
- }
-
-
- public String getInfoAsStr( ) {
-
- if( null == this.info) return null;
- return Arrays.toString(this.info);
- }
-
-
- public String getInfoAsHex( ) {
-
- if( null == this.info) return null;
- return Util.bytes2HexString(info);
- }
-
-
- public Data setInfo( byte[] bytes ) {
-
- this.info = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != infoLen ){
- soup.put("infoLen", this.infoLen);
- }
-
- if( null != info ){
- soup.put("info", this.info);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("infoLen") ){
- this.infoLen = ((PacketSection) soup.get("infoLen")).getBytes();
- }
-
- if( soup.containsKey("info") ){
- this.info = ((PacketSection) soup.get("info")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3636"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3636");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO66.java b/src/main/java/racal/sunyard/main/dto/DTO66.java
deleted file mode 100644
index 36ef232..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO66.java
+++ /dev/null
@@ -1,906 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO66 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] key = null;
- private byte[] log = null;
- private byte[] algorithmKey = null;
- private byte[] alg = null;
- private byte[] pin = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getLogAsBin( ) {
-
- return this.log;
- }
-
-
- public String getLogAsStr( ) {
-
- if( null == this.log) return null;
- return Arrays.toString(this.log);
- }
-
-
- public String getLogAsHex( ) {
-
- if( null == this.log) return null;
- return Util.bytes2HexString(log);
- }
-
-
- public Data setLog( byte[] bytes ) {
-
- this.log = bytes;
- return this;
- }
-public enum LogOptions {
-
- OPV加密(Util.hexString2Bytes("30")),
- OPV解密(Util.hexString2Bytes("31"));
- private byte[] bin;
- LogOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getLogCn( ) {
-
- if( null == log) { return null; }
- if( "30".equals(Util.bytes2HexString(this.log))) {
- return "加密";
- }
- if( "31".equals(Util.bytes2HexString(this.log))) {
- return "解密";
- }
- return null;
- }
-
-
- public Integer getLogOptionIndex( ) {
-
- if( null == log) { return null; }
- if( "30".equals(Util.bytes2HexString(this.log))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.log))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getAlgorithmKeyAsBin( ) {
-
- return this.algorithmKey;
- }
-
-
- public String getAlgorithmKeyAsStr( ) {
-
- if( null == this.algorithmKey) return null;
- return Arrays.toString(this.algorithmKey);
- }
-
-
- public String getAlgorithmKeyAsHex( ) {
-
- if( null == this.algorithmKey) return null;
- return Util.bytes2HexString(algorithmKey);
- }
-
-
- public Data setAlgorithmKey( byte[] bytes ) {
-
- this.algorithmKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPV3DES(Util.hexString2Bytes("30")),
- OPVSM4(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "3DES";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getPinAsBin( ) {
-
- return this.pin;
- }
-
-
- public String getPinAsStr( ) {
-
- if( null == this.pin) return null;
- return Arrays.toString(this.pin);
- }
-
-
- public String getPinAsHex( ) {
-
- if( null == this.pin) return null;
- return Util.bytes2HexString(pin);
- }
-
-
- public Data setPin( byte[] bytes ) {
-
- this.pin = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != log ){
- soup.put("log", this.log);
- soup.put("log$option", getLogOptionIndex());
- }
-
- if( null != algorithmKey ){
- soup.put("AlgorithmKey", this.algorithmKey);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != pin ){
- soup.put("pin", this.pin);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("log") ){
- this.log = ((PacketSection) soup.get("log")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey") ){
- this.algorithmKey = ((PacketSection) soup.get("AlgorithmKey")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("pin") ){
- this.pin = ((PacketSection) soup.get("pin")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3636"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3636");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] info = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV不在授权状态(Util.hexString2Bytes("3137"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return "不在授权状态";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- return null;
- }
-
-
- public byte[] getInfoAsBin( ) {
-
- return this.info;
- }
-
-
- public String getInfoAsStr( ) {
-
- if( null == this.info) return null;
- return Arrays.toString(this.info);
- }
-
-
- public String getInfoAsHex( ) {
-
- if( null == this.info) return null;
- return Util.bytes2HexString(info);
- }
-
-
- public Data setInfo( byte[] bytes ) {
-
- this.info = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != info ){
- soup.put("info", this.info);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("info") ){
- this.info = ((PacketSection) soup.get("info")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3637"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3637");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO67.java b/src/main/java/racal/sunyard/main/dto/DTO67.java
deleted file mode 100644
index 81fe856..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO67.java
+++ /dev/null
@@ -1,868 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO67 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] srcKey = null;
- private byte[] aimKey = null;
- private byte[] algorithmKey = null;
- private byte[] alg = null;
- private byte[] pin = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getSrcKeyAsBin( ) {
-
- return this.srcKey;
- }
-
-
- public String getSrcKeyAsStr( ) {
-
- if( null == this.srcKey) return null;
- return Arrays.toString(this.srcKey);
- }
-
-
- public String getSrcKeyAsHex( ) {
-
- if( null == this.srcKey) return null;
- return Util.bytes2HexString(srcKey);
- }
-
-
- public Data setSrcKey( byte[] bytes ) {
-
- this.srcKey = bytes;
- return this;
- }
-
-
- public byte[] getAimKeyAsBin( ) {
-
- return this.aimKey;
- }
-
-
- public String getAimKeyAsStr( ) {
-
- if( null == this.aimKey) return null;
- return Arrays.toString(this.aimKey);
- }
-
-
- public String getAimKeyAsHex( ) {
-
- if( null == this.aimKey) return null;
- return Util.bytes2HexString(aimKey);
- }
-
-
- public Data setAimKey( byte[] bytes ) {
-
- this.aimKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgorithmKeyAsBin( ) {
-
- return this.algorithmKey;
- }
-
-
- public String getAlgorithmKeyAsStr( ) {
-
- if( null == this.algorithmKey) return null;
- return Arrays.toString(this.algorithmKey);
- }
-
-
- public String getAlgorithmKeyAsHex( ) {
-
- if( null == this.algorithmKey) return null;
- return Util.bytes2HexString(algorithmKey);
- }
-
-
- public Data setAlgorithmKey( byte[] bytes ) {
-
- this.algorithmKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPV3DES(Util.hexString2Bytes("30")),
- OPVSM4(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "3DES";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getPinAsBin( ) {
-
- return this.pin;
- }
-
-
- public String getPinAsStr( ) {
-
- if( null == this.pin) return null;
- return Arrays.toString(this.pin);
- }
-
-
- public String getPinAsHex( ) {
-
- if( null == this.pin) return null;
- return Util.bytes2HexString(pin);
- }
-
-
- public Data setPin( byte[] bytes ) {
-
- this.pin = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != srcKey ){
- soup.put("srcKey", this.srcKey);
- }
-
- if( null != aimKey ){
- soup.put("aimKey", this.aimKey);
- }
-
- if( null != algorithmKey ){
- soup.put("AlgorithmKey", this.algorithmKey);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != pin ){
- soup.put("pin", this.pin);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("srcKey") ){
- this.srcKey = ((PacketSection) soup.get("srcKey")).getBytes();
- }
-
- if( soup.containsKey("aimKey") ){
- this.aimKey = ((PacketSection) soup.get("aimKey")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey") ){
- this.algorithmKey = ((PacketSection) soup.get("AlgorithmKey")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("pin") ){
- this.pin = ((PacketSection) soup.get("pin")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3637"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3637");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] info = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPV不在授权状态(Util.hexString2Bytes("3137"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return "不在授权状态";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3137".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- return null;
- }
-
-
- public byte[] getInfoAsBin( ) {
-
- return this.info;
- }
-
-
- public String getInfoAsStr( ) {
-
- if( null == this.info) return null;
- return Arrays.toString(this.info);
- }
-
-
- public String getInfoAsHex( ) {
-
- if( null == this.info) return null;
- return Util.bytes2HexString(info);
- }
-
-
- public Data setInfo( byte[] bytes ) {
-
- this.info = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != info ){
- soup.put("info", this.info);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("info") ){
- this.info = ((PacketSection) soup.get("info")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3638"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3638");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO68.java b/src/main/java/racal/sunyard/main/dto/DTO68.java
deleted file mode 100644
index 755ac25..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO68.java
+++ /dev/null
@@ -1,1276 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO68 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] dEK = null;
- private byte[] infoDataLen = null;
- private byte[] infoData = null;
- private byte[] alg = null;
- private byte[] fillKey = null;
- private byte[] publicKeyLen = null;
- private byte[] publicKey = null;
- private byte[] algorithmKey1 = null;
- private byte[] encryAlgorithm1 = null;
- private byte[] algorithmKey2 = null;
- private byte[] encryAlgorithm2 = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getDEKAsBin( ) {
-
- return this.dEK;
- }
-
-
- public String getDEKAsStr( ) {
-
- if( null == this.dEK) return null;
- return Arrays.toString(this.dEK);
- }
-
-
- public String getDEKAsHex( ) {
-
- if( null == this.dEK) return null;
- return Util.bytes2HexString(dEK);
- }
-
-
- public Data setDEK( byte[] bytes ) {
-
- this.dEK = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataLenAsBin( ) {
-
- return this.infoDataLen;
- }
-
-
- public String getInfoDataLenAsStr( ) {
-
- if( null == this.infoDataLen) return null;
- return Arrays.toString(this.infoDataLen);
- }
-
-
- public String getInfoDataLenAsHex( ) {
-
- if( null == this.infoDataLen) return null;
- return Util.bytes2HexString(infoDataLen);
- }
-
-
- public Data setInfoDataLen( byte[] bytes ) {
-
- this.infoDataLen = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataAsBin( ) {
-
- return this.infoData;
- }
-
-
- public String getInfoDataAsStr( ) {
-
- if( null == this.infoData) return null;
- return Arrays.toString(this.infoData);
- }
-
-
- public String getInfoDataAsHex( ) {
-
- if( null == this.infoData) return null;
- return Util.bytes2HexString(infoData);
- }
-
-
- public Data setInfoData( byte[] bytes ) {
-
- this.infoData = bytes;
- return this;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVRSA(Util.hexString2Bytes("30")),
- OPVSM2(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "RSA";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM2";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getFillKeyAsBin( ) {
-
- return this.fillKey;
- }
-
-
- public String getFillKeyAsStr( ) {
-
- if( null == this.fillKey) return null;
- return Arrays.toString(this.fillKey);
- }
-
-
- public String getFillKeyAsHex( ) {
-
- if( null == this.fillKey) return null;
- return Util.bytes2HexString(fillKey);
- }
-
-
- public Data setFillKey( byte[] bytes ) {
-
- this.fillKey = bytes;
- return this;
- }
-public enum FillKeyOptions {
-
- OPV数据长度必须等于密钥长度DER对应的数据长度(Util.hexString2Bytes("30")),
- OPVPKCS1v15填充方式(Util.hexString2Bytes("31"));
- private byte[] bin;
- FillKeyOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getFillKeyCn( ) {
-
- if( null == fillKey) { return null; }
- if( "30".equals(Util.bytes2HexString(this.fillKey))) {
- return "数据长度必须等于密钥长度(DER对应的数据长度)";
- }
- if( "31".equals(Util.bytes2HexString(this.fillKey))) {
- return "PKCS#1 v1.5 填充方式";
- }
- return null;
- }
-
-
- public Integer getFillKeyOptionIndex( ) {
-
- if( null == fillKey) { return null; }
- if( "30".equals(Util.bytes2HexString(this.fillKey))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.fillKey))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getPublicKeyLenAsBin( ) {
-
- return this.publicKeyLen;
- }
-
-
- public String getPublicKeyLenAsStr( ) {
-
- if( null == this.publicKeyLen) return null;
- return Arrays.toString(this.publicKeyLen);
- }
-
-
- public String getPublicKeyLenAsHex( ) {
-
- if( null == this.publicKeyLen) return null;
- return Util.bytes2HexString(publicKeyLen);
- }
-
-
- public Data setPublicKeyLen( byte[] bytes ) {
-
- this.publicKeyLen = bytes;
- return this;
- }
-
-
- public byte[] getPublicKeyAsBin( ) {
-
- return this.publicKey;
- }
-
-
- public String getPublicKeyAsStr( ) {
-
- if( null == this.publicKey) return null;
- return Arrays.toString(this.publicKey);
- }
-
-
- public String getPublicKeyAsHex( ) {
-
- if( null == this.publicKey) return null;
- return Util.bytes2HexString(publicKey);
- }
-
-
- public Data setPublicKey( byte[] bytes ) {
-
- this.publicKey = bytes;
- return this;
- }
-
-
- public byte[] getAlgorithmKey1AsBin( ) {
-
- return this.algorithmKey1;
- }
-
-
- public String getAlgorithmKey1AsStr( ) {
-
- if( null == this.algorithmKey1) return null;
- return Arrays.toString(this.algorithmKey1);
- }
-
-
- public String getAlgorithmKey1AsHex( ) {
-
- if( null == this.algorithmKey1) return null;
- return Util.bytes2HexString(algorithmKey1);
- }
-
-
- public Data setAlgorithmKey1( byte[] bytes ) {
-
- this.algorithmKey1 = bytes;
- return this;
- }
-
-
- public byte[] getEncryAlgorithm1AsBin( ) {
-
- return this.encryAlgorithm1;
- }
-
-
- public String getEncryAlgorithm1AsStr( ) {
-
- if( null == this.encryAlgorithm1) return null;
- return Arrays.toString(this.encryAlgorithm1);
- }
-
-
- public String getEncryAlgorithm1AsHex( ) {
-
- if( null == this.encryAlgorithm1) return null;
- return Util.bytes2HexString(encryAlgorithm1);
- }
-
-
- public Data setEncryAlgorithm1( byte[] bytes ) {
-
- this.encryAlgorithm1 = bytes;
- return this;
- }
-public enum EncryAlgorithm1Options {
-
- OPV3DES(Util.hexString2Bytes("30")),
- OPVSM4(Util.hexString2Bytes("31"));
- private byte[] bin;
- EncryAlgorithm1Options(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getEncryAlgorithm1Cn( ) {
-
- if( null == encryAlgorithm1) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return "3DES";
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getEncryAlgorithm1OptionIndex( ) {
-
- if( null == encryAlgorithm1) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getAlgorithmKey2AsBin( ) {
-
- return this.algorithmKey2;
- }
-
-
- public String getAlgorithmKey2AsStr( ) {
-
- if( null == this.algorithmKey2) return null;
- return Arrays.toString(this.algorithmKey2);
- }
-
-
- public String getAlgorithmKey2AsHex( ) {
-
- if( null == this.algorithmKey2) return null;
- return Util.bytes2HexString(algorithmKey2);
- }
-
-
- public Data setAlgorithmKey2( byte[] bytes ) {
-
- this.algorithmKey2 = bytes;
- return this;
- }
-
-
- public byte[] getEncryAlgorithm2AsBin( ) {
-
- return this.encryAlgorithm2;
- }
-
-
- public String getEncryAlgorithm2AsStr( ) {
-
- if( null == this.encryAlgorithm2) return null;
- return Arrays.toString(this.encryAlgorithm2);
- }
-
-
- public String getEncryAlgorithm2AsHex( ) {
-
- if( null == this.encryAlgorithm2) return null;
- return Util.bytes2HexString(encryAlgorithm2);
- }
-
-
- public Data setEncryAlgorithm2( byte[] bytes ) {
-
- this.encryAlgorithm2 = bytes;
- return this;
- }
-public enum EncryAlgorithm2Options {
-
- OPVECB(Util.hexString2Bytes("30")),
- OPVCBC(Util.hexString2Bytes("31"));
- private byte[] bin;
- EncryAlgorithm2Options(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getEncryAlgorithm2Cn( ) {
-
- if( null == encryAlgorithm2) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return "ECB";
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return "CBC";
- }
- return null;
- }
-
-
- public Integer getEncryAlgorithm2OptionIndex( ) {
-
- if( null == encryAlgorithm2) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != dEK ){
- soup.put("DEK", this.dEK);
- }
-
- if( null != infoDataLen ){
- soup.put("infoDataLen", this.infoDataLen);
- }
-
- if( null != infoData ){
- soup.put("infoData", this.infoData);
- }
-
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != fillKey ){
- soup.put("fillKey", this.fillKey);
- soup.put("fillKey$option", getFillKeyOptionIndex());
- }
-
- if( null != publicKeyLen ){
- soup.put("publicKeyLen", this.publicKeyLen);
- }
-
- if( null != publicKey ){
- soup.put("publicKey", this.publicKey);
- }
-
- if( null != algorithmKey1 ){
- soup.put("AlgorithmKey1", this.algorithmKey1);
- }
-
- if( null != encryAlgorithm1 ){
- soup.put("EncryAlgorithm1", this.encryAlgorithm1);
- soup.put("EncryAlgorithm1$option", getEncryAlgorithm1OptionIndex());
- }
-
- if( null != algorithmKey2 ){
- soup.put("AlgorithmKey2", this.algorithmKey2);
- }
-
- if( null != encryAlgorithm2 ){
- soup.put("EncryAlgorithm2", this.encryAlgorithm2);
- soup.put("EncryAlgorithm2$option", getEncryAlgorithm2OptionIndex());
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("DEK") ){
- this.dEK = ((PacketSection) soup.get("DEK")).getBytes();
- }
-
- if( soup.containsKey("infoDataLen") ){
- this.infoDataLen = ((PacketSection) soup.get("infoDataLen")).getBytes();
- }
-
- if( soup.containsKey("infoData") ){
- this.infoData = ((PacketSection) soup.get("infoData")).getBytes();
- }
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("fillKey") ){
- this.fillKey = ((PacketSection) soup.get("fillKey")).getBytes();
- }
-
- if( soup.containsKey("publicKeyLen") ){
- this.publicKeyLen = ((PacketSection) soup.get("publicKeyLen")).getBytes();
- }
-
- if( soup.containsKey("publicKey") ){
- this.publicKey = ((PacketSection) soup.get("publicKey")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey1") ){
- this.algorithmKey1 = ((PacketSection) soup.get("AlgorithmKey1")).getBytes();
- }
-
- if( soup.containsKey("EncryAlgorithm1") ){
- this.encryAlgorithm1 = ((PacketSection) soup.get("EncryAlgorithm1")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey2") ){
- this.algorithmKey2 = ((PacketSection) soup.get("AlgorithmKey2")).getBytes();
- }
-
- if( soup.containsKey("EncryAlgorithm2") ){
- this.encryAlgorithm2 = ((PacketSection) soup.get("EncryAlgorithm2")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3638"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3638");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] keyLen = null;
- private byte[] key = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV公钥不符合编码规则(Util.hexString2Bytes("3034")),
- OPV无效的加密标识(Util.hexString2Bytes("3036")),
- OPV无效的附加模式标识(Util.hexString2Bytes("3037")),
- OPV密钥奇偶校验错误(Util.hexString2Bytes("3130")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPVDSP错误(Util.hexString2Bytes("3437")),
- OPV密钥块长度错误(Util.hexString2Bytes("3736")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3034".equals(Util.bytes2HexString(this.error))) {
- return "公钥不符合编码规则";
- }
- if( "3036".equals(Util.bytes2HexString(this.error))) {
- return "无效的加密标识";
- }
- if( "3037".equals(Util.bytes2HexString(this.error))) {
- return "无效的附加模式标识";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "密钥奇偶校验错误";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3437".equals(Util.bytes2HexString(this.error))) {
- return "DSP 错误";
- }
- if( "3736".equals(Util.bytes2HexString(this.error))) {
- return "密钥块长度错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3034".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3036".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3037".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3437".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3736".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 9;
- }
- return null;
- }
-
-
- public byte[] getKeyLenAsBin( ) {
-
- return this.keyLen;
- }
-
-
- public String getKeyLenAsStr( ) {
-
- if( null == this.keyLen) return null;
- return Arrays.toString(this.keyLen);
- }
-
-
- public String getKeyLenAsHex( ) {
-
- if( null == this.keyLen) return null;
- return Util.bytes2HexString(keyLen);
- }
-
-
- public Data setKeyLen( byte[] bytes ) {
-
- this.keyLen = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != keyLen ){
- soup.put("keyLen", this.keyLen);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("keyLen") ){
- this.keyLen = ((PacketSection) soup.get("keyLen")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3639"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3639");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO69.java b/src/main/java/racal/sunyard/main/dto/DTO69.java
deleted file mode 100644
index 1f9a889..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO69.java
+++ /dev/null
@@ -1,1319 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO69 {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] alg = null;
- private byte[] fillKey = null;
- private byte[] privateKeyTag = null;
- private byte[] privateKeyLength = null;
- private byte[] privateKey = null;
- private byte[] dataLength = null;
- private byte[] infoData = null;
- private byte[] dEK = null;
- private byte[] algorithmKey1 = null;
- private byte[] encryAlgorithm1 = null;
- private byte[] algorithmKey2 = null;
- private byte[] encryAlgorithm2 = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVRSA(Util.hexString2Bytes("30")),
- OPVSM2(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "RSA";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM2";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getFillKeyAsBin( ) {
-
- return this.fillKey;
- }
-
-
- public String getFillKeyAsStr( ) {
-
- if( null == this.fillKey) return null;
- return Arrays.toString(this.fillKey);
- }
-
-
- public String getFillKeyAsHex( ) {
-
- if( null == this.fillKey) return null;
- return Util.bytes2HexString(fillKey);
- }
-
-
- public Data setFillKey( byte[] bytes ) {
-
- this.fillKey = bytes;
- return this;
- }
-public enum FillKeyOptions {
-
- OPV数据长度必须等于密钥长度DER对应的数据长度(Util.hexString2Bytes("30")),
- OPVPKCS1v15填充方式(Util.hexString2Bytes("31"));
- private byte[] bin;
- FillKeyOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getFillKeyCn( ) {
-
- if( null == fillKey) { return null; }
- if( "30".equals(Util.bytes2HexString(this.fillKey))) {
- return "数据长度必须等于密钥长度(DER对应的数据长度)";
- }
- if( "31".equals(Util.bytes2HexString(this.fillKey))) {
- return "PKCS#1 v1.5 填充方式";
- }
- return null;
- }
-
-
- public Integer getFillKeyOptionIndex( ) {
-
- if( null == fillKey) { return null; }
- if( "30".equals(Util.bytes2HexString(this.fillKey))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.fillKey))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getPrivateKeyTagAsBin( ) {
-
- return this.privateKeyTag;
- }
-
-
- public String getPrivateKeyTagAsStr( ) {
-
- if( null == this.privateKeyTag) return null;
- return Arrays.toString(this.privateKeyTag);
- }
-
-
- public String getPrivateKeyTagAsHex( ) {
-
- if( null == this.privateKeyTag) return null;
- return Util.bytes2HexString(privateKeyTag);
- }
-
-
- public Data setPrivateKeyTag( byte[] bytes ) {
-
- this.privateKeyTag = bytes;
- return this;
- }
-
-
- public byte[] getPrivateKeyLengthAsBin( ) {
-
- return this.privateKeyLength;
- }
-
-
- public String getPrivateKeyLengthAsStr( ) {
-
- if( null == this.privateKeyLength) return null;
- return Arrays.toString(this.privateKeyLength);
- }
-
-
- public String getPrivateKeyLengthAsHex( ) {
-
- if( null == this.privateKeyLength) return null;
- return Util.bytes2HexString(privateKeyLength);
- }
-
-
- public Data setPrivateKeyLength( byte[] bytes ) {
-
- this.privateKeyLength = bytes;
- return this;
- }
-
-
- public byte[] getPrivateKeyAsBin( ) {
-
- return this.privateKey;
- }
-
-
- public String getPrivateKeyAsStr( ) {
-
- if( null == this.privateKey) return null;
- return Arrays.toString(this.privateKey);
- }
-
-
- public String getPrivateKeyAsHex( ) {
-
- if( null == this.privateKey) return null;
- return Util.bytes2HexString(privateKey);
- }
-
-
- public Data setPrivateKey( byte[] bytes ) {
-
- this.privateKey = bytes;
- return this;
- }
-
-
- public byte[] getDataLengthAsBin( ) {
-
- return this.dataLength;
- }
-
-
- public String getDataLengthAsStr( ) {
-
- if( null == this.dataLength) return null;
- return Arrays.toString(this.dataLength);
- }
-
-
- public String getDataLengthAsHex( ) {
-
- if( null == this.dataLength) return null;
- return Util.bytes2HexString(dataLength);
- }
-
-
- public Data setDataLength( byte[] bytes ) {
-
- this.dataLength = bytes;
- return this;
- }
-
-
- public byte[] getInfoDataAsBin( ) {
-
- return this.infoData;
- }
-
-
- public String getInfoDataAsStr( ) {
-
- if( null == this.infoData) return null;
- return Arrays.toString(this.infoData);
- }
-
-
- public String getInfoDataAsHex( ) {
-
- if( null == this.infoData) return null;
- return Util.bytes2HexString(infoData);
- }
-
-
- public Data setInfoData( byte[] bytes ) {
-
- this.infoData = bytes;
- return this;
- }
-
-
- public byte[] getDEKAsBin( ) {
-
- return this.dEK;
- }
-
-
- public String getDEKAsStr( ) {
-
- if( null == this.dEK) return null;
- return Arrays.toString(this.dEK);
- }
-
-
- public String getDEKAsHex( ) {
-
- if( null == this.dEK) return null;
- return Util.bytes2HexString(dEK);
- }
-
-
- public Data setDEK( byte[] bytes ) {
-
- this.dEK = bytes;
- return this;
- }
-
-
- public byte[] getAlgorithmKey1AsBin( ) {
-
- return this.algorithmKey1;
- }
-
-
- public String getAlgorithmKey1AsStr( ) {
-
- if( null == this.algorithmKey1) return null;
- return Arrays.toString(this.algorithmKey1);
- }
-
-
- public String getAlgorithmKey1AsHex( ) {
-
- if( null == this.algorithmKey1) return null;
- return Util.bytes2HexString(algorithmKey1);
- }
-
-
- public Data setAlgorithmKey1( byte[] bytes ) {
-
- this.algorithmKey1 = bytes;
- return this;
- }
-
-
- public byte[] getEncryAlgorithm1AsBin( ) {
-
- return this.encryAlgorithm1;
- }
-
-
- public String getEncryAlgorithm1AsStr( ) {
-
- if( null == this.encryAlgorithm1) return null;
- return Arrays.toString(this.encryAlgorithm1);
- }
-
-
- public String getEncryAlgorithm1AsHex( ) {
-
- if( null == this.encryAlgorithm1) return null;
- return Util.bytes2HexString(encryAlgorithm1);
- }
-
-
- public Data setEncryAlgorithm1( byte[] bytes ) {
-
- this.encryAlgorithm1 = bytes;
- return this;
- }
-public enum EncryAlgorithm1Options {
-
- OPV3DES(Util.hexString2Bytes("30")),
- OPVSM4(Util.hexString2Bytes("31"));
- private byte[] bin;
- EncryAlgorithm1Options(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getEncryAlgorithm1Cn( ) {
-
- if( null == encryAlgorithm1) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return "3DES";
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return "SM4";
- }
- return null;
- }
-
-
- public Integer getEncryAlgorithm1OptionIndex( ) {
-
- if( null == encryAlgorithm1) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm1))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getAlgorithmKey2AsBin( ) {
-
- return this.algorithmKey2;
- }
-
-
- public String getAlgorithmKey2AsStr( ) {
-
- if( null == this.algorithmKey2) return null;
- return Arrays.toString(this.algorithmKey2);
- }
-
-
- public String getAlgorithmKey2AsHex( ) {
-
- if( null == this.algorithmKey2) return null;
- return Util.bytes2HexString(algorithmKey2);
- }
-
-
- public Data setAlgorithmKey2( byte[] bytes ) {
-
- this.algorithmKey2 = bytes;
- return this;
- }
-
-
- public byte[] getEncryAlgorithm2AsBin( ) {
-
- return this.encryAlgorithm2;
- }
-
-
- public String getEncryAlgorithm2AsStr( ) {
-
- if( null == this.encryAlgorithm2) return null;
- return Arrays.toString(this.encryAlgorithm2);
- }
-
-
- public String getEncryAlgorithm2AsHex( ) {
-
- if( null == this.encryAlgorithm2) return null;
- return Util.bytes2HexString(encryAlgorithm2);
- }
-
-
- public Data setEncryAlgorithm2( byte[] bytes ) {
-
- this.encryAlgorithm2 = bytes;
- return this;
- }
-public enum EncryAlgorithm2Options {
-
- OPVECB(Util.hexString2Bytes("30")),
- OPVCBC(Util.hexString2Bytes("31"));
- private byte[] bin;
- EncryAlgorithm2Options(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getEncryAlgorithm2Cn( ) {
-
- if( null == encryAlgorithm2) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return "ECB";
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return "CBC";
- }
- return null;
- }
-
-
- public Integer getEncryAlgorithm2OptionIndex( ) {
-
- if( null == encryAlgorithm2) { return null; }
- if( "30".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.encryAlgorithm2))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != fillKey ){
- soup.put("fillKey", this.fillKey);
- soup.put("fillKey$option", getFillKeyOptionIndex());
- }
-
- if( null != privateKeyTag ){
- soup.put("privateKeyTag", this.privateKeyTag);
- }
-
- if( null != privateKeyLength ){
- soup.put("privateKeyLength", this.privateKeyLength);
- }
-
- if( null != privateKey ){
- soup.put("privateKey", this.privateKey);
- }
-
- if( null != dataLength ){
- soup.put("dataLength", this.dataLength);
- }
-
- if( null != infoData ){
- soup.put("infoData", this.infoData);
- }
-
- if( null != dEK ){
- soup.put("DEK", this.dEK);
- }
-
- if( null != algorithmKey1 ){
- soup.put("AlgorithmKey1", this.algorithmKey1);
- }
-
- if( null != encryAlgorithm1 ){
- soup.put("EncryAlgorithm1", this.encryAlgorithm1);
- soup.put("EncryAlgorithm1$option", getEncryAlgorithm1OptionIndex());
- }
-
- if( null != algorithmKey2 ){
- soup.put("AlgorithmKey2", this.algorithmKey2);
- }
-
- if( null != encryAlgorithm2 ){
- soup.put("EncryAlgorithm2", this.encryAlgorithm2);
- soup.put("EncryAlgorithm2$option", getEncryAlgorithm2OptionIndex());
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("fillKey") ){
- this.fillKey = ((PacketSection) soup.get("fillKey")).getBytes();
- }
-
- if( soup.containsKey("privateKeyTag") ){
- this.privateKeyTag = ((PacketSection) soup.get("privateKeyTag")).getBytes();
- }
-
- if( soup.containsKey("privateKeyLength") ){
- this.privateKeyLength = ((PacketSection) soup.get("privateKeyLength")).getBytes();
- }
-
- if( soup.containsKey("privateKey") ){
- this.privateKey = ((PacketSection) soup.get("privateKey")).getBytes();
- }
-
- if( soup.containsKey("dataLength") ){
- this.dataLength = ((PacketSection) soup.get("dataLength")).getBytes();
- }
-
- if( soup.containsKey("infoData") ){
- this.infoData = ((PacketSection) soup.get("infoData")).getBytes();
- }
-
- if( soup.containsKey("DEK") ){
- this.dEK = ((PacketSection) soup.get("DEK")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey1") ){
- this.algorithmKey1 = ((PacketSection) soup.get("AlgorithmKey1")).getBytes();
- }
-
- if( soup.containsKey("EncryAlgorithm1") ){
- this.encryAlgorithm1 = ((PacketSection) soup.get("EncryAlgorithm1")).getBytes();
- }
-
- if( soup.containsKey("AlgorithmKey2") ){
- this.algorithmKey2 = ((PacketSection) soup.get("AlgorithmKey2")).getBytes();
- }
-
- if( soup.containsKey("EncryAlgorithm2") ){
- this.encryAlgorithm2 = ((PacketSection) soup.get("EncryAlgorithm2")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3639"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3639");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] keyLen = null;
- private byte[] key = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV公钥不符合编码规则(Util.hexString2Bytes("3034")),
- OPV无效的对称密钥类型(Util.hexString2Bytes("3035")),
- OPV无效的加密标识(Util.hexString2Bytes("3036")),
- OPV无效的附加模式标识(Util.hexString2Bytes("3037")),
- OPV密钥奇偶校验错误(Util.hexString2Bytes("3130")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPVDSP错误(Util.hexString2Bytes("3437")),
- OPV密钥块长度错误(Util.hexString2Bytes("3736")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3034".equals(Util.bytes2HexString(this.error))) {
- return "公钥不符合编码规则";
- }
- if( "3035".equals(Util.bytes2HexString(this.error))) {
- return "无效的对称密钥类型";
- }
- if( "3036".equals(Util.bytes2HexString(this.error))) {
- return "无效的加密标识";
- }
- if( "3037".equals(Util.bytes2HexString(this.error))) {
- return "无效的附加模式标识";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "密钥奇偶校验错误";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3437".equals(Util.bytes2HexString(this.error))) {
- return "DSP 错误";
- }
- if( "3736".equals(Util.bytes2HexString(this.error))) {
- return "密钥块长度错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3034".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3035".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3036".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3037".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3437".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- if( "3736".equals(Util.bytes2HexString(this.error))) {
- return 9;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 10;
- }
- return null;
- }
-
-
- public byte[] getKeyLenAsBin( ) {
-
- return this.keyLen;
- }
-
-
- public String getKeyLenAsStr( ) {
-
- if( null == this.keyLen) return null;
- return Arrays.toString(this.keyLen);
- }
-
-
- public String getKeyLenAsHex( ) {
-
- if( null == this.keyLen) return null;
- return Util.bytes2HexString(keyLen);
- }
-
-
- public Data setKeyLen( byte[] bytes ) {
-
- this.keyLen = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != keyLen ){
- soup.put("keyLen", this.keyLen);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("keyLen") ){
- this.keyLen = ((PacketSection) soup.get("keyLen")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3641"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3641");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO6A.java b/src/main/java/racal/sunyard/main/dto/DTO6A.java
deleted file mode 100644
index ee952e9..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO6A.java
+++ /dev/null
@@ -1,1128 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO6A {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] alg = null;
- private byte[] certificateModel = null;
- private byte[] certificateLen = null;
- private byte[] certificateSn = null;
- private byte[] certificateDn = null;
- private byte[] keyType = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getAlgAsBin( ) {
-
- return this.alg;
- }
-
-
- public String getAlgAsStr( ) {
-
- if( null == this.alg) return null;
- return Arrays.toString(this.alg);
- }
-
-
- public String getAlgAsHex( ) {
-
- if( null == this.alg) return null;
- return Util.bytes2HexString(alg);
- }
-
-
- public Data setAlg( byte[] bytes ) {
-
- this.alg = bytes;
- return this;
- }
-public enum AlgOptions {
-
- OPVRSA2048AES256ECB(Util.hexString2Bytes("30")),
- OPVSM2SM4ECB(Util.hexString2Bytes("31"));
- private byte[] bin;
- AlgOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getAlgCn( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return "RSA2048_AES256_ECB";
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return "SM2_SM4_ECB";
- }
- return null;
- }
-
-
- public Integer getAlgOptionIndex( ) {
-
- if( null == alg) { return null; }
- if( "30".equals(Util.bytes2HexString(this.alg))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.alg))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getCertificateModelAsBin( ) {
-
- return this.certificateModel;
- }
-
-
- public String getCertificateModelAsStr( ) {
-
- if( null == this.certificateModel) return null;
- return Arrays.toString(this.certificateModel);
- }
-
-
- public String getCertificateModelAsHex( ) {
-
- if( null == this.certificateModel) return null;
- return Util.bytes2HexString(certificateModel);
- }
-
-
- public Data setCertificateModel( byte[] bytes ) {
-
- this.certificateModel = bytes;
- return this;
- }
-public enum CertificateModelOptions {
-
- OPV证书序号(Util.hexString2Bytes("30")),
- OPV证书DN(Util.hexString2Bytes("31"));
- private byte[] bin;
- CertificateModelOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getCertificateModelCn( ) {
-
- if( null == certificateModel) { return null; }
- if( "30".equals(Util.bytes2HexString(this.certificateModel))) {
- return "证书序号";
- }
- if( "31".equals(Util.bytes2HexString(this.certificateModel))) {
- return "证书 DN";
- }
- return null;
- }
-
-
- public Integer getCertificateModelOptionIndex( ) {
-
- if( null == certificateModel) { return null; }
- if( "30".equals(Util.bytes2HexString(this.certificateModel))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.certificateModel))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getCertificateLenAsBin( ) {
-
- return this.certificateLen;
- }
-
-
- public String getCertificateLenAsStr( ) {
-
- if( null == this.certificateLen) return null;
- return Arrays.toString(this.certificateLen);
- }
-
-
- public String getCertificateLenAsHex( ) {
-
- if( null == this.certificateLen) return null;
- return Util.bytes2HexString(certificateLen);
- }
-
-
- public Data setCertificateLen( byte[] bytes ) {
-
- this.certificateLen = bytes;
- return this;
- }
-
-
- public byte[] getCertificateSnAsBin( ) {
-
- return this.certificateSn;
- }
-
-
- public String getCertificateSnAsStr( ) {
-
- if( null == this.certificateSn) return null;
- return Arrays.toString(this.certificateSn);
- }
-
-
- public String getCertificateSnAsHex( ) {
-
- if( null == this.certificateSn) return null;
- return Util.bytes2HexString(certificateSn);
- }
-
-
- public Data setCertificateSn( byte[] bytes ) {
-
- this.certificateSn = bytes;
- return this;
- }
-
-
- public byte[] getCertificateDnAsBin( ) {
-
- return this.certificateDn;
- }
-
-
- public String getCertificateDnAsStr( ) {
-
- if( null == this.certificateDn) return null;
- return Arrays.toString(this.certificateDn);
- }
-
-
- public String getCertificateDnAsHex( ) {
-
- if( null == this.certificateDn) return null;
- return Util.bytes2HexString(certificateDn);
- }
-
-
- public Data setCertificateDn( byte[] bytes ) {
-
- this.certificateDn = bytes;
- return this;
- }
-
-
- public byte[] getKeyTypeAsBin( ) {
-
- return this.keyType;
- }
-
-
- public String getKeyTypeAsStr( ) {
-
- if( null == this.keyType) return null;
- return Arrays.toString(this.keyType);
- }
-
-
- public String getKeyTypeAsHex( ) {
-
- if( null == this.keyType) return null;
- return Util.bytes2HexString(keyType);
- }
-
-
- public Data setKeyType( byte[] bytes ) {
-
- this.keyType = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != alg ){
- soup.put("alg", this.alg);
- soup.put("alg$option", getAlgOptionIndex());
- }
-
- if( null != certificateModel ){
- soup.put("certificateModel", this.certificateModel);
- soup.put("certificateModel$option", getCertificateModelOptionIndex());
- }
-
- if( null != certificateLen ){
- soup.put("certificateLen", this.certificateLen);
- }
-
- if( null != certificateSn ){
- soup.put("certificateSn", this.certificateSn);
- }
-
- if( null != certificateDn ){
- soup.put("certificateDn", this.certificateDn);
- }
-
- if( null != keyType ){
- soup.put("keyType", this.keyType);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("alg") ){
- this.alg = ((PacketSection) soup.get("alg")).getBytes();
- }
-
- if( soup.containsKey("certificateModel") ){
- this.certificateModel = ((PacketSection) soup.get("certificateModel")).getBytes();
- }
-
- if( soup.containsKey("certificateLen") ){
- this.certificateLen = ((PacketSection) soup.get("certificateLen")).getBytes();
- }
-
- if( soup.containsKey("certificateSn") ){
- this.certificateSn = ((PacketSection) soup.get("certificateSn")).getBytes();
- }
-
- if( soup.containsKey("certificateDn") ){
- this.certificateDn = ((PacketSection) soup.get("certificateDn")).getBytes();
- }
-
- if( soup.containsKey("keyType") ){
- this.keyType = ((PacketSection) soup.get("keyType")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3641"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3641");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
- public static class Res {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] error = null;
- private byte[] keyLen = null;
- private byte[] key = null;
- private byte[] lmkHead = null;
- private byte[] lmk = null;
- private byte[] keyCheck = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Res wrapper = null;
-
-
- public Data( Res wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getErrorAsBin( ) {
-
- return this.error;
- }
-
-
- public String getErrorAsStr( ) {
-
- if( null == this.error) return null;
- return Arrays.toString(this.error);
- }
-
-
- public String getErrorAsHex( ) {
-
- if( null == this.error) return null;
- return Util.bytes2HexString(error);
- }
-
-
- public Data setError( byte[] bytes ) {
-
- this.error = bytes;
- return this;
- }
-public enum ErrorOptions {
-
- OPV无错误(Util.hexString2Bytes("3030")),
- OPV公钥不符合编码规则(Util.hexString2Bytes("3034")),
- OPV无效的加密标识(Util.hexString2Bytes("3036")),
- OPV无效的附加模式标识(Util.hexString2Bytes("3037")),
- OPV密钥奇偶校验错误(Util.hexString2Bytes("3130")),
- OPVLMK错误(Util.hexString2Bytes("3133")),
- OPV输入数据错(Util.hexString2Bytes("3135")),
- OPVDSP错误(Util.hexString2Bytes("3437")),
- OPV密钥块长度错误(Util.hexString2Bytes("3736")),
- OPV输入数据长度错误(Util.hexString2Bytes("3830"));
- private byte[] bin;
- ErrorOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getErrorCn( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return "无错误";
- }
- if( "3034".equals(Util.bytes2HexString(this.error))) {
- return "公钥不符合编码规则";
- }
- if( "3036".equals(Util.bytes2HexString(this.error))) {
- return "无效的加密标识";
- }
- if( "3037".equals(Util.bytes2HexString(this.error))) {
- return "无效的附加模式标识";
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return "密钥奇偶校验错误";
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return "LMK 错误";
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return "输入数据错";
- }
- if( "3437".equals(Util.bytes2HexString(this.error))) {
- return "DSP 错误";
- }
- if( "3736".equals(Util.bytes2HexString(this.error))) {
- return "密钥块长度错误";
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return "输入数据长度错误";
- }
- return null;
- }
-
-
- public Integer getErrorOptionIndex( ) {
-
- if( null == error) { return null; }
- if( "3030".equals(Util.bytes2HexString(this.error))) {
- return 0;
- }
- if( "3034".equals(Util.bytes2HexString(this.error))) {
- return 1;
- }
- if( "3036".equals(Util.bytes2HexString(this.error))) {
- return 2;
- }
- if( "3037".equals(Util.bytes2HexString(this.error))) {
- return 3;
- }
- if( "3130".equals(Util.bytes2HexString(this.error))) {
- return 4;
- }
- if( "3133".equals(Util.bytes2HexString(this.error))) {
- return 5;
- }
- if( "3135".equals(Util.bytes2HexString(this.error))) {
- return 6;
- }
- if( "3437".equals(Util.bytes2HexString(this.error))) {
- return 7;
- }
- if( "3736".equals(Util.bytes2HexString(this.error))) {
- return 8;
- }
- if( "3830".equals(Util.bytes2HexString(this.error))) {
- return 9;
- }
- return null;
- }
-
-
- public byte[] getKeyLenAsBin( ) {
-
- return this.keyLen;
- }
-
-
- public String getKeyLenAsStr( ) {
-
- if( null == this.keyLen) return null;
- return Arrays.toString(this.keyLen);
- }
-
-
- public String getKeyLenAsHex( ) {
-
- if( null == this.keyLen) return null;
- return Util.bytes2HexString(keyLen);
- }
-
-
- public Data setKeyLen( byte[] bytes ) {
-
- this.keyLen = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getLmkHeadAsBin( ) {
-
- return this.lmkHead;
- }
-
-
- public String getLmkHeadAsStr( ) {
-
- if( null == this.lmkHead) return null;
- return Arrays.toString(this.lmkHead);
- }
-
-
- public String getLmkHeadAsHex( ) {
-
- if( null == this.lmkHead) return null;
- return Util.bytes2HexString(lmkHead);
- }
-
-
- public Data setLmkHead( byte[] bytes ) {
-
- this.lmkHead = bytes;
- return this;
- }
-
-
- public byte[] getLmkAsBin( ) {
-
- return this.lmk;
- }
-
-
- public String getLmkAsStr( ) {
-
- if( null == this.lmk) return null;
- return Arrays.toString(this.lmk);
- }
-
-
- public String getLmkAsHex( ) {
-
- if( null == this.lmk) return null;
- return Util.bytes2HexString(lmk);
- }
-
-
- public Data setLmk( byte[] bytes ) {
-
- this.lmk = bytes;
- return this;
- }
-
-
- public byte[] getKeyCheckAsBin( ) {
-
- return this.keyCheck;
- }
-
-
- public String getKeyCheckAsStr( ) {
-
- if( null == this.keyCheck) return null;
- return Arrays.toString(this.keyCheck);
- }
-
-
- public String getKeyCheckAsHex( ) {
-
- if( null == this.keyCheck) return null;
- return Util.bytes2HexString(keyCheck);
- }
-
-
- public Data setKeyCheck( byte[] bytes ) {
-
- this.keyCheck = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Res closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != error ){
- soup.put("error", this.error);
- soup.put("error$option", getErrorOptionIndex());
- }
-
- if( null != keyLen ){
- soup.put("keyLen", this.keyLen);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != lmkHead ){
- soup.put("lmkHead", this.lmkHead);
- }
-
- if( null != lmk ){
- soup.put("lmk", this.lmk);
- }
-
- if( null != keyCheck ){
- soup.put("keyCheck", this.keyCheck);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("error") ){
- this.error = ((PacketSection) soup.get("error")).getBytes();
- }
-
- if( soup.containsKey("keyLen") ){
- this.keyLen = ((PacketSection) soup.get("keyLen")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("lmkHead") ){
- this.lmkHead = ((PacketSection) soup.get("lmkHead")).getBytes();
- }
-
- if( soup.containsKey("lmk") ){
- this.lmk = ((PacketSection) soup.get("lmk")).getBytes();
- }
-
- if( soup.containsKey("keyCheck") ){
- this.keyCheck = ((PacketSection) soup.get("keyCheck")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Res setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Res setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Res setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3642"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Res fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3642");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map) soup.get("data"));
- }
-
- return this;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/racal/sunyard/main/dto/DTO6B.java b/src/main/java/racal/sunyard/main/dto/DTO6B.java
deleted file mode 100644
index 7508b21..0000000
--- a/src/main/java/racal/sunyard/main/dto/DTO6B.java
+++ /dev/null
@@ -1,1061 +0,0 @@
-package racal.sunyard.main.dto;
-
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import racal.sunyard.main.script.*;
-import com.sunyard.proto.section.*;
-import com.sunyard.proto.*;
-import com.sunyard.*;
-
-public class DTO6B {
- public static class Req {
- private byte[] length = null;
- private byte[] header = null;
- private byte[] command = null;
- private Data data = null;
- public static class Data {
- private byte[] certificateModel = null;
- private byte[] certificateLen = null;
- private byte[] certificateSn = null;
- private byte[] certificateDn = null;
- private byte[] keyLen = null;
- private byte[] key = null;
- private byte[] keyType = null;
- private byte[] tailSep = null;
- private byte[] tail = null;
- private Req wrapper = null;
-
-
- public Data( Req wrapper ) {
-
- this.wrapper = wrapper;
- }
-
-
- public byte[] getCertificateModelAsBin( ) {
-
- return this.certificateModel;
- }
-
-
- public String getCertificateModelAsStr( ) {
-
- if( null == this.certificateModel) return null;
- return Arrays.toString(this.certificateModel);
- }
-
-
- public String getCertificateModelAsHex( ) {
-
- if( null == this.certificateModel) return null;
- return Util.bytes2HexString(certificateModel);
- }
-
-
- public Data setCertificateModel( byte[] bytes ) {
-
- this.certificateModel = bytes;
- return this;
- }
-public enum CertificateModelOptions {
-
- OPV证书序号(Util.hexString2Bytes("30")),
- OPV证书DN(Util.hexString2Bytes("31"));
- private byte[] bin;
- CertificateModelOptions(byte[] bin) {
- this.bin = bin;
- }
- public byte[] getBin() {
- return bin;
- }
- }
-
- public String getCertificateModelCn( ) {
-
- if( null == certificateModel) { return null; }
- if( "30".equals(Util.bytes2HexString(this.certificateModel))) {
- return "证书序号";
- }
- if( "31".equals(Util.bytes2HexString(this.certificateModel))) {
- return "证书 DN";
- }
- return null;
- }
-
-
- public Integer getCertificateModelOptionIndex( ) {
-
- if( null == certificateModel) { return null; }
- if( "30".equals(Util.bytes2HexString(this.certificateModel))) {
- return 0;
- }
- if( "31".equals(Util.bytes2HexString(this.certificateModel))) {
- return 1;
- }
- return null;
- }
-
-
- public byte[] getCertificateLenAsBin( ) {
-
- return this.certificateLen;
- }
-
-
- public String getCertificateLenAsStr( ) {
-
- if( null == this.certificateLen) return null;
- return Arrays.toString(this.certificateLen);
- }
-
-
- public String getCertificateLenAsHex( ) {
-
- if( null == this.certificateLen) return null;
- return Util.bytes2HexString(certificateLen);
- }
-
-
- public Data setCertificateLen( byte[] bytes ) {
-
- this.certificateLen = bytes;
- return this;
- }
-
-
- public byte[] getCertificateSnAsBin( ) {
-
- return this.certificateSn;
- }
-
-
- public String getCertificateSnAsStr( ) {
-
- if( null == this.certificateSn) return null;
- return Arrays.toString(this.certificateSn);
- }
-
-
- public String getCertificateSnAsHex( ) {
-
- if( null == this.certificateSn) return null;
- return Util.bytes2HexString(certificateSn);
- }
-
-
- public Data setCertificateSn( byte[] bytes ) {
-
- this.certificateSn = bytes;
- return this;
- }
-
-
- public byte[] getCertificateDnAsBin( ) {
-
- return this.certificateDn;
- }
-
-
- public String getCertificateDnAsStr( ) {
-
- if( null == this.certificateDn) return null;
- return Arrays.toString(this.certificateDn);
- }
-
-
- public String getCertificateDnAsHex( ) {
-
- if( null == this.certificateDn) return null;
- return Util.bytes2HexString(certificateDn);
- }
-
-
- public Data setCertificateDn( byte[] bytes ) {
-
- this.certificateDn = bytes;
- return this;
- }
-
-
- public byte[] getKeyLenAsBin( ) {
-
- return this.keyLen;
- }
-
-
- public String getKeyLenAsStr( ) {
-
- if( null == this.keyLen) return null;
- return Arrays.toString(this.keyLen);
- }
-
-
- public String getKeyLenAsHex( ) {
-
- if( null == this.keyLen) return null;
- return Util.bytes2HexString(keyLen);
- }
-
-
- public Data setKeyLen( byte[] bytes ) {
-
- this.keyLen = bytes;
- return this;
- }
-
-
- public byte[] getKeyAsBin( ) {
-
- return this.key;
- }
-
-
- public String getKeyAsStr( ) {
-
- if( null == this.key) return null;
- return Arrays.toString(this.key);
- }
-
-
- public String getKeyAsHex( ) {
-
- if( null == this.key) return null;
- return Util.bytes2HexString(key);
- }
-
-
- public Data setKey( byte[] bytes ) {
-
- this.key = bytes;
- return this;
- }
-
-
- public byte[] getKeyTypeAsBin( ) {
-
- return this.keyType;
- }
-
-
- public String getKeyTypeAsStr( ) {
-
- if( null == this.keyType) return null;
- return Arrays.toString(this.keyType);
- }
-
-
- public String getKeyTypeAsHex( ) {
-
- if( null == this.keyType) return null;
- return Util.bytes2HexString(keyType);
- }
-
-
- public Data setKeyType( byte[] bytes ) {
-
- this.keyType = bytes;
- return this;
- }
-
-
- public byte[] getTailSepAsBin( ) {
-
- return this.tailSep;
- }
-
-
- public String getTailSepAsStr( ) {
-
- if( null == this.tailSep) return null;
- return Arrays.toString(this.tailSep);
- }
-
-
- public String getTailSepAsHex( ) {
-
- if( null == this.tailSep) return null;
- return Util.bytes2HexString(tailSep);
- }
-
-
- public Data setTailSep( byte[] bytes ) {
-
- this.tailSep = bytes;
- return this;
- }
-
-
- public byte[] getTailAsBin( ) {
-
- return this.tail;
- }
-
-
- public String getTailAsStr( ) {
-
- if( null == this.tail) return null;
- return Arrays.toString(this.tail);
- }
-
-
- public String getTailAsHex( ) {
-
- if( null == this.tail) return null;
- return Util.bytes2HexString(tail);
- }
-
-
- public Data setTail( byte[] bytes ) {
-
- this.tail = bytes;
- return this;
- }
-
-
- public Req closeBuilding( ) {
-
- return this.wrapper;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != certificateModel ){
- soup.put("certificateModel", this.certificateModel);
- soup.put("certificateModel$option", getCertificateModelOptionIndex());
- }
-
- if( null != certificateLen ){
- soup.put("certificateLen", this.certificateLen);
- }
-
- if( null != certificateSn ){
- soup.put("certificateSn", this.certificateSn);
- }
-
- if( null != certificateDn ){
- soup.put("certificateDn", this.certificateDn);
- }
-
- if( null != keyLen ){
- soup.put("keyLen", this.keyLen);
- }
-
- if( null != key ){
- soup.put("key", this.key);
- }
-
- if( null != keyType ){
- soup.put("keyType", this.keyType);
- }
-
- soup.put("tailSep", Util.hexString2Bytes("3139"));
- if( null != tailSep ){
- soup.put("tailSep", this.tailSep);
- }
-
- if( null != tail ){
- soup.put("tail", this.tail);
- }
-
- return soup;
- }
-
-
- public Data fullFromSoup( Map soup ) {
-
- if( soup.containsKey("certificateModel") ){
- this.certificateModel = ((PacketSection) soup.get("certificateModel")).getBytes();
- }
-
- if( soup.containsKey("certificateLen") ){
- this.certificateLen = ((PacketSection) soup.get("certificateLen")).getBytes();
- }
-
- if( soup.containsKey("certificateSn") ){
- this.certificateSn = ((PacketSection) soup.get("certificateSn")).getBytes();
- }
-
- if( soup.containsKey("certificateDn") ){
- this.certificateDn = ((PacketSection) soup.get("certificateDn")).getBytes();
- }
-
- if( soup.containsKey("keyLen") ){
- this.keyLen = ((PacketSection) soup.get("keyLen")).getBytes();
- }
-
- if( soup.containsKey("key") ){
- this.key = ((PacketSection) soup.get("key")).getBytes();
- }
-
- if( soup.containsKey("keyType") ){
- this.keyType = ((PacketSection) soup.get("keyType")).getBytes();
- }
-
- this.tailSep = Util.hexString2Bytes("3139");
- if( soup.containsKey("tailSep") ){
- this.tailSep = ((PacketSection) soup.get("tailSep")).getBytes();
- }
-
- if( soup.containsKey("tail") ){
- this.tail = ((PacketSection) soup.get("tail")).getBytes();
- }
-
- return this;
- }
-
- }
-
-
- public byte[] getLengthAsBin( ) {
-
- return this.length;
- }
-
-
- public String getLengthAsStr( ) {
-
- if( null == this.length) return null;
- return Arrays.toString(this.length);
- }
-
-
- public String getLengthAsHex( ) {
-
- if( null == this.length) return null;
- return Util.bytes2HexString(length);
- }
-
-
- public Req setLength( byte[] bytes ) {
-
- this.length = bytes;
- return this;
- }
-
-
- public byte[] getHeaderAsBin( ) {
-
- return this.header;
- }
-
-
- public String getHeaderAsStr( ) {
-
- if( null == this.header) return null;
- return Arrays.toString(this.header);
- }
-
-
- public String getHeaderAsHex( ) {
-
- if( null == this.header) return null;
- return Util.bytes2HexString(header);
- }
-
-
- public Req setHeader( byte[] bytes ) {
-
- this.header = bytes;
- return this;
- }
-
-
- public byte[] getCommandAsBin( ) {
-
- return this.command;
- }
-
-
- public String getCommandAsStr( ) {
-
- if( null == this.command) return null;
- return Arrays.toString(this.command);
- }
-
-
- public String getCommandAsHex( ) {
-
- if( null == this.command) return null;
- return Util.bytes2HexString(command);
- }
-
-
- public Req setCommand( byte[] bytes ) {
-
- this.command = bytes;
- return this;
- }
-
-
- public Data buildData( ) {
-
- this.data = new Data(this);
- return this.data;
- }
-
-
- public Data newDataBuilder( ) {
-
- return new Data(this);
- }
-
-
- public Data getData( ) {
-
- return this.data;
- }
-
-
- public Map toSoup( ) {
-
- Map soup = new HashMap();
- if( null != length ){
- soup.put("length", this.length);
- }
-
- if( null != header ){
- soup.put("header", this.header);
- }
-
- soup.put("command", Util.hexString2Bytes("3642"));
- if( null != command ){
- soup.put("command", this.command);
- }
-
- if( null != data) {
- soup.put("data", this.data.toSoup());
- }
- return soup;
- }
-
-
- public Req fullFromSoup( Map soup ) {
-
- if( soup.containsKey("length") ){
- this.length = ((PacketSection) soup.get("length")).getBytes();
- }
-
- if( soup.containsKey("header") ){
- this.header = ((PacketSection) soup.get("header")).getBytes();
- }
-
- this.command = Util.hexString2Bytes("3642");
- if( soup.containsKey("command") ){
- this.command = ((PacketSection) soup.get("command")).getBytes();
- }
-
- if( soup.containsKey("data") ){
- this.data = new Data(this).fullFromSoup( (Map