Updated on 2023-06-29 GMT+08:00

Importing a CA Certificate

Function

This API is used to import a CA certificate. To use this API, the following conditions must be met:

  • The certificate of the subordinate CA is in the Pending activation status.

  • The certificate body you want to import must meet the following requirements:

    • When the certificate is issued, its certificate signature request must be exported from the PCA system.

    • Although the certificate chain is optional, importing the complete certificate chain is recommended so that you can export a complete certificate chain later.

    • The certificate body and certificate chain must be in PEM format.

URI

POST /v1/private-certificate-authorities/{ca_id}/import

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

ca_id

Yes

String

ID of the CA certificate you want to import.

Minimum: 36

Maximum: 36

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the token API of IAM. The value of X-Auth-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

certificate

Yes

String

Certificate content

Minimum: 1

Maximum: 32768

certificate_chain

No

String

Certificate chain content

Minimum: 0

Maximum: 2097152

Response Parameters

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code

Minimum: 3

Maximum: 36

error_msg

String

Error message

Minimum: 0

Maximum: 1024

Example Requests

When you use this API to import a CA certificate, a token is required in the X-Auth-Token field in the request header. The token must have the permission to access the API.

POST https://ccm.ae-ad-1.myhuaweicloud.com/v1/private-certificate-authorities/4c0e772e-a30c-4029-b929-b7acb04143f7/import

{
  "certificate" : "-----BEGIN CERTIFICATE---******----END CERTIFICATE-----",
  "certificate_chain" : "-----BEGIN CERTIFICATE-----**********-----END CERTIFICATE-----"
}

Example Responses

Status code: 400

Invalid request parameters.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 401

Token required for the requested page.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 403

Authentication failed.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 404

No resources available or found.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status code: 500

Internal service error.

{
  "error_code" : "PCA.XXX",
  "error_msg" : "XXX"
}

Status Codes

Status Code

Description

204

Request succeeded, but no response body returned.

400

Invalid request parameters.

401

Token required for the requested page.

403

Authentication failed.

404

No resources available or found.

500

Internal service error.

Error Codes

See Error Codes.