Changes
This commit is contained in:
parent
dd7bd5577a
commit
f7e1103e93
@ -26,18 +26,12 @@ public interface SydApi {
|
|||||||
static void SYD_SetLogConfig(
|
static void SYD_SetLogConfig(
|
||||||
String pcLogPath,
|
String pcLogPath,
|
||||||
int iLogLevel) {
|
int iLogLevel) {
|
||||||
Logger log = LogFactory.getLogger();
|
if (pcLogPath==null||iLogLevel<0||iLogLevel>3){
|
||||||
try {
|
throw new IllegalArgumentException("地址不能为空且等级范围为0到3");
|
||||||
if (iLogLevel<0||iLogLevel>3){
|
|
||||||
throw new IllegalArgumentException("IllegalArgumentException");
|
|
||||||
}
|
}
|
||||||
Logger logger = LogFactory.createLogger(pcLogPath, iLogLevel);
|
Logger logger = LogFactory.createLogger(pcLogPath, iLogLevel);
|
||||||
SydApi4j.setLogger( logger );
|
SydApi4j.setLogger( logger );
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e){
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建立到指定地址和端口号的签名服务器的 TCP/IP 连接,返回 API 操作对象 SydApi。
|
* 建立到指定地址和端口号的签名服务器的 TCP/IP 连接,返回 API 操作对象 SydApi。
|
||||||
|
|||||||
@ -52,6 +52,9 @@ public class SydApi4Database implements SydApi {
|
|||||||
if (LogFactory.iLogLevel==3) {
|
if (LogFactory.iLogLevel==3) {
|
||||||
log.debug("SYD_SM3_Hash_ShortData方法接收参数:pcData:{}", Arrays.toString(pcData));
|
log.debug("SYD_SM3_Hash_ShortData方法接收参数:pcData:{}", Arrays.toString(pcData));
|
||||||
}
|
}
|
||||||
|
if (pcData.length==0){
|
||||||
|
throw new SydApiException(-19);
|
||||||
|
}
|
||||||
if (null == this.hsms || this.hsms.length < 1) {
|
if (null == this.hsms || this.hsms.length < 1) {
|
||||||
throw new SydApiException(-1);
|
throw new SydApiException(-1);
|
||||||
}
|
}
|
||||||
@ -78,6 +81,7 @@ public class SydApi4Database implements SydApi {
|
|||||||
if (LogFactory.iLogLevel==3) {
|
if (LogFactory.iLogLevel==3) {
|
||||||
log.debug("SYD_SM3_Hash_LongData方法接收参数:pcData:{},iPkgNum:{},pcProcData:{}", Arrays.toString(pcData), iPkgNum, pcProcData);
|
log.debug("SYD_SM3_Hash_LongData方法接收参数:pcData:{},iPkgNum:{},pcProcData:{}", Arrays.toString(pcData), iPkgNum, pcProcData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == this.hsms || this.hsms.length < 1) {
|
if (null == this.hsms || this.hsms.length < 1) {
|
||||||
throw new SydApiException(-1);
|
throw new SydApiException(-1);
|
||||||
}
|
}
|
||||||
@ -114,6 +118,9 @@ public class SydApi4Database implements SydApi {
|
|||||||
if (LogFactory.iLogLevel==3) {
|
if (LogFactory.iLogLevel==3) {
|
||||||
log.debug("SYD_SM4_ShortData方法接收参数:iKeyIndex:{},pcData:{},iFlag:{}", iKeyIndex, Arrays.toString(pcData), iFlag);
|
log.debug("SYD_SM4_ShortData方法接收参数:iKeyIndex:{},pcData:{},iFlag:{}", iKeyIndex, Arrays.toString(pcData), iFlag);
|
||||||
}
|
}
|
||||||
|
if (iFlag==Consts.ECB_DEC&&null==pcData||pcData.length==0){
|
||||||
|
throw new SydApiException(19);
|
||||||
|
}
|
||||||
if (null == this.hsms || this.hsms.length < 1) {
|
if (null == this.hsms || this.hsms.length < 1) {
|
||||||
throw new SydApiException(-1);
|
throw new SydApiException(-1);
|
||||||
}
|
}
|
||||||
@ -152,6 +159,13 @@ public class SydApi4Database implements SydApi {
|
|||||||
if (LogFactory.iLogLevel==3) {
|
if (LogFactory.iLogLevel==3) {
|
||||||
log.debug("SYD_SM4_BatchData方法接收参数:iKeyIndex:{},pcData元素个数为:{},iFlag:{}", iKeyIndex, pcData.size(), iFlag);
|
log.debug("SYD_SM4_BatchData方法接收参数:iKeyIndex:{},pcData元素个数为:{},iFlag:{}", iKeyIndex, pcData.size(), iFlag);
|
||||||
}
|
}
|
||||||
|
if (iFlag==Consts.ECB_DEC){
|
||||||
|
for (byte[] pcdata:pcData){
|
||||||
|
if (null==pcData||pcdata.length==0) {
|
||||||
|
throw new SydApiException(19);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (null == this.hsms || this.hsms.length < 1) {
|
if (null == this.hsms || this.hsms.length < 1) {
|
||||||
throw new SydApiException(-1);
|
throw new SydApiException(-1);
|
||||||
}
|
}
|
||||||
@ -186,10 +200,12 @@ public class SydApi4Database implements SydApi {
|
|||||||
if (LogFactory.iLogLevel==3) {
|
if (LogFactory.iLogLevel==3) {
|
||||||
log.debug("SYD_SM4_LongData方法接收参数:iKeyIndex:{},pcData:{},iPkgNum:{},iFlag:{}", iKeyIndex, Arrays.toString(pcData), iPkgNum, iFlag);
|
log.debug("SYD_SM4_LongData方法接收参数:iKeyIndex:{},pcData:{},iPkgNum:{},iFlag:{}", iKeyIndex, Arrays.toString(pcData), iPkgNum, iFlag);
|
||||||
}
|
}
|
||||||
|
if (iFlag==Consts.ECB_DEC&&null==pcData||pcData.length==0){
|
||||||
|
throw new SydApiException(19);
|
||||||
|
}
|
||||||
if (null == this.hsms || this.hsms.length < 1) {
|
if (null == this.hsms || this.hsms.length < 1) {
|
||||||
throw new SydApiException(-1);
|
throw new SydApiException(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String keyIndex = String.format("%08d", iKeyIndex);
|
String keyIndex = String.format("%08d", iKeyIndex);
|
||||||
|
|
||||||
SydApiException le = null;
|
SydApiException le = null;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class Sample
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
// 路径要以 / 或 \\ 结尾表示目录
|
// 路径要以 / 或 \\ 结尾表示目录
|
||||||
SydApi.SYD_SetLogConfig("./logs/",2);
|
SydApi.SYD_SetLogConfig("./logs/",3);
|
||||||
|
|
||||||
Logger log = LogFactory.getLogger();
|
Logger log = LogFactory.getLogger();
|
||||||
log.info("start");
|
log.info("start");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user