文档中心 API文档 修改证书V2

修改证书V2

更新时间:2023-09-22 10:31:48

适用产品

证书管理

接口描述

修改客户证书,可重新上传证书。

调用频率

单用户调用频率:300/5min

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Path 参数

参数名称类型必填描述
certificateId
Integer需要修改的证书id

Body 参数

参数名称类型必填描述
name
String证书名称
certificate
String证书内容,PEM格式,包含CRT文件、CA文件。例如: -----BEGIN CERTIFICATE----- …… -----END CERTIFICATE-----
privateKey
String证书密钥,PEM格式。例如: -----BEGIN RSA PRIVATE KEY----- …… -----BEGIN RSA PRIVATE KEY-----
csrId
IntegercsrId,证书申请文件的id
comment
String备注信息

返回参数

Body 参数

参数名称类型描述
code
String接口响应code,0代表成功。
message
String接口响应信息,success代表成功,失败则提供失败信息。
data
String接口响应数据

错误码

错误代码(code)描述(message)HTTP状态码语义
0success200调用成功
26938005Parameter name is required400证书名称不允许为空
26938005Parameter name max size is 512400证书名称不允许超过512个字符
26938005Parameter certificate is required400证书文件内容必传
26938005Parameter comment max size is 1024400备注不允许超过1024个字符
26939999The certificate you provided is invalid.400certificateId不是整数型
36540130certContent is empty.400请求参数的sslCertificate为空
36540131bad request.certificateId and fileName are both empty.400certificateId和fileName均为空
36540132Certificate entity not found. certificateId="", fileName=""400找不到要修改的证书
36540000The certificate is not found or deleted.400证书存在,但是已标记删除
36540134The certificate is not belong to this given customer.400入参客户与证书客户不一致
36540138invalid algorithm.algorithm=400算法的值为【des、aes】以外的数据
36540139certificate content decrypt error. invalid crtFile or key.400crt证书解密失败
36540140certificate content decrypt error. invalid caFile or key.400ca证书解密失败
36540141certificate content decrypt error. invalid keyFile or key.400key证书解密失败
36540072The {0} content can not contain blank line and must be 64 characters except for the last line.400{0}文件不能包含空行且除了最后一行以外都必须64位字符
36540142invalid sslCertificate. no found crtCnDomain in crtFile.400crt证书解析失败或crt证书无授权域名
36540105No CRT certificate be found in .crt and .crt file.400crt与ca文件中均未找到CRT证书
36540144The crt file's algorithm is forbidden.400crt文件的签名算法非法:不支持的加密算法
36540145Updating with expired certificates is not allowed.400证书过期,入参isAllowUseExpiredCert为false
36540146invalid sslKey.400秘钥解析失败
36540147private key is not match with public key.400公私钥不匹配
36540101The uploaded Crt certificate is invalid!400crt证书解析失败
36540098The number of BEGIN is not match the END statement in .crt file.400证书文件内容格式错误:BEGIN和END数量不匹配
36540100More than one CRT certificate be found in uploaded file.400crt和ca证书文件中包含多份CRT证书(多份crt证书相同,则不报错,并只保留一份)
36540099The number of BEGIN is not match the END statement in .ca file.400ca文件内容有误,BEGIN/END数量不匹配
36540102The uploaded Ca files is invalid!400ca证书解析失败
36540104The CA certificate chain in uploaded files is invalid.400crt和ca证书文件中的CA证书链有误(不完整或冗余)
36540106Certificate's CA file is not match with CRT file.400CA证书与CRT证书不匹配
36540103No CA certificate be found in .crt and .crt file.400crt与ca文件中均未找到CA证书
36540149dnsDomainBelongToCustomerId is empty.400网宿合用证书场景:授权域名归属客户id为空
36540150dnsDomainBelongToCustomerId="  " not exist400网宿合用证书场景:1.值非数值;2.授权域名归属客户id不存在
36540151dnsDomainRelateServiceCode is empty.400网宿合用证书场景:授权域名关联服务编码为空
36540152dnsDomainRelateServiceCode="  " not exist400网宿合用证书场景:授权域名关联服务编码不存在
36540129No csr was found according to csr id.400当未入参的证书key时, 如果有入参csrId, 则取 csrId 对应的 csr 私钥作为证书的私钥 取不到则报错
36540026Certificate is in deploying.400证书部署中,不允许修改
36540027Certificate is in deleting deployment.400证书删除中,不允许修改
36542024domainName1,domainName2400修改证书({}),校验不通过,以下加速域名({})不在证书授权域名范围内.
36540154The SSL name you provided is already in our system. certificateId: {0}, certificateName: {1}400证书名称唯一性校验(客户粒度下唯一)

示例

JSON示例
XML示例
JSON示例
请求示例
复制代码 复制成功
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://open.chinanetcenter.com/api/certificate/{certificateId}" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '
{
    "name":"mycertificate",
    "certificate":"-----BEGIN CERTIFICATE-----……-----END CERTIFICATE-----",
    "privateKey":"-----BEGIN RSA PRIVATE KEY-----……-----BEGIN RSA PRIVATE KEY-----"
}'
返回示例
复制代码 复制成功
HTTP/1.1 200 OK
Date: Sun, 05 May 2019 09:08:53 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id: 83bbebc7-2c95-47d7
{"code":"0",
"message":"success",
"data":""
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!