Help Center/ Server Migration Service/ API Reference/ API/ Key Management/ Obtaining an SSL Certificate and Private Key
Updated on 2025-09-16 GMT+08:00

Obtaining an SSL Certificate and Private Key

Function

For source servers running Windows, the Agent installed on them communicates with target servers through SSL sockets. This API is used to download the certificates and private keys in PEM format required by target servers.

Calling Method

For details, see Calling APIs.

URI

GET /v3/tasks/{task_id}/certkey

Table 1 Path parameter

Parameter

Mandatory

Type

Description

task_id

Yes

String

The migration task ID.

Minimum length: 0 characters

Maximum length: 255 characters

Table 2 Query parameter

Parameter

Mandatory

Type

Description

enable_ca_cert

No

Boolean

Indicates whether to generate a CA certificate.

Default value: false

Request

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

X-Auth-Token

The user token.

The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Minimum length: 1 character

Maximum length: 16,384 characters

Response

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

cert

String

The source certificate.

Minimum length: 1 character

Maximum length: 1,048,576 characters

private_key

String

The source private key.

Minimum length: 1 character

Maximum length: 1,048,576 characters

ca

String

The CA certificate.

Minimum length: 1 character

Maximum length: 1,048,576 characters

target_mgmt_cert

String

The certificate of the target server for migration task management.

Minimum length: 1 character

Maximum length: 1,048,576 characters

target_mgmt_private_key

String

The private key of the target server for migration task management.

Minimum length: 1 character

Maximum length: 1,048,576 characters

target_data_cert

String

The certificate of the target server for data migration.

Minimum length: 1 character

Maximum length: 1,048,576 characters

target_data_private_key

String

The private key of the target server for data migration.

Minimum length: 1 character

Maximum length: 1,048,576 characters

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

Minimum length: 0 characters

Maximum length: 255 characters

error_msg

String

The error message.

Minimum length: 0 characters

Maximum length: 1,024 characters

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

Minimum length: 0 characters

Maximum length: 255 characters

error_msg

String

The error message.

Minimum length: 0 characters

Maximum length: 1,024 characters

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

Minimum length: 0 characters

Maximum length: 255 characters

error_msg

String

The error message.

Minimum length: 0 characters

Maximum length: 1,024 characters

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

Minimum length: 0 characters

Maximum length: 255 characters

error_msg

String

The error message.

Minimum length: 0 characters

Maximum length: 1,024 characters

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

The error code.

Minimum length: 0 characters

Maximum length: 255 characters

error_msg

String

The error message.

Minimum length: 0 characters

Maximum length: 1,024 characters

Example Request

This example obtains the certificate and private key for a task.

GET https://{endpoint}/v3/tasks/{task_id}/certkey?enable_ca_cert=true

Example Response

Status code: 200

OK

{
  "ca_cert" : "-----BEGIN CERTIFICATE-----\n********************************\n-----END CERTIFICATE-----",
  "cert" : "-----BEGIN CERTIFICATE-----\n********************************\n-----END CERTIFICATE-----",
  "private_key" : "-----BEGIN RSA PRIVATE KEY-----\n********************************\n-----END RSA PRIVATE KEY-----",
  "target_mgmt_cert" : "-----BEGIN CERTIFICATE-----\n********************************\n-----END CERTIFICATE-----",
  "target_mgmt_private_key" : "-----BEGIN RSA PRIVATE KEY-----\n********************************\n-----END RSA PRIVATE KEY-----",
  "target_data_cert" : "-----BEGIN CERTIFICATE-----\n********************************\n-----END CERTIFICATE-----",
  "target_data_private_key" : "-----BEGIN RSA PRIVATE KEY-----\n********************************\n-----END RSA PRIVATE KEY-----"
}

Status Codes

Status Code

Description

200

OK

400

Bad request.

401

Unauthorized.

403

Forbidden

404

Not found.

500

Internal server error.

Error Codes

For details, see Error Codes.