API接口文档

证书签发

传入身份信息,进行证书的申请和签发。

一、公共参数

二、请求参数(请求方式为 post)

名称 类型 是否必须 描述
request PersonalIssueRequest 个人高级证书签发请求

PersonalIssueRequest 说明:

名称 类型 是否必须 描述
personalSeniorCertificate PersonalSeniorCertificate 个人高级证书实体信息
pkCS10 String 用于制作证书的 pkCS10
extensions Map 扩展属性
agentInfo AgentInfo 经办人信息(非合约用户必传经办人手机号)
password String 交易密码
extend String 预留信息

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项
notBefore Date 证书有效期-生效时间
notAfter Date 证书有效期-到期时间
email 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 CertSopApiTest{

@Test
public void issueCert() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, 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=");
//调用证书签发接口
PersonalIssueResponse personalIssueResponse = null;

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("签名证书:" + personalIssueResponse.getData().getSignatureCert());
System.out.println("业务响应码:" + personalIssueResponse.getData().getIncorrect());
System.out.println("业务响应消息:" + personalIssueResponse.getData().getMessage());
System.out.println("介质信息:" + personalIssueResponse.getData().getMedium());
}
}

/**
* 构造高级证书签发请求
*/
private static PersonalSeniorCertificate getPersonalSeniorCertificate() {
PersonalSeniorCertificate personalSeniorCertificate = new PersonalSeniorCertificate();
personalSeniorCertificate.setAccountId("021100000169");
return personalSeniorCertificate;
}
}

三、响应参数

data 结果信息 类型 描述
msg String 业务描述
code String 业务返回码
signatureCert String 签名证书
encryptionCert String 加密证书
encryptionPrivateKey String 加密私钥
skfEnvelopedKeyBlob String skf加密私钥
serial String 证书序列号
medium String 介质号

四、成功示例

JSON示例

{
"code": 0,
"meg":"success",
"requestId": null,
"data": {
"serial":"2021020300508655",
"signatureCert":"MIICsz...",
"encryptionCert":"MIICsjCCA....",
"encryptionPrivateKey":"MIHtMAkGByqB...",
"skfEnvelopedKeyBlob":"AAQCAAEEAAC...",
"medium":"介质号",
"success":true
}
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 证书签发成功
其它 参考异常代码表

证书注销

输入证书标识,注销证书。

一、公共参数

二、请求参数

名称 类型 是否必须 描述
request RevokeRequest 证书注销请求

RevokeRequest 说明

名称 类型 是否必须 描述
serial String 证书序列号
accountId String 交易账号
password String 交易密码
extend String 预留信息
extensions Map 扩展属性

代码实例:

/**
* 证书注销
*/
public class CertSopApiTest{
@Test
public void testRevoke() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApiImpl certSopApi = new CertSopApiImpl(apiClient);
String serial = "2021020400509875";
// 证书注销请求
RevokeRequest request = new RevokeRequest();
// 证书序列号
request.setSerial(serial);
// 调用注销服务
RevokeResponse revokeResponse = certSopApi.revoke(request);
// 后续业务处理
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());
}
}
}

三、响应参数

业务响应名称 类型 描述
code String 结果响应码
msg String 注销说明
serial String 证书序列号
result Boolean 注销结果
medium String 介质信息

四、成功示例

JSON示例

{
"code":0,
"message":"success",
"requestId":null,"data":{
"serial":"2021020400509787",
"medium":"介质信息",
"result":true
},
"success":true
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 证书注销成功
其它 参考异常代码表

证书延期

输入证书标识和需要延期的天数,对该证书进行延期。

一、公共参数

二、请求参数

名称 类型 是否必须 描述
request PostponeRequest 证书延期请求

PostponeRequest 说明:

名称 类型 是否必须 描述
serial String 证书序列号
duration String 延期天数(默认一年)
pkCS10 String 用于制作证书的 pkCS10
csrSignedData String 对P10进行签名后的pkCS7
userOldKey Boolean 是否使用原密钥对,默认为 True(此选项针对加密证书密钥对)
extensions Map 扩展属性

代码实例:

/**
* 证书延期
*/
public class CertSopApi{
@Test
public void postpone() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApiImpl certSopApi = new CertSopApiImpl(apiClient);
String serial = "2021020400509875";
// 证书延期请求
PostponeRequest request = new PostponeRequest();
// 证书序列号
request.setSerial(serial);
//调用延期服务
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());
}
}
}

三、响应参数

data 结果信息 类型 描述
signatureCert String 签名证书
encryptionCert String 加密证书
encryptionPrivateKey String 加密私钥
skfEnvelopedKeyBlob String skf加密私钥
serial String 证书序列号
medium String 介质信息
msg String 业务响应描述
code String 业务返回码

四、成功示例

JSON示例

{
"code":0,
"message":"success",
"requestId":null,
"data": {
"serial":"2021020300508775",
"signatureCert":"MIICmjCC...",
"encryptionCert":"MIICmjCC...",
"encryptionPrivateKey":"MIHtMA...",
"medium":"介质信息",
"skfEnvelopedKeyBlob":"AAQCAAEEA..."
},
"success":true
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 延期成功
其它 参考异常代码表

根据serial查询证书

传入证书serial,精确查询证书。

一、公共参数

二、请求参数(请求方式为 GET)

名称 类型 是否必须 描述
request CertQueryBySerialRequest 根据证书serial查询证书请求

CertQueryBySerialRequest 说明:

名称 类型 是否必须 描述
serial String 待查询证书序列号

代码实例:

/**
* 根据serial查询证书
*/
public class CertSopApi{
@Test
public void getBySerial() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApiImpl certSopApi = new CertSopApiImpl(apiClient);
String serial = "2021020400509875";
// 证书查询请求
CertQueryBySerialRequest request = new CertQueryBySerialRequest();
request.setSerial(serial);
//调用查询业务
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());
}
}
}

三、响应参数

data 结果信息 类型 描述
certJson String 证书对象json 格式

四、成功示例

JSON示例

{
"code":0,
"message":"success",
"requestId":"uhoRcXOe1A",
"data":{
"incorrect":"0",
"certJson":{"certSerial":"2021031100571857","certificateType":"ENTERPRISE_SENIOR","city":"咸阳1","accountId":"accountId123","commonName":"嬴政","country":"秦","districtCounty":"咸阳2","encCertificate":"MIICmTCCAj+gAwIBAgIIICEDEQBXGFgwCgYIKoEcz1UBg3UwdjEcMBoGA1UEAwwTU21hcnRDQV9UZXN0X1NNMl9DQTEVMBMGA1UECwwMU21hcnRDQV9UZXN0MRAwDgYDVQQKDAdTbWFydENBMQ8wDQYDVQQHDAbljZfkuqwxDzANBgNVBAgMBuaxn+iLjzELMAkGA1UEBhMCQ04wHhcNMjEwMzExMDUxNjQyWhcNMjIwMzExMDUxNjQyWjCBtDEwMC4GA1UELQwnMzgzNDdhODgxYTA1NDA0YmE2Y2MwNTBjZmFlNTZlNDEyMDIxMDNEMR8wHQYJKoZIhvcNAQkBDBB5aW5nemhlbmdAcWluLmNuMQowCAYDVQQGEwHmMQ8wDQYDVQQIDAblkrjpmLMxEDAOBgNVBAcMB+WSuOmYszExDTALBgNVBAoMBEJKQ0ExDTALBgNVBAsMBETooagxEjAQBgNVBAMMCeWstOaUv0AzNDBZMBMGByqGSM49AgEGCCqBHM9VAYItA0IABK88LkCKCim4utjvOpxO6sbRS+XAwshVpEC/JEuYXkI51kpj0i3uJ62Ft6sKGqxv3r4nt053+Op4j7OzgbkK0uejeDB2MAsGA1UdDwQEAwIDODAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBTpota15Llh3n5bXqMkFB+baUVQjjAfBgNVHSMEGDAWgBRc87oljMJlDOxn777djWunXq/jrDAZBggqgRzQFAQBAwQNEwsyNTI1ODU0NTY1NTAKBggqgRzPVQGDdQNIADBFAiEAh1iJgubeuMoa87JGOJb3XYWyeC2o0KCA0CxOdc2gL9QCICGGpIa4iTqvKdhVNvIbbBiz9LENJ2ZBKlNx63K3ZdFz","encryptionPrivateKey":"MIHtMAkGByqBHM9VAWgweQIhAMPGvfd1rSEhM9oJ3FPQeK6+gCeiaA3dvZw2r/2DfLmEAiAdBHvAtFdRePKE02R67Y4gaHnrpbU2XPmkY4eGr2mSFwQg217NOnNAnKp/4ZuzV4byr8R+E7+s/Sfgc9MhFHiRykYEEA/H5COLCI3uoLf3JU1NzlkDQgAErzwuQIoKKbi62O86nE7qxtFL5cDCyFWkQL8kS5heQjnWSmPSLe4nrYW3qwoarG/evie3Tnf46niPs7OBuQrS5wMhAEZYlED1bqwArTg/CKZ7Q5ELuBaZtubY5Gd9G+iwr8W+","fingerprint":"f286ae0bbfe0b5ac60a1a953234da9665251ffc6","id":"2bf2b7e495694222ad444cb38758811c202103","idNumber":"25258545655","idType":"BUSINESS_REGISTRATION_CERT","issuer":"CN=SmartCA_Test_SM2_CA,OU=SmartCA_Test,O=SmartCA,L=南京,ST=江苏,C=CN","medium":"介质号","notAfter":1646975802000,"notBefore":1615439802000,"operateTime":1615439807183,"organization":"嬴政1","organizationUnit":"皇帝","province":"咸阳","raCode":"fbac26e3cea84c4b9198a46b1cffe992","raDesc":"智慧RA企业","sigCertificate":"MIICmTCCAj+gAwIBAgIIICEDEQBXGFcwCgYIKoEcz1UBg3UwdjEcMBoGA1UEAwwTU21hcnRDQV9UZXN0X1NNMl9DQTEVMBMGA1UECwwMU21hcnRDQV9UZXN0MRAwDgYDVQQKDAdTbWFydENBMQ8wDQYDVQQHDAbljZfkuqwxDzANBgNVBAgMBuaxn+iLjzELMAkGA1UEBhMCQ04wHhcNMjEwMzExMDUxNjQyWhcNMjIwMzExMDUxNjQyWjCBtDEwMC4GA1UELQwnMzgzNDdhODgxYTA1NDA0YmE2Y2MwNTBjZmFlNTZlNDEyMDIxMDNEMR8wHQYJKoZIhvcNAQkBDBB5aW5nemhlbmdAcWluLmNuMQowCAYDVQQGEwHmMQ8wDQYDVQQIDAblkrjpmLMxEDAOBgNVBAcMB+WSuOmYszExDTALBgNVBAoMBEJKQ0ExDTALBgNVBAsMBETooagxEjAQBgNVBAMMCeWstOaUv0AzNDBZMBMGByqGSM49AgEGCCqBHM9VAYItA0IABIaUMbAwU5WQGRS0Wgy0McnrskNurF0NgEBjCvgxbvWXPznQEmWT+jnv1dn1m6bdDEUlXFsMxPomrNPSf2xWwCajeDB2MAsGA1UdDwQEAwIGwDAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBSP8WU10ScXPpxlb+of/moHZg+OtzAfBgNVHSMEGDAWgBRc87oljMJlDOxn777djWunXq/jrDAZBggqgRzQFAQBAwQNEwsyNTI1ODU0NTY1NTAKBggqgRzPVQGDdQNIADBFAiEAtOMCk6TLpDopGjLjdpEUVHcer/QrAPCvUr2fwjveKrACIDq72Bo5SXUNRnRFh+6bE1GNYoblPmkjwAqNU3LOlj2A","status":"2000","subject":"CN=嬴政,OU=皇帝,O=嬴政1,L=咸阳1,ST=咸阳,C=秦","subjectRa":"UniqueIdentifier=38347a881a05404ba6cc050cfae56e41202103D,E=yingzheng@qin.cn,C=æ,ST=咸阳,L=咸阳1,O=BJCA,OU=D表,CN=嬴政@34","version":"2"}
},
"success":true
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 证书查询成功
其它 参考异常代码表

证书重发

传入身份信息,进行证书的重发。

一、公共参数

二、请求参数(请求方式为 post)

名称 类型 是否必须 描述
request CertReIssueRequest 证书重发请求

CertReIssueRequest 说明:

名称 类型 是否必须 描述
pkCS10 String 用于制作证书的 pkCS10
extensions Map 扩展属性
serial String 原证书序列号
accountId String 交易账号
password String 交易密码
extend String 预留信息
p1signature String P1签名值(Base64格式)

Extension 说明:

名称 类型 描述
oid String 扩展项oid值
value String 扩展项值
name String 扩展项名称

代码实例:

/**
* 证书重发
*/
public class CertSopApi{
@Test
public void testReIssue() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApiImpl certSopApi = new CertSopApiImpl(apiClient);
String serial = "2021020400509875";
//构造企业高级证书签发请求
CertReIssueRequest request = new CertReIssueRequest();
request.setSerial(serial);
//设置P10
request.setPkCS10("MIIBIjCBxwIBADBnMRIwEAYDVQQDDAnor7jokZvkuq4xDzANBgNVBAsMBuicgOaxiTERMA8GA1UECgwI5YiY5aSHQ0ExDzANBgNVBAgMBuilv+icgDEPMA0GA1UEBwwG5oiQ6YO9MQswCQYDVQQGEwJDTjBZMBMGByqGSM49AgEGCCqBHM9VAYItA0IABIUT+EXmwY/3CHmXV76+f5FznDrjEUZyJodlZdrbeJT9Lw9ChcSL+KqALJlEyM9C3A031qfzrEj2nxVv6lYDBwQwDAYIKoEcz1UBg3UFAANIADBFAiAGCsni7U6Fa/Uhq3YJw8HeprH50EAw2MbbBoeoZW/A0QIhAMoIb7acmuqaVXhA5YyWvn6P+VtUrE0KzOeTkTd1UCLx");
//调用证书签发接口
CertReIssueResponse certReIssueResponse = null;
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());
}
}
}

三、响应参数

data 结果信息 类型 描述
msg String 业务描述
code String 业务返回码
signatureCert String 签名证书
encryptionCert String 加密证书
encryptionPrivateKey String 加密私钥
skfEnvelopedKeyBlob String skf加密私钥
serial String 证书序列号
medium String 介质号

四、成功示例

JSON示例

{
"code": 0,
"meg":"success",
"requestId": null,
"data": {
"serial":"2021020300508655",
"signatureCert":"MIICsz...",
"encryptionCert":"MIICsjCCA....",
"encryptionPrivateKey":"MIHtMAkGByqB...",
"skfEnvelopedKeyBlob":"AAQCAAEEAAC...",
"medium":"介质号",
"success":true
}
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 证书重发成功
其它 参考异常代码表

查询证书状态

传入证书serial,查询证书状态。

一、公共参数

二、请求参数(请求方式为 GET)

名称 类型 是否必须 描述
request CertCheckBySerialRequest 根据证书serial查询证书状态

CertCheckBySerialResponse 说明:

名称 类型 是否必须 描述
serial String 待查询证书序列号

代码实例:

/**
* 查询证书状态
*/
public class CertSopApi{
@Test
public void checkBySerial() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApiImpl certSopApi = new CertSopApiImpl(apiClient);
String serial = "2021020400509875";
// 证书查询请求
CertCheckBySerialRequest request = new CertCheckBySerialRequest();
request.setSerial(serial);
//调用查询业务
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());
System.out.println("状态查询成功,证书有效期剩余天数:" + certQueryBySerialResponse.getData().getValidityRemainingDays());
}
}
}

三、响应参数

data 结果信息 类型 描述
result String 1 签发状态 0 注销状态 2 证书已过期 3 即将过期

四、成功示例

JSON示例

{
"code":0,
"message":"success",
"requestId":"vwRLJwqvon",
"data":{
"incorrect":"0",
"result":"0"
},
"success":true
}

五、失败示例

JSON示例

{
"code":30106,
"message":"证书不存在!",
"requestId":"HtKvGF6k7E",
"data":null,
"success":false
}

六、返回码说明(incorrect)

返回码 描述
0 证书查询成功
其它 参考异常代码表

根据交易账号查询证书列表

传入交易账号,查询该交易账号所签发未注销证书列表。

一、公共参数

二、请求参数(请求方式为 GET)

名称 类型 是否必须 描述
request QueryByAccountIdRequest 根据客户编码查询证书列表

QueryByAccountIdRequest 说明:

名称 类型 是否必须 描述
accountId String 交易账号

代码实例:

/**
* 根据交易账号查询证书列表
*/
public class CertSopApi{
@Test
public void queryByAccountId() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApiImpl certSopApi = new CertSopApiImpl(apiClient);
String accountId = "000020211124";
// 证书统计查询请求
QueryByAccountIdRequest request = new QueryByAccountIdRequest();
request.setAccountId(accountId);
//调用查询业务
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());
}
}
}

三、响应参数

data 结果信息 类型 描述
simpleCertList List<SimpleCert> 证书列表

SimpleCert 说明:

名称 类型 描述
certSerial String 证书序列号
notBefore String 证书起始有效期
notAfter String 证书截止有效期
medium String 证书介质信息

四、成功示例

JSON示例

{
"code":0,
"message":"success",
"requestId":"4MvyVwKzaV",
"data":{
"incorrect":"0",
"simpleCertList":[
{
"certSerial":"00b13af423884a05106bc9ae0b",
"notBefore":"2021-03-05",
"notAfter":"2022-03-05",
"medium":"IOS"
},
{
"certSerial":"171422bd606922fc534ce9c7772f08ff0bf09217",
"notBefore":"2021-03-12",
"notAfter":"2022-03-12",
"medium":null
}
]
},
"success":true
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 证书查询成功
其它 参考异常代码表

查询增量CRL

查询注销证书信息列表。

一、公共参数

二、请求参数(请求方式为 GET)

名称 类型 是否必须 描述
request CertCrlRequest 数据查询请求

CertCrlRequest 说明:

名称 类型 是否必须 描述
startTimestamp Long 起始时间戳 查询起启时间 默认 2021-1-1 00:00:00
count Integer 限制最大条数 默认 100

代码实例:

/**
* 查询增量crl
*/
public class CertSopApi{
@Test
public void getCrl() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertCrlApi certSopApi = new CertCrlApiImpl(apiClient);
// 证书增量crl查询请求
CertCrlRequest request = new CertCrlRequest();
//起始时间 非必传
request.setStartTimestamp(1619343065199L);
// 数据量 非必传
request.setCount(500);
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());
}
}
}

三、响应参数

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示例

{
"code":0,
"message":"success",
"requestId":"KMEUW2kDrn",
"data":{
"certCrlList":[
{
"id":"d0fad423ee3e49f5a3d37ad22be6edb2",
"serial":"3300000007434894",
"certDn":"C=CN,ST=蜀地1,L=成都1,CN=刘禅12231619405625549",
"timestamp":1619405640802
}
]
},
"success":true
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 查询成功
其它 参考异常代码表

服务器证书签发

服务器证书签发。

一、公共参数

二、请求参数(请求方式为 GET)

名称 类型 是否必须 描述
request ApplyServerCertRequest 服务器证书签发请求

ApplyServerCertRequest 说明:

名称 类型 是否必须 描述
pkCS10 String Pkcs10
commonName String 证书名
hours Integer 证书有效时长(小时)
extend Map 扩展项

代码实例:

 /**
* 服务器证书签发测试
*/
public class CertSopApi{
@Test
public void testServerCertIssue() throws Exception {
//您的appKey
String appKey = "Ux2EPrSu";
//您的appSecret
String secretKey = "beDXtTs3";
List<String> list = new CopyOnWriteArrayList();
list.add("172.16.3.219:44099");
list.add("172.16.3.219:44022");
DefaultApiClient apiClient = new DefaultApiClient(list, appKey, secretKey);
CertSopApi certSopApi = 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> certList = 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);
certList.add(generalNameSimple);
certList.add(generalNameSimple1);
certList.add(generalNameSimple2);
certMap.put("generalName", JSONArray.toJSONString(certList));
request.setExtend(certMap);
ServerCertIssueResponse response = null;
response = certSopApi.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());
}
}
}

三、响应参数

data 结果信息 类型 描述
signatureCert String 签名证书
encryptionCert String 加密证书
encryptionPrivateKey String 加密私钥
serial String 证书序列号
hours Integer 证书有效时长(小时)

四、成功示例

JSON示例

{
"errorCode": 0,
"msg":"success",
"requestId": null,
"data": {
"serial":"2021020300508655",
"signatureCert":"MIICsz...",
"encryptionCert":"MIICsjCCA....",
"encryptionPrivateKey":"MIHtMAkGByqB...",
"hours":1
}
}

五、失败示例

JSON示例

{
"errorCode":30200302,
"msg":"appKey不存在",
"requestId":null,
"body":{
"code":30200302,
"message":"appKey不存在",
"requestId":null,
"data":null,
"success":false
}
}

六、返回码说明(incorrect)

返回码 描述
0 签发成功
其它 参考异常代码表