Obtaining CMK Import Parameters

Function

This API enables you to obtain necessary parameters to import a CMK, including a CMK import token and a CMK encryption public key.

Note

The returned public key type is RSA_2048 by default.

URI

  • URI format

    POST /v1.0/{project_id}/kms/get-parameters-for-import

  • Parameter description

    Table 1 Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

Requests

Table 2 Request parameters

Parameter

Mandatory

Type

Description

key_id

Yes

String

36-byte ID of a CMK that matches the regular expression ^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$

Example: 0d0466b0-e727-4d9c-b35d-f84bb474a37f

wrapping_algorithm

Yes

String

Cryptographic algorithm for CMK material. The following values are enumerated:

  • RSAES_PKCS1_V1_5

  • RSAES_OAEP_SHA_1

  • RSAES_OAEP_SHA_256

sequence

No

String

36-byte serial number of a request message

Example: 919c82d4-8046-4722-9094-35c3c6524cff

Responses

Table 3 Response parameters

Parameter

Mandatory

Type

Description

key_id

Yes

String

ID of a CMK in Base64 format

import_token

Yes

String

CMK import token

expiration_time

Yes

String

Expiration time of the import parameter. The value is a timestamp expressed in the number of seconds since 00:00:00 UTC on January 1, 1970.

public_key

Yes

String

Public key (in Base64 format) used to encrypt CMK material

Examples

The following example describes how to obtain the imported parameter of a CMK (ID: bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e; algorithm: RSAES_OAEP_SHA_1).

  • Example request

    {
        "key_id": "bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e",
         "wrapping_algorithm":"RSAES_OAEP_SHA_1"
    }
    
  • Example response

    {
        "key_id": "bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e",
        "import_token":"AACIBjY2ZTQxYjBmLTY3ZWItNDU4Ny04OTIxLWVhZTVhZjg5NDZmYQAAuihvPN7Hly3uhp7cWw4cfuwDIem9mGwaIl7/HTx10+8ENsRR4FB7DCR+zG1s7UIZMAZRLx7LD1lkXY+rfN5ibDOOHZkoIiVSh+9u7xtC5m/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nJQqE9GorZ16XMlOQngJfU0SgkMKJpL9W+byIebeKgmDt2I6oVSPckk9y3JiaGjXKYlepawob9b61IRR97Bcr4Sf2p3J6J3gpiYGp1Ai3495rYF+FSZAxW+VDOzbN3vig6SVxcP1PXtaKzQbtNfnlIh+rvSMJpVI3MFHh5lWjEn8L/XpprLy1FqHSSvgB99qwiPw1ZGTL5XGSrIpCV3/ah8u+5VGoIUJZTtiZk6OQDkFH9fxwIahYvLI8/yjrWFLtJuApr7aIrhRN0iDBINxddNh8M0A9sIFoS3D5RNKITjIKIMl/GVz+mHaPjK+91M/b7JrNvinFCMQDGrb/1qoGQIDAQAB"
    }
    

    or

    {
        "error": {
            "error_code": "KMS.XXXX",
            "error_msg": "XXX"
        }
    }
    

Status Codes

Table 4 lists the normal status code returned by the response.

Table 4 Status codes

Status Code

Status

Description

200

OK

Request processed successfully.

Exception status code. For details, see Status Codes.