API接口文档
证书签发-个人证书
传入身份信息,进行证书的申请和签发。
一、公共参数
服务接口名称(即公共参数 method 的值): issue
请求方式:POST
二、请求参数(请求方式为 post)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | PersonalIssueRequest | 是 | 个人高级证书签发请求 |
PersonalIssueRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
personalSeniorCertificate | PersonalSeniorCertificate | 是 | 个人高级证书实体信息 |
pkCS10 | String | 是 | 用于制作证书的 pkCS10 |
extensions | Map | 否 | 扩展属性 |
agentInfo | AgentInfo | 否 | 经办人信息(非合约用户必传经办人手机号) |
password | String | 否 | 交易密码 |
extend | String | 否 | 预留信息 |
keyId | String | 否 | keyId |
PersonalSeniorCertificate 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
idType | IdType | 否 | 证件类型 |
idNumber | String | 否 | 证件号,需要与证件类型匹配 |
phoneNumber | String | 否 | 联系号码 |
ownerName | String | 否 | 证书持有者姓名 |
commonName | String | 否 | 证书 CN 项,证书持有者名称 |
organization | String | 否 | 证书 O 项,证书所属组织 |
organizationUnit | String | 否 | 证书 OU 项,证书所属组织单元 |
country | String | 否 | 证书 C 项,国家,默认 CN |
province | String | 否 | 证书 S 项,证书所属省 |
city | String | 否 | 证书 L 项,证书所属市 |
districtCounty | String | 否 | 证书所属区县 |
givenName | String | 否 | 名字,证书GIVENNAME项 |
String | 否 | 证书所属人邮箱 | |
extraExtension | List<Extension> | 否 | 证书扩展项 |
medium | String | 否 | 介质信息 |
accountId | String | 否 | 交易账号 |
Extension 说明:
名称 | 类型 | 描述 |
---|---|---|
oid | String | 扩展项oid值 |
value | String | 扩展项值 |
name | String | 扩展项名称 |
证件类型(IdType)说明:
名称 | 描述 |
---|---|
ID | 身份证 |
PASSPORT | 护照 |
MILITARY_ID | 军人身份证 |
BUSINESS_REGISTRATION_CERT | 工商登记证 |
TAX_REGISTRATION_CERT | 税务登记证 |
SHAREHOLDER_CODE_CERT | 股东代码证 |
SOCIAL_SECURITY_CARD | 社会保障卡 |
ARMED_POLICE | 武装警察身份证件 |
HK_MACAU_PASSPORT | 港澳居民往来内地通行证 |
TAIWAN_PASSPORT | 台湾居民往来内地通行证 |
HOUSEHOLD_REGISTER | 户口簿 |
TEMPORARY_ID | 临时身份证 |
POLICE_CERT | 警官证 |
PERMANENT_RESIDENCE_PERMIT | 外国人永久居留证 |
GOVERNMENT_APPROVAL | 政府批文 |
UNIFIED_SOCIAL_CERT | 统一社会信用代码证 |
PRIVATE_NON_ENTERPRISE_CERT | 民办非企业登记证书 |
CORPORATE_CERT | 法人证书 |
OTHER | 其他 |
经办人信息(AgentInfo) 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
agentName | String | 否 | 经办人姓名 |
agentId | String | 否 | 经办人身份证号 |
agentPhone | String | 否 | 经办人手机号码 |
agentEmail | String | 否 | 经办人邮箱 |
note | String | 否 | 经办人备注 |
代码实例:public class PersonalCertSopApiTest {
/**
* 个人证书签发测试
*/
@Test
public void testIssue() throws Exception {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
PersonalCertSopApi personalCertSopApi = new PersonalCertSopApiImpl(apiClient);
//构造个人高级证书签发请求
PersonalIssueRequest request = new PersonalIssueRequest();
//初始化个人高级证书信息
PersonalSeniorCertificate personalSeniorCertificate = getPersonalSeniorCertificate();
request.setPersonalSeniorCertificate(personalSeniorCertificate);
//设置P10
request.setPkCS10("MIIBOTCB3QIBADB7MQ0wCwYDVQQDDARuYW1lMREwDwYDVQQLDAhCSkNBIFImRDENMAsGA1UECgwEQkpDQTEQMA4GA1UEBwwHLOWMl+S6rDELMAkGA1UECAwCYmoxCzAJBgNVBAYTAkNOMRwwGgYJKoZIhvcNAQkBFg1tYWlsQGJqY2EuY29tMFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEIMVIdr0yuW4GpiXmHqpETGG/ETYe87WMKO/xuLo968y84GnKb99tWnQ44eG/AOJLTBTmVCYmjXHcJrREAqzPdKAAMAwGCCqBHM9VAYN1BQADSQAwRgIhAIS0ygb73cIZ8YqjXGeaf1K7nBxmEbs9YpIK1rTkRoaaAiEAx12lLcipB0FH4yLdw29xx8JyENAWVCIsFcrUTQgiIHE=");
request.setExtend("456extend");
request.setPassword("789pass");
request.setKeyId("test");
AgentInfo agentInfo = new AgentInfo();
agentInfo.setAgentEmail("11@qq.com");
agentInfo.setAgentName("测试个人发证");
agentInfo.setAgentPhone("15295586469");
agentInfo.setAgentId("362229188808224477");
agentInfo.setNote("a其它");
request.setAgentInfo(agentInfo);
//调用证书签发接口
PersonalIssueResponse personalIssueResponse = null;
try {
personalIssueResponse = personalCertSopApi.issue(request);
//后续业务处理
System.out.println("================================");
System.out.println("签发成功,响应内容:" + personalIssueResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + personalIssueResponse.getRequestId());
System.out.println("SDK响应消息:" + personalIssueResponse.getMsg());
System.out.println("SDK响应码:" + personalIssueResponse.getErrorCode());
System.out.println("================================");
if (null != personalIssueResponse.getData()) {
System.out.println("证书ID:" + personalIssueResponse.getData().getSerial());
System.out.println("加密证书:" + personalIssueResponse.getData().getEncryptionCert());
System.out.println("加密证书私钥:" + personalIssueResponse.getData().getEncryptionPrivateKey());
System.out.println("skf加密证书私钥:" + personalIssueResponse.getData().getSkfEnvelopedKeyBlob());
System.out.println("签名证书:" + personalIssueResponse.getData().getSignatureCert());
System.out.println("业务响应码:" + personalIssueResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + personalIssueResponse.getData().getMessage());
System.out.println("介质信息:" + enterpriseIssueResponse.getData().getMedium());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
/**
* 构造个人高级证书签发请求 在main方法里测试时该方法要加static关键字
*
* @return 个人高级证书
* @throws ParseException parseException
*/
private PersonalSeniorCertificate getPersonalSeniorCertificate() throws ParseException {
PersonalSeniorCertificate personalSeniorCertificate = new PersonalSeniorCertificate();
//设置个人证书定制信息
personalSeniorCertificate.setIdNumber("320125201809093418");
personalSeniorCertificate.setIdType(IdType.ID);
personalSeniorCertificate.setPhoneNumber("17311111111");
personalSeniorCertificate.setOwnerName("测试");
// 设置证书基本信息
personalSeniorCertificate.setCommonName("测试");
personalSeniorCertificate.setOrganization("测试");
personalSeniorCertificate.setOrganizationUnit("测试");
personalSeniorCertificate.setCountry("CN");
personalSeniorCertificate.setProvince("测试");
personalSeniorCertificate.setCity("测试");
personalSeniorCertificate.setDistrictCounty("测试");
personalSeniorCertificate.setEmail("zhugeliang@han.cn");
personalSeniorCertificate.setMedium("介质号");
personalSeniorCertificate.setAccountId("accountIdTest");
return personalSeniorCertificate;
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
msg | String | 业务描述 |
code | String | 业务返回码 |
signatureCert | String | 签名证书 |
encryptionCert | String | 加密证书 |
encryptionPrivateKey | String | 加密私钥 |
skfEnvelopedKeyBlob | String | skf加密私钥 |
serial | String | 证书序列号 |
medium | String | 介质号 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书签发成功 |
其它 | 参考异常代码表 |
证书签发-企业证书
传入企业信息,进行证书的申请和签发。
一、请求说明
服务接口名称(即公共参数 method 的值): issue
请求方式:POST
二、请求参数(请求方式为 post)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | EnterpriseIssueRequest | 是 | 企业证书签发请求 |
EnterpriseIssueRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
enterpriseSeniorCertificate | EnterpriseSeniorCertificate | 是 | 企业高级证书实体信息 |
pkCS10 | String | 是 | 用于制作证书的 pkCS10 |
extensions | Map | 否 | 扩展属性 |
agentInfo | AgentInfo | 否 | 经办人信息(非合约用户必传经办人手机号) |
password | String | 否 | 交易密码 |
extend | String | 否 | 预留信息 |
keyId | String | 否 | keyId |
EnterpriseSeniorCertificate 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
enterprise | String | 否 | 企业名称 |
department | String | 否 | 部门名称 |
idType | IdType | 否 | 证件类型 |
idNumber | String | 否 | 证件号,需要与证件类型匹配 |
phoneNumber | String | 否 | 联系号码 |
ownerName | String | 否 | 证书持有者姓名 |
commonName | String | 否 | 证书 CN 项,证书持有者名称 |
organization | String | 否 | 证书 O 项,证书所属组织 |
organizationUnit | String | 否 | 证书 OU 项,证书所属组织单元 |
country | String | 否 | 证书 C 项,国家,默认 CN |
province | String | 否 | 证书 S 项,证书所属省 |
city | String | 否 | 证书 L 项,证书所属市 |
districtCounty | String | 否 | 证书所属区县 |
givenName | String | 否 | 名字,证书GIVENNAME项 |
String | 否 | 证书所属人邮箱 | |
extraExtension | List<Extension> | 否 | 证书扩展项 |
medium | String | 否 | 介质信息 |
accountId | String | 否 | 交易账号 |
Extension 说明:
名称 | 类型 | 描述 |
---|---|---|
oid | String | 扩展项oid值 |
value | String | 扩展项值 |
name | String | 扩展项名称 |
证件类型(IdType)说明:
名称 | 描述 |
---|---|
ID | 身份证 |
PASSPORT | 护照 |
MILITARY_ID | 军人身份证 |
BUSINESS_REGISTRATION_CERT | 工商登记证 |
TAX_REGISTRATION_CERT | 税务登记证 |
SHAREHOLDER_CODE_CERT | 股东代码证 |
SOCIAL_SECURITY_CARD | 社会保障卡 |
ARMED_POLICE | 武装警察身份证件 |
HK_MACAU_PASSPORT | 港澳居民往来内地通行证 |
TAIWAN_PASSPORT | 台湾居民往来内地通行证 |
HOUSEHOLD_REGISTER | 户口簿 |
TEMPORARY_ID | 临时身份证 |
POLICE_CERT | 警官证 |
PERMANENT_RESIDENCE_PERMIT | 外国人永久居留证 |
GOVERNMENT_APPROVAL | 政府批文 |
UNIFIED_SOCIAL_CERT | 统一社会信用代码证 |
PRIVATE_NON_ENTERPRISE_CERT | 民办非企业登记证书 |
CORPORATE_CERT | 法人证书 |
OTHER | 其他 |
经办人信息(AgentInfo) 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
agentName | String | 否 | 经办人姓名 |
agentId | String | 否 | 经办人身份证号 |
agentPhone | String | 否 | 经办人手机号码 |
agentEmail | String | 否 | 经办人邮箱 |
note | String | 否 | 经办人备注 |
代码实例:public class EnterpriseCertSopApiTest {
/**
* 企业证书签发测试
*/
@Test
public void testIssue() throws Exception {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
EnterpriseCertSopApi enterpriseCertSopApi = new EnterpriseCertSopApiImpl(apiClient);
//构造企业高级证书签发请求
EnterpriseIssueRequest request = new EnterpriseIssueRequest();
//初始化企业高级证书信息
EnterpriseSeniorCertificate enterpriseSeniorCertificate = getEnterpriseSeniorCertificate();
request.setEnterpriseSeniorCertificate(enterpriseSeniorCertificate);
//设置P10
request.setPkCS10(p10);
request.setExtend("456extend");
request.setPassword("789pass");
AgentInfo agentInfo = new AgentInfo();
agentInfo.setAgentEmail("11@qq.com");
agentInfo.setAgentName("测试企业发证");
agentInfo.setAgentPhone("15295586469");
agentInfo.setAgentId("362229188808224477");
agentInfo.setNote("a其它");
request.setAgentInfo(agentInfo);
request.setKeyId("test");
//调用证书签发接口
EnterpriseIssueResponse enterpriseIssueResponse = null;
try {
enterpriseIssueResponse = enterpriseCertSopApi.issue(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + enterpriseIssueResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + enterpriseIssueResponse.getRequestId());
System.out.println("SDK响应消息:" + enterpriseIssueResponse.getMsg());
System.out.println("SDK响应码:" + enterpriseIssueResponse.getErrorCode());
System.out.println("================================");
if (null != enterpriseIssueResponse.getData()) {
System.out.println("证书ID:" + enterpriseIssueResponse.getData().getSerial());
System.out.println("加密证书:" + enterpriseIssueResponse.getData().getEncryptionCert());
System.out.println("加密证书私钥:" + enterpriseIssueResponse.getData().getEncryptionPrivateKey());
System.out.println("SKF加密证书私钥:" + enterpriseIssueResponse.getData().getSkfEnvelopedKeyBlob());
System.out.println("签名证书:" + enterpriseIssueResponse.getData().getSignatureCert());
System.out.println("业务响应码:" + enterpriseIssueResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + enterpriseIssueResponse.getData().getMessage());
System.out.println("介质信息:" + enterpriseIssueResponse.getData().getMedium());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
/**
* 生成企业证书信息 在main方法里测试时该方法要加static关键字
*
* @return 企业证书信息
* @throws ParseException parseException
*/
private EnterpriseSeniorCertificate getEnterpriseSeniorCertificate() throws ParseException{
EnterpriseSeniorCertificate enterpriseSeniorCertificate = new EnterpriseSeniorCertificate();
//设置企业证书定制信息
enterpriseSeniorCertificate.setIdNumber("25258545655");
enterpriseSeniorCertificate.setIdType(IdType.BUSINESS_REGISTRATION_CERT);
enterpriseSeniorCertificate.setPhoneNumber("17311111111");
enterpriseSeniorCertificate.setOwnerName("测试");
// 设置证书基本信息
enterpriseSeniorCertificate.setCommonName("测试");
enterpriseSeniorCertificate.setOrganization("测试");
enterpriseSeniorCertificate.setOrganizationUnit("测试");
enterpriseSeniorCertificate.setCountry("CN");
enterpriseSeniorCertificate.setProvince("测试");
enterpriseSeniorCertificate.setCity("测试");
enterpriseSeniorCertificate.setDistrictCounty("测试");
enterpriseSeniorCertificate.setEmail("yingzheng@qin.cn");
enterpriseSeniorCertificate.setMedium("介质号");
enterpriseSeniorCertificate.setAccountId("accountIdTest");
return enterpriseSeniorCertificate;
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
msg | String | 业务描述 |
code | String | 业务返回码 |
signatureCert | String | 签名证书 |
encryptionCert | String | 加密证书 |
encryptionPrivateKey | String | 加密私钥 |
skfEnvelopedKeyBlob | String | skf加密私钥 |
serial | String | 证书序列号 |
medium | String | 介质信息 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书签发成功 |
其它 | 参考异常代码表 |
证书重发
传入身份信息,进行证书的重发。
一、公共参数
服务接口名称(即公共参数 method 的值): reissue
请求方式:POST
二、请求参数(请求方式为 post)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | CertReIssueRequest | 是 | 证书重发请求 |
CertReIssueRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
pkCS10 | String | 是 | 用于制作证书的 pkCS10 |
extensions | Map | 否 | 扩展属性 |
serial | String | 是 | 原证书序列号 |
accountId | String | 否 | 交易账号 |
password | String | 否 | 交易密码 |
extend | String | 否 | 预留信息 |
p1signature | String | 否 | P1签名值(Base64格式) |
keyId | String | 否 | keyId |
Extension 说明:
名称 | 类型 | 描述 |
---|---|---|
oid | String | 扩展项oid值 |
value | String | 扩展项值 |
name | String | 扩展项名称 |
代码实例:public class PersonalCertSopApiTest {
/**
* 个人高级证书重发(重发逻辑--先去签发一个新的证书,签发成功后再根据传过去的证书序列号进行注销)
*/
@Test
public void testReIssue() throws Exception {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi certSopApi = new CertSopApiImpl(apiClient);
//构造证书重发请求
CertReIssueRequest request = new CertReIssueRequest();
//当中台开启身份验证时,参数必传,否则发证等接口会身份验证失败
request.setAccountId("23131231");
request.setPassword("sdadasasda");
request.setExtend("333");
request.setSerial("00E958DEBD243C68191C111B51");
//设置P10
request.setPkCS10("MIIBIjCBxwIBADBnMRIwEAYDVQQDDAnor7jokZvkuq4xDzANBgNVBAsMBuicgOaxiTERMA8GA1UECgwI5YiY5aSHQ0ExDzANBgNVBAgMBuilv+icgDEPMA0GA1UEBwwG5oiQ6YO9MQswCQYDVQQGEwJDTjBZMBMGByqGSM49AgEGCCqBHM9VAYItA0IABIUT+EXmwY/3CHmXV76+f5FznDrjEUZyJodlZdrbeJT9Lw9ChcSL+KqALJlEyM9C3A031qfzrEj2nxVv6lYDBwQwDAYIKoEcz1UBg3UFAANIADBFAiAGCsni7U6Fa/Uhq3YJw8HeprH50EAw2MbbBoeoZW/A0QIhAMoIb7acmuqaVXhA5YyWvn6P+VtUrE0KzOeTkTd1UCLx");
request.setKeyId("test");
//调用证书重发接口
CertReIssueResponse certReIssueResponse = null;
try {
certReIssueResponse = certSopApi.reIssue(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + certReIssueResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + certReIssueResponse.getRequestId());
System.out.println("SDK响应消息:" + certReIssueResponse.getMsg());
System.out.println("SDK响应码:" + certReIssueResponse.getErrorCode());
System.out.println("================================");
if (null != certReIssueResponse.getData()) {
System.out.println("证书ID:" + certReIssueResponse.getData().getSerial());
System.out.println("加密证书:" + certReIssueResponse.getData().getEncryptionCert());
System.out.println("加密证书私钥:" + certReIssueResponse.getData().getEncryptionPrivateKey());
System.out.println("签名证书:" + certReIssueResponse.getData().getSignatureCert());
System.out.println("业务响应码:" + certReIssueResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + certReIssueResponse.getData().getMessage());
System.out.println("介质信息:" + certReIssueResponse.getData().getMedium());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
msg | String | 业务描述 |
code | String | 业务返回码 |
signatureCert | String | 签名证书 |
encryptionCert | String | 加密证书 |
encryptionPrivateKey | String | 加密私钥 |
skfEnvelopedKeyBlob | String | skf加密私钥 |
serial | String | 证书序列号 |
medium | String | 介质号 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书重发成功 |
其它 | 参考异常代码表 |
证书注销
输入证书标识,注销证书。
一、公共参数
服务接口名称(即公共参数 method 的值): revoke
请求方式:POST
二、请求参数
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | RevokeRequest | 是 | 证书注销请求 |
RevokeRequest 说明
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
serial | String | 是 | 证书序列号 |
accountId | String | 否 | 交易账号 |
password | String | 否 | 交易密码 |
extend | String | 否 | 预留信息 |
extensions | Map | 否 | 扩展属性 |
p1signature | String | 否 | P1签名值(Base64格式) |
代码实例:/**
* 证书注销测试
*/
@Test
public void testRevoke() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi certSopApi = new CertSopApiImpl(apiClient);
//证书注销请求
RevokeRequest request = new RevokeRequest();
// 证书序列号
request.setSerial("2021020400509787");
try {
//调用注销服务
RevokeResponse revokeResponse = certSopApi.revoke(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + revokeResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + revokeResponse.getRequestId());
System.out.println("SDK响应消息:" + revokeResponse.getMsg());
System.out.println("SDK响应码:" + revokeResponse.getErrorCode());
System.out.println("================================");
if (null != revokeResponse.getData()) {
System.out.println("注销结果:" + revokeResponse.getData().getResult());
System.out.println("证书序列号:" + revokeResponse.getData().getSerial());
System.out.println("业务响应码:" + revokeResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + revokeResponse.getData().getMessage());
System.out.println("介质信息:" + revokeResponse.getData().getMedium());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
业务响应名称 | 类型 | 描述 |
---|---|---|
code | String | 结果响应码 |
msg | String | 注销说明 |
serial | String | 证书序列号 |
result | Boolean | 注销结果 |
medium | String | 介质信息 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书注销成功 |
其它 | 参考异常代码表 |
证书延期
输入证书标识和需要延期的天数,对该证书进行延期。
一、公共参数
服务接口名称(即公共参数 method 的值): postpone
请求方式:POST
二、请求参数
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | PostponeRequest | 是 | 证书延期请求 |
PostponeRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
serial | String | 是 | 证书序列号 |
pkCS10 | String | 否 | 用于制作证书的 pkCS10 |
csrSignedData | String | 否 | 对P10进行签名后的pkCS7 |
userOldKey | Boolean | 否 | 是否使用原密钥对,默认为 True(此选项针对加密证书密钥对) |
userOldKey | Boolean | 否 | 是否使用原密钥对,默认为 True(此选项针对加密证书密钥对) |
accountId | String | 否 | 交易账号 |
password | String | 否 | 交易密码 |
extend | String | 否 | 预留信息 |
p1signature | String | 否 | P1签名值(Base64格式) |
extensions | Map | 否 | 扩展属性 |
keyId | String | 否 | keyId |
代码实例:/**
* 证书延期测试
*/
@Test
public void testPostpone() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi certSopApi = new CertSopApiImpl(apiClient);
// 证书延期请求
PostponeRequest request = new PostponeRequest();
// 证书序列号
request.setSerial("2021020400509875");
// 设置延期使用的制证P10,可以不设置,不设置默认使用原证书内容,不做密钥变动
// request.setPkCS10("pkcs10");
// 是否使用是否使用原密钥对,默认为true。如果设置false,则需要设置PcCS10属性。
// request.setUserOldKey(true);
request.setKeyId("test");
try {
//调用延期服务
PostponeResponse postponeResponse = certSopApi.postpone(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + postponeResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + postponeResponse.getRequestId());
System.out.println("SDK响应消息:" + postponeResponse.getMsg());
System.out.println("SDK响应码:" + postponeResponse.getErrorCode());
System.out.println("================================");
if (null != postponeResponse.getData()) {
System.out.println("证书序列号:" + postponeResponse.getData().getSerial());
System.out.println("加密证书:" + postponeResponse.getData().getEncryptionCert());
System.out.println("加密证书私钥:" + postponeResponse.getData().getEncryptionPrivateKey());
System.out.println("签名证书:" + postponeResponse.getData().getSignatureCert());
System.out.println("业务响应码:" + postponeResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + postponeResponse.getData().getMessage());
System.out.println("介质信息:" + enterpriseIssueResponse.getData().getMedium());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
signatureCert | String | 签名证书 |
encryptionCert | String | 加密证书 |
encryptionPrivateKey | String | 加密私钥 |
skfEnvelopedKeyBlob | String | skf加密私钥 |
serial | String | 证书序列号 |
medium | String | 介质信息 |
msg | String | 业务响应描述 |
code | String | 业务返回码 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 延期成功 |
其它 | 参考异常代码表 |
根据serial查询证书
传入证书serial,精确查询证书。
一、公共参数
服务接口名称(即公共参数 method 的值): query-by-serial
请求方式:GET
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | CertQueryBySerialRequest | 是 | 根据证书serial查询证书请求 |
CertQueryBySerialRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
serial | String | 是 | 待查询证书序列号 |
代码实例:/***
* 查询证书测试
*/
@Test
public void getBySerial() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi certSopApi = new CertSopApiImpl(apiClient);
// 证书查询请求
CertQueryBySerialRequest request = new CertQueryBySerialRequest();
request.setSerial("2021020400509847");
try {
//调用查询业务
CertQueryBySerialResponse certQueryBySerialResponse = certSopApi.queryBySerial(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + certQueryBySerialResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + certQueryBySerialResponse.getRequestId());
System.out.println("SDK响应消息:" + certQueryBySerialResponse.getMsg());
System.out.println("SDK响应码:" + certQueryBySerialResponse.getErrorCode());
System.out.println("================================");
if (null != certQueryBySerialResponse.getData()) {
System.out.println("业务响应码:" + certQueryBySerialResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + certQueryBySerialResponse.getData().getMessage());
System.out.println("证书列表:" + certQueryBySerialResponse.getData().getCertificate());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
certJson | String | 证书对象json 格式 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书查询成功 |
其它 | 参考异常代码表 |
查询证书状态
传入证书serial,查询证书状态。
一、公共参数
服务接口名称(即公共参数 method 的值): check-by-serial
请求方式:GET
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | CertCheckBySerialRequest | 是 | 根据证书serial查询证书状态 |
CertCheckBySerialResponse 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
serial | String | 是 | 待查询证书序列号 |
代码实例:/***
* 校验证书状态
*/
@Test
public void checkBySerial() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi certSopApi = new CertSopApiImpl(apiClient);
// 证书查询请求
CertCheckBySerialRequest request = new CertCheckBySerialRequest();
request.setSerial("6d1fd8a15ff885df553340eea1e26241b165ee44");
try {
//调用查询业务
CertCheckBySerialResponse certQueryBySerialResponse = certSopApi.checkBySerial(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + certQueryBySerialResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + certQueryBySerialResponse.getRequestId());
System.out.println("SDK响应消息:" + certQueryBySerialResponse.getMsg());
System.out.println("SDK响应码:" + certQueryBySerialResponse.getErrorCode());
System.out.println("================================");
if (null != certQueryBySerialResponse.getData()) {
System.out.println("业务响应码:" + certQueryBySerialResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + certQueryBySerialResponse.getData().getMessage());
System.out.println("证书状态:" + certQueryBySerialResponse.getData().getResult());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
result | String | 1 签发状态 0 注销状态 2 证书已过期 3 即将过期 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书查询成功 |
其它 | 参考异常代码表 |
查询时间戳查询keyid
传入时间戳timestamp,查询证书状态。
一、公共参数
服务接口名称(即公共参数 method 的值): certKeyId.by.timestamp
请求方式:GET
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | CertKeyByTimeStampRequest | 是 | 根据时间戳查询证书keyid |
CertCheckBySerialResponse 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
timeStamp | String | 否 | 时间戳 |
代码实例:
/*** |
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
certKeyDtos | List |
证书keyid列表 |
CertKeyDto 说明:
名称 | 类型 | 描述 |
---|---|---|
keyId | String | 协签keyid |
certSerial | String | 证书序列号 |
methodName | String | 方法名 |
timestamp | String | 时间戳 |
certStatus | String | 证书状态 2000-已签发 4000-已注销 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书查询成功 |
其它 | 参考异常代码表 |
根据交易账号查询证书列表
传入交易账号,查询该交易账号所签发未注销证书列表。
一、公共参数
服务接口名称(即公共参数 method 的值): query-by-account
请求方式:GET
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | QueryByAccountIdRequest | 是 | 根据客户编码查询证书列表 |
QueryByAccountIdRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
accountId | String | 是 | 交易账号 |
代码实例:/***
* 查询证书统计
*/
@Test
public void queryByAccountId() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi certSopApi = new CertSopApiImpl(apiClient);
// 证书统计查询请求
QueryByAccountIdRequest request = new QueryByAccountIdRequest();
request.setAccountId("accountIdTest");
try {
//调用查询业务
QueryByAccountIdResponse certQueryBySerialResponse = certSopApi.countByClientId(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + certQueryBySerialResponse);
System.out.println("================================");
System.out.println("SDK请求ID:" + certQueryBySerialResponse.getRequestId());
System.out.println("SDK响应消息:" + certQueryBySerialResponse.getMsg());
System.out.println("SDK响应码:" + certQueryBySerialResponse.getErrorCode());
System.out.println("================================");
if (null != certQueryBySerialResponse.getData()) {
System.out.println("业务响应码:" + certQueryBySerialResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + certQueryBySerialResponse.getData().getMessage());
System.out.println("证书列表:" + certQueryBySerialResponse.getData().getSimpleCertList());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
simpleCertList | List<SimpleCert> | 证书列表 |
SimpleCert 说明:
名称 | 类型 | 描述 |
---|---|---|
certSerial | String | 证书序列号 |
notBefore | String | 证书起始有效期 |
notAfter | String | 证书截止有效期 |
medium | String | 证书介质信息 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 证书查询成功 |
其它 | 参考异常代码表 |
查询增量CRL
查询注销证书信息列表。
一、公共参数
服务接口名称(即公共参数 method 的值): get-crl-by-timestamp
请求方式:GET
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | CertCrlRequest | 是 | 数据查询请求 |
CertCrlRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
startTimestamp | Long | 否 | 起始时间戳 查询起启时间 默认 2021-1-1 00:00:00 |
count | Integer | 否 | 限制最大条数 默认 100 |
代码实例:/***
* 查询增量crl
*/
@Test
public void getCrlIncrement() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertCrlApi certSopApi = new CertCrlApiImpl(apiClient);
// 证书增量crl查询请求
CertCrlRequest request = new CertCrlRequest();
//起始时间 非必传
request.setStartTimestamp(1619343065199L);
// 数据量 非必传
request.setCount(500);
try {
CertCrlResponse response = certSopApi.getCrlIncrement(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + response);
System.out.println("================================");
System.out.println("SDK请求ID:" + response.getRequestId());
System.out.println("SDK响应消息:" + response.getMsg());
System.out.println("SDK响应码:" + response.getErrorCode());
System.out.println("================================");
if (null != response.getData()) {
System.out.println("crl数据列表:" + response.getData().getCertCrlList());
System.out.println("请求服务器时间戳:" + response.getData().getTimestamp());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
certCrlList | List<CrlDto> | 证书列表 |
timestamp | Long | 服务器时间戳 |
CrlDto 说明:
名称 | 类型 | 描述 |
---|---|---|
certSerial | String | 证书序列号 |
certDn | String | 证书主题项 |
timestamp | Long | 注销时间戳 |
notAfter | Long | 证书截止有效期 |
raType | String | ra类型 PUHUA 普华RA; UNI 先安UNI; SMART 智慧; TWCX 天威诚信;LCA 本地ca;CFCA CFCA |
id | String | 唯一标识 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 查询成功 |
其它 | 参考异常代码表 |
下载全量CRL文件
下载全量的CRL证书文件。
一、公共参数
服务接口名称(即公共参数 method 的值): get-all-crl-file
请求方式:GET
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | CrlAllFileRequest | 是 | 下载全量CRL请求 |
代码实例:/***
* 查询增量crl
*/
@Test
public void getCrlIncrement() {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertCrlApi certSopApi = new CertCrlApiImpl(apiClient);
// 下载全量CRL请求
CrlAllFileRequest request = new CrlAllFileRequest();
try {
CrlAllFileResponse response = certSopApi.getCrlAllFile(request);
//后续业务处理
System.out.println("================================");
System.out.println("响应内容:" + response);
System.out.println("================================");
System.out.println("SDK请求ID:" + response.getRequestId());
System.out.println("SDK响应消息:" + response.getMsg());
System.out.println("SDK响应码:" + response.getErrorCode());
System.out.println("================================");
if (null != response.getData()) {
System.out.println("crl文件Hex字符串:" + response.getData().getCrlFileHexStr());
// 文件下载路径
File file = new File("d://cip-crl.crl");
FileUtils.writeByteArrayToFile(file, response.getData().getCrlFile());
}
} catch (ApiException | IOException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
crlFileHexStr | String | crl文件-Hex字符串 |
crlFile | byte[] | crl文件-byte数组 |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 查询成功 |
其它 | 参考异常代码表 |
服务器证书签发
服务器证书签发。
一、公共参数
服务接口名称(即公共参数 method 的值): apply-server-cert
请求方式:POST
二、请求参数(请求方式为 GET)
- 请求参数以表单形式提交,Content-Type 值为: application/x-www-form-urlencoded;charset=utf-8
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
request | ApplyServerCertRequest | 是 | 服务器证书签发请求 |
ApplyServerCertRequest 说明:
名称 | 类型 | 是否必须 | 描述 |
---|---|---|---|
pkCS10 | String | 是 | Pkcs10 |
commonName | String | 是 | 证书名 |
hours | Integer | 否 | 证书有效时长(小时) |
extend | Map | 否 | 扩展项 |
代码实例:
/**
* 服务器证书签发测试
*/
@Test
public void testServerCertIssue() throws Exception {
// 提供的服务地址map集合
HashMap<String, String> map = new HashMap<String, String>();
map.put("cip.api.gf.demo.smartcert.cn", "cn-beijing-1");
map.put("cip.api.gx.demo.smartcert.cn","cn-nanjing-1");
// 优先地域
String location = "cn-nanjing";
// 备用地域集合
List<String> reserveLocation = new ArrayList<String>();
reserveLocation.add("cn-beijing");
// 您的appKey
String appKey = "w8MuGC9C";
// 您的secretKey
String secretKey = "4wVznIMB";
// 构造接口实例
ApiClient apiClient = new DefaultApiClient(map, location, reserveLocation, appKey, secretKey);
CertSopApi sopApi = new CertSopApiImpl(apiClient);
//证书签发请求
ServerCertIssueRequest request = new ServerCertIssueRequest();
//证书名称
request.setCommonName("测试");
//证书有效期时长 小时
request.setHours(3);
//设置P10
request.setPkCS10("MIIBKzCB0QIBADBxMRQwEgYDVQQDDAvlkLTkvJ/kvJ93dzESMBAGA1UECwwJ5aO56K+B6YCaMRAwDgYDVQQKDAdTbWFydENBMRIwEAYDVQQHDAnljZfkuqzluIIxEjAQBgNVBAgMCeaxn+iLj+ecgTELMAkGA1UEBhMCQ04wWTATBgcqhkjOPQIBBggqgRzPVQGCLQNCAAT7DqQKwRpAFITWN7+h5OwnhR5SwVH7XcfJuZGKGJs/lMrgH3l2TkwoM82yxBNliGBoaW4YZoTpiQCnL3SWQD6qMAwGCCqBHM9VAYN1BQADRwAwRAIgP5hKJc7PITjPKWVfO1ZkEmDs2w2tqRus7zFozJmfHgcCIEFTSNdmr8ycPXLvreY6xxXYDkHJfL+yGitmRrnlFKVu");
//证书使用者可选名称 非必要
Map<String, String> certMap = new HashMap<String, String>();
// 非必传
List<GeneralNameSimple> list = new ArrayList<GeneralNameSimple>();
GeneralNameSimple generalNameSimple = new GeneralNameSimple("www.baidu.com",2);
GeneralNameSimple generalNameSimple1 = new GeneralNameSimple("www.baidu2.com",2);
GeneralNameSimple generalNameSimple2 = new GeneralNameSimple("192.168.10.1",7);
list.add(generalNameSimple);
list.add(generalNameSimple1);
list.add(generalNameSimple2);
certMap.put("generalName", JSONArray.toJSONString(list));
request.setExtend(map);
ServerCertIssueResponse response = null;
try {
response = sopApi.issueServerCert(request);
//后续业务处理
System.out.println("================================");
System.out.println("签发成功,响应内容:" + response);
System.out.println("================================");
System.out.println("SDK请求ID:" + response.getRequestId());
System.out.println("SDK响应消息:" + response.getMsg());
System.out.println("SDK响应码:" + response.getErrorCode());
System.out.println("================================");
if (null != response.getData()) {
System.out.println("证书序列号:" + response.getData().getSerial());
System.out.println("加密证书:" + response.getData().getEncryptionCert());
System.out.println("加密证书私钥:" + response.getData().getEncryptionPrivateKey());
System.out.println("签名证书:" + response.getData().getSignatureCert());
System.out.println("证书有效时长(小时):" + response.getData().getHours());
}
} catch (ApiException e) {
e.printStackTrace();
}
}
三、响应参数
data 结果信息 | 类型 | 描述 |
---|---|---|
signatureCert | String | 签名证书 |
encryptionCert | String | 加密证书 |
encryptionPrivateKey | String | 加密私钥 |
serial | String | 证书序列号 |
hours | Integer | 证书有效时长(小时) |
四、成功示例
JSON示例
{ |
五、失败示例
JSON示例
{ |
六、返回码说明(incorrect)
返回码 | 描述 |
---|---|
0 | 签发成功 |
其它 | 参考异常代码表 |