Attach CCS Certificate to Account

POST/zstack/v1/crypto/ccs-certificate/attach-account/{accountUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "certificateUuid": "37efdf76b03a3028926549ea5f1253f3",
    "state": "enable"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding example, the systemTags and userTags fields are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"certificateUuid":"37efdf76b03a3028926549ea5f1253f3","state":"enable"}}' \
http://localhost:8080/zstack/v1/crypto/ccs-certificate/attach-account/e0deabb1107f32e7b715d6b5e7f39334

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

certificateUuid (Optional)

String

body (enclosed in the params structure)

UUID of the CCS certificate

 

4.10.0

accountUuid

String

url

Account UUID

 

4.10.0

state (Optional)

String

body (enclosed in the params structure)vv

Enable or disable. Specifies whether to enable UKey authentication for login when attaching the CCS certificate to the user. If set to enable, the user must pass UKey authentication for subsequent logins. If set to disable, UKey authentication is not enabled temporarily, but can be enabled later through UpdateCCSCertificateUserState.

  • enable
  • disable

4.10.0

system Tags (Optional)

List

body

System tags

 

4.10.0

userTags (Optional)

List

body

User tags

 

4.10.0

API Response

Response Example

{
  "inventory": {
    "uuid": "271c21f7ef8c4385b09846341cc9deac",
    "algorithm": "SM2",
    "format": "CER",
    "issuerDN": "C=cn,O=infosec,OU=system,CN=ca62_sm2",
    "subjectDN": "C=CN,O=ZStack,OU=ZStack,CN=ZStackTest2",
    "serNumber": "13055887750776402041",
    "effectiveTime": "Oct 15, 2021 10:50:09 AM",
    "expirationTime": "Oct 15, 2024 10:50:09 AM"
  }
}
NameTypeDescriptionStarting Version
successbooleanWhether the attach operation is successful4.10.0
inventoryCCSCertificateInventoryFor details, see inventory4.10.0
errorErrorCodeError code. If not null, the operation has failed. This field is null when the operation succeeds. For details, see error4.10.0

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID. Uniquely identifies the resource.4.3.12
algorithmStringCertificate type4.3.12
formatStringCertificate format. CER for Chinese national cryptographic standards. Other formats include CRT, DER, JKS, etc.4.3.12
issuerDNStringIssuer DN (issuer-DN-distinguished name), for example, CN=sm2,O=test,C=cn4.3.12
subjectDNStringSubject DN4.3.12
serNumberLongCertificate serial number. Combined with subjectDN as a composite key, it is globally unique.4.3.12
effectiveTimeTimestampEffective date4.3.12
expirationTimeTimestampExpiration date4.3.12
createDateTimestampCreation time4.3.12
lastOpDateTimestampLast modification time4.3.12
userCertificateRefsListFor details, see userCertificateRefs4.3.12

userCertificateRefs

NameTypeDescriptionStarting Version
userUuidStringUser UUID4.3.12
certificateUuidStringCCS certificate UUID4.3.12
createDateTimestampCreation time4.3.12
lastOpDateTimestampLast modification time4.3.12
stateCCSCertificateUserStateFor details, see state4.3.12

state

NameTypeDescriptionStarting Version
EnabledCCSCertificateUserStateVerification required4.3.12
DisabledCCSCertificateUserStateVerification not required4.3.12

error

NameTypeDescriptionStarting Version
codeStringError code number. The globally unique identifier of the error, for example, SYS.1000 or HOST.1001.0.6
descriptionStringBrief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Default is null.0.6
opaqueLinkedHashMapReserved field. Default is null.0.6
causeErrorCodeRoot error. The source error that caused the current error. This field is null if no root error exists.0.6

SDK Examples

Java SDK

AttachCCSCertificateToAccountAction action = new AttachCCSCertificateToAccountAction();
action.certificateUuid = "37efdf76b03a3028926549ea5f1253f3";
action.accountUuid = "e0deabb1107f32e7b715d6b5e7f39334";
action.state = "enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachCCSCertificateToAccountAction.Result res = action.call();

Python SDK

AttachCCSCertificateToAccountAction action = AttachCCSCertificateToAccountAction()
action.certificateUuid = "37efdf76b03a3028926549ea5f1253f3"
action.accountUuid = "e0deabb1107f32e7b715d6b5e7f39334"
action.state = "enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachCCSCertificateToAccountAction.Result res = action.call()