1、修改了8017指令xml文档,兼容通过sn获取证书信息。添加通过sn获取证书信息的接口
This commit is contained in:
@@ -69,6 +69,13 @@ public interface SydCertApi {
|
||||
String pCert
|
||||
);
|
||||
|
||||
/**
|
||||
* 通过SN获取 X509 证书信息
|
||||
* @param sn sn,证书序号
|
||||
* @param nCertType 证书类型,0:签名证书, 1:加密证书
|
||||
* @return
|
||||
*/
|
||||
String GetX509CertFileBySN(String sn, int nCertType);
|
||||
|
||||
/**
|
||||
* 通过使用者 ID 获取的 X509 证书文件。
|
||||
@@ -81,7 +88,6 @@ public interface SydCertApi {
|
||||
int nCertType
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 从签名中获取证书
|
||||
* @param orgData 待签名的原始数据
|
||||
|
||||
@@ -3196,11 +3196,32 @@ public class SydApi4j implements SydApi {
|
||||
return cinfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过SN获取证书信息
|
||||
* @param sn sn
|
||||
* @param nCertType 证书类型,0:签名证书, 1:加密证书
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String GetX509CertFileBySN(String sn, int nCertType) {
|
||||
return GetX509CertFileC(0, sn, nCertType);
|
||||
}
|
||||
|
||||
// 测试通过
|
||||
@Override
|
||||
public String GetX509CertFileC(String userId, int nCertType) {
|
||||
return GetX509CertFileC(1, userId, nCertType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过sn或机构号获取证书
|
||||
* @param flag 0: SN,1: 机构号
|
||||
* @param userId 根据flag确定传入的数据
|
||||
* @param nCertType 证书类型,0:签名证书, 1:加密证书
|
||||
* @return
|
||||
*/
|
||||
private String GetX509CertFileC(int flag, String userId, int nCertType) {
|
||||
|
||||
//ProtocolRender render = pset.getProtocolReqRender(new byte[]{(byte) 0x80, 0x17});
|
||||
Proto8017 proto = new Proto8017();
|
||||
HashMap<String, Object> packet = new HashMap<String, Object>();
|
||||
HashMap<String, Object> data = new HashMap<String, Object>();
|
||||
@@ -3208,12 +3229,20 @@ public class SydApi4j implements SydApi {
|
||||
PacketSN sn = PacketSN.gen();
|
||||
packet.put("header", sn.getSn().array());
|
||||
|
||||
byte[] u;
|
||||
|
||||
if (userId.length() > 16) {
|
||||
throw new SydApiException(-26);
|
||||
if (flag == 1) {
|
||||
if (userId.length() > 16) {
|
||||
throw new SydApiException(-26);
|
||||
}
|
||||
u = new byte[16];
|
||||
System.arraycopy(userId.getBytes(), 0, u, 0, userId.length());
|
||||
} else {
|
||||
u = userId.getBytes();
|
||||
data.put("pFlag", "P");
|
||||
data.put("flag", flag);
|
||||
}
|
||||
byte[] u = new byte[16];
|
||||
System.arraycopy(userId.getBytes(), 0, u, 0, userId.length());
|
||||
|
||||
byte type = 0 == nCertType ? (byte) 0 : (byte) 1;
|
||||
|
||||
data.put("userId", u);
|
||||
@@ -3245,7 +3274,6 @@ public class SydApi4j implements SydApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* sm2私钥签名
|
||||
* 用户id默认为1234567812345678
|
||||
|
||||
Reference in New Issue
Block a user