增加获取所有证书列表问题
This commit is contained in:
parent
92ee7a17e8
commit
85ef86ee49
@ -6,6 +6,7 @@ import com.sunyard.cert.X509;
|
||||
import com.sunyard.constant.CertUsage;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 证书操作相关接口
|
||||
@ -102,6 +103,14 @@ public interface SydCertApi {
|
||||
String sign
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有证书
|
||||
* @return
|
||||
* certDNs: 证书DN
|
||||
*/
|
||||
List<String> getAllCert() throws UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* 查询所有证书
|
||||
* @param dataFlag 数据包标志 0:起始包 1:中间包 2:结束包
|
||||
|
||||
@ -1322,6 +1322,25 @@ public class SydApi4j implements SydApi {
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getAllCert() throws UnsupportedEncodingException {
|
||||
|
||||
ArrayList<String> m_certs =new ArrayList<String>();
|
||||
//查出证书总数,一次次的拿出来
|
||||
RetWrap allCert =getAllCert(0);
|
||||
Integer allnum =(Integer) allCert.get("certAllNum");//总数
|
||||
List<String> certs = (List<String>)allCert.get("certDNs");//部分证书列表
|
||||
m_certs.addAll(certs);
|
||||
int loop = allnum%16;//循环次数
|
||||
for (int i = 1; i < loop; i++) {
|
||||
RetWrap partCert= getAllCert(16*i);
|
||||
List<String> partcerts = (List<String>)partCert.get("certDNs");
|
||||
m_certs.addAll(partcerts);
|
||||
}
|
||||
return m_certs;
|
||||
}
|
||||
|
||||
// 测试通过
|
||||
@Override
|
||||
public RetWrap getAllCert(int dataFlag,String sqlite) throws UnsupportedEncodingException {
|
||||
|
||||
@ -92,10 +92,17 @@ public class Shanghairenhang {
|
||||
System.out.println(Util.bytes2HexString(bytes));
|
||||
}
|
||||
@Test
|
||||
public void aboutCert(){
|
||||
public void aboutCert() throws UnsupportedEncodingException {
|
||||
//System.setProperty("com.sunyard.sydapi4j.debug", "true");
|
||||
SydApiBuilder builder = new SydApiBuilder().setIp("192.168.0.200");
|
||||
SydApiBuilder builder = new SydApiBuilder().setIp("192.168.1.129");
|
||||
SydApi4j api = (SydApi4j) builder.build();
|
||||
RetWrap allCert = api.getAllCert(0);
|
||||
printRetWrap(allCert);
|
||||
|
||||
List<String> certs= api.getAllCert();
|
||||
System.out.println("所有证书"+certs);
|
||||
System.out.println(certs.size());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user