tencent cloud

APIs

ImportKeyMaterial

Download
Modo Foco
Tamanho da Fonte
Última atualização: 2026-07-14 11:25:12

1. API Description

Domain name for API request: kms.intl.tencentcloudapi.com.

This API is used to import key material into an EXTERNAL CMK. The key obtained through the GetParametersForImport API is used to encrypt the key material. You can only reimport the same key material into the specified CMK and set a new expiration time. After the CMK key material is imported, it cannot be replaced. After the key material is expired or deleted, the CMK will remain unavailable until the same key material is reimported. CMKs are independent, which means that the same key material can be imported into different CMKs, but data encrypted by one CMK cannot be decrypted by another one.
Key material can only be imported into CMKs in Enabled and PendingImport status.

A maximum of 100 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ImportKeyMaterial.
Version Yes String Common Params. The value used for this API: 2019-01-18.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
EncryptedKeyMaterial Yes String

base64-encoded encrypted key material using the PublicKey returned by GetParametersForImport. For KMS in national cryptography version regions, the length requirement for imported key material is 128 bit. For KMS in FIPS 140-2 version regions, the length requirement for imported key material is 256 bit.

ImportToken Yes String

Import token obtained by calling GetParametersForImport.

KeyId Yes String

The CMK designated for importing key material must be identical to the CMK specified in GetParametersForImport.

ValidTo No Integer

Expiration time of the key material in unix timestamp. If unspecified or 0, the key material does not expire. If specified, the expiration time must be greater than the current time and supports up to 2147443200.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Importing key material

Input Example

POST / HTTP/1.1
Host: kms.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ImportKeyMaterial
<Common request parameters>

{
    "ValidTo": "0",
    "KeyId": "23e80852-1e38-11e9-b129-5cb9019b4b01",
    "ImportToken": "Sy+GF4f+XxUan1sfSBfqWQmyJeVO30wcqLEMoW4REpxBApJqYG9zc37OM0Z3qT/mvLofzM3hwVJSTzIITcAo6ew3LidOJ3nwNoVNOM2wnrL+g9puwP0GpbbSwTd16X9E",
    "EncryptedKeyMaterial": "dgqtAzLde+xsR5q3kwOsWu4bst7FaE4sbhhf1OHCMujhjTJTnFGEubKowVFnFC96e2vUvO5fwGvfNcPIDkg6q7iuFviM0BepCmF9Fyk3tluJVRf/Nv8FCccANXmsZDPxtSHdcD00/dQg1i2BIaLMP3/VFBDVEK7AzRhlTkrNiout4pavGSCAF+uBl2Vmnq6fF4DT37B0Q0WQ4NyfUwDCSR0VSF9vwqommhudJUhv4+21xHMgUCdbFvVoOmZP/Md5Sb4rbMbWi5qRpLusi8W3KKTyJ8onp7UC+0qi6DTw4XCq4UPniFNJXIxUOSVXpZHQKFCJXr6/cxNAci8eMTTwfA=="
}

Output Example

{
    "Response": {
        "RequestId": "1b580852-1e38-11e9-b129-5cb9019b4b00"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameter.DecryptMaterialError Decryption of EncryptedKeyMaterial failed.
InvalidParameterValue.InvalidKeyId Invalid KeyId.
InvalidParameterValue.MaterialNotMatch The key material is different from the one previously imported.
ResourceUnavailable.CmkNotFound The CMK does not exist.
ResourceUnavailable.CmkStateNotSupport This operation cannot be performed under the current CMK status.
ResourceUnavailable.TokenExpired Token has expired.
UnsupportedOperation.NotExternalCmk Incorrect CMK type. Only External CMKs are supported.
UnsupportedOperation.ServiceTemporaryUnavailable The service is temporarily unavailable.

Ajuda e Suporte

Esta página foi útil?

comentários