124 lines
3.6 KiB
Java
124 lines
3.6 KiB
Java
package com.sunyard;
|
|
|
|
import com.sunyard.inf.cryption.*;
|
|
import com.sunyard.inf.*;
|
|
import com.sunyard.inf.customize.Syd4DigitalEnvelope;
|
|
import com.sunyard.inf.customize.SydHAApi;
|
|
import com.sunyard.inf.customize.SydQNUCApi;
|
|
import com.sunyard.inf.customize.SydUnionPayApi;
|
|
import racal.sunyard.main.SydApiBuilder;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Created by Cheney on 2017/11/11.
|
|
* 程序调用接口
|
|
*/
|
|
public interface SydApi extends
|
|
SydRawApi, SydCertApi, SydGenApi, SydSYMApi, SydASYMApi, SydHashApi,
|
|
SydSVApi, SydHAApi, SydQNUCApi, SydPledge, SydPINOpt,
|
|
SydManufactureApi, SydZYOption, SydUnionPayApi ,Syd4DigitalEnvelope{
|
|
|
|
byte ALG_AES = 0x30;
|
|
byte ALG_SM4 = 0x31;
|
|
int NALG_3DES = 0x00;
|
|
int NALG_SM4 = 0x01;
|
|
int NALG_AES = 0x02;
|
|
|
|
//清算总行密押MAC填充模式
|
|
byte MIYA_FULL_WEAK = 0x30;
|
|
byte MIYA_FULL_FORCE = 0x31;
|
|
//清算总行密押MAC长度标识
|
|
byte MIYA_MAC_LEN_4 = 0x31;
|
|
byte MIYA_MAC_LEN_8 = 0x32;
|
|
byte MIYA_MAC_LEN_16 = 0x33;
|
|
|
|
String RET_CIPHER_KEY = "CipherKey";
|
|
String RET_SESSION_KEY = "SessionKey";
|
|
String RET_PUBLIC_KEY = "PublicKey";
|
|
String RET_PRIVATE_KEY = "PrivateKey";
|
|
String RET_KCV = "KCV";
|
|
|
|
|
|
int FOR_SIGN = 0;
|
|
int FOR_ENCRYPT = 1;
|
|
|
|
int DATA_HASH = 0;
|
|
int DATA_ORIGIN = 1;
|
|
|
|
|
|
byte KCV_S = 0x53;
|
|
|
|
/**
|
|
* 建立到指定地址和端口号的加密设备的TCP/IP 连接,返回 TCP/IP 连接句柄。
|
|
* 如果采用短连接,交易结束,要调用 disconnect() 进行释放连接。
|
|
*
|
|
* @param ip 加密设备的 IP 地址。
|
|
* @param port 加密设备的端口号。
|
|
* @param pwd 保留。
|
|
* @param timeout 超时时间。
|
|
* @return 设备操作对象
|
|
*/
|
|
SydApi connect(String ip, int port, String pwd, int timeout);
|
|
|
|
/**
|
|
* 建立到指定地址和端口号的加密设备的TCP/IP 连接,返回 TCP/IP 连接句柄。
|
|
* 如果采用短连接,交易结束,要调用 disconnect() 进行释放连接。
|
|
*
|
|
* @param ip 加密设备的 IP 地址。
|
|
* @param port 加密设备的端口号。
|
|
* @param pwd 保留。
|
|
* @param connectTimeout 链接超时时间。
|
|
* @param readTimeout 通信超时时间
|
|
* @return 设备操作对象
|
|
*/
|
|
SydApi connect(String ip, int port, String pwd, int connectTimeout, int readTimeout);
|
|
|
|
/**
|
|
* 建立到指定地址和端口号的加密设备的TCP/IP 连接,返回 TCP/IP 连接句柄。
|
|
* @param ip 加密机 ip
|
|
* @param port 加密机端口
|
|
* @param pwd 加密机密码,无密码写 null
|
|
* @param connectTimeout 网络连接时超时时间
|
|
* @param readTimeout 网络通信时,socket 超时时间
|
|
* @param retryWhenNetError 网络失败时重试次数
|
|
* @return
|
|
*/
|
|
SydApi connect(String ip, int port, String pwd, int connectTimeout, int readTimeout , int retryWhenNetError);
|
|
|
|
void init(SydApiBuilder builder);
|
|
|
|
/**
|
|
* 断开连接
|
|
*
|
|
* @return 0 表示成功;非 0 表示失败;
|
|
*/
|
|
int disconnect();
|
|
|
|
|
|
// 方便链接池扩展
|
|
// 单例可以不实现
|
|
void free();
|
|
|
|
// 方便链接池扩展
|
|
// 单例可以不实现
|
|
void error();
|
|
|
|
|
|
/**
|
|
* 获取加密机cpu,内存,磁盘使用状况
|
|
*
|
|
* @return CPU: cpu 使用率,百分比状态
|
|
* MEM: 内存使用率, 百分比状态
|
|
* DISK: 磁盘使用率,单位 MB
|
|
*/
|
|
RetWrap getStatus();
|
|
|
|
byte[] directBytes(byte[] data);
|
|
|
|
public Object getBindObject();
|
|
|
|
public void setBindObject(Object bindObject);
|
|
|
|
}
|