Help Center> Server Migration Service> API Reference> APIs V3.0> Key Management> Obtaining an SSL Certificate and Private Key
Updated on 2024-06-27 GMT+08:00

Obtaining an SSL Certificate and Private Key

Function

If the block-level migration method is used, the Agent installed on the source server communicates with the target server through an SSL socket connection. This API is used to download the certificate and private key (in PEM format) required for data migration.

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 parameters

Parameter

Mandatory

Type

Description

enable_ca_cert

No

Boolean

Indicates whether to generate a CA certificate.

Default value: false

Request parameters

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

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 required for a migration task.

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

Example Response

Status code: 200

OK

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

Status Codes

Status Code

Description

200

Response returned.

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Internal Server Error

Error Codes

For details, see Error Codes.