Updated on 2022-12-06 GMT+08:00

Importing CMK Material

Function

This API allows you to import CMK material.

URI

  • URI format

    POST /v1.0/{project_id}/kms/import-key-material

  • 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

import_token

Yes

String

CMK import token in Base64 format that matches the regular expression ^[0-9a-zA-Z+/=]{200,6144}$

encrypted_key_material

Yes

String

Encrypted CMK material in Base64 format that matches the regular expression ^[0-9a-zA-Z+/=]{344,360}$

expiration_time

No

String

Expiration time of the key material. The value is a timestamp expressed in the number of seconds since 00:00:00 UTC on January 1, 1970. KMS will delete the key material within 24 hours after the expiration.

Example: 1550291833

sequence

No

String

36-byte serial number of a request message

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

Responses

None

Examples

The following example describes how to import the CMK material and the import-token to the CMK whose ID is bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e, and set the expiration time of the CMK material to 1521578672.

  • Example request
    {      
        "key_id": "bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e",
        "import_token":"AACIBjY2ZTQxYjBmLTY3ZWItNDU4Ny04OTIxLWVhZTVhZjg5NDZmYQAAuihvPN7Hly3uhp7cWw4cfuwDIem9mGwaIl7/HTx10+8ENsRR4FB7DCR+zG1s7UIZMAZRLx7LD1lkXY+rfN5ibDOOHZkoIiVSh+9u7xtC5m/mNpIFeyqumxHei2I8CNdsNuJtjLV5bDU3tQrIkj72HCWpC0k9yf1ZSvi3yCwD4wyULXBsYwUa76bTK85MIZNGGtqfOyV6w74MT6m70gLhog8r7oWe6Gbof58uyYfFMbc+s0OpkzMjvlvl1HApyOTijled26VgbgoGbPm9QvgjxC7mQEJpzQeg1/uN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GbpCft0WpRsxN2Ng++ntgOcwOf2zOC9o/tjraxeAvgGw+Dwt4cjF4znnFf0LPQ2YvpNUo248LjAGxdFvzUABNzfYSj3RZ0K3wQCNAcXU3HYw==",
        "expiration_time":1521578672
    }
  • Example response
    {
    }

    or

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

Status Codes

Table 3 lists the normal status code returned by the response.
Table 3 Status codes

Status Code

Status

Description

200

OK

Request processed successfully.

Exception status code. For details, see Status Codes.