Domain name for API request: kms.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.
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 | No | String | Common Params. This parameter is not required for this API. |
EncryptedKeyMaterial | Yes | String | Base64-encoded key material that encrypted with the PublicKey returned by GetParametersForImport . For the KMS of SM-CRYPTO version, the length of the key material should be 128 bits, while for KMS of FIPS-compliant version, the length should be 256 bits. |
ImportToken | Yes | String | Import token obtained by calling GetParametersForImport . |
KeyId | Yes | String | Specifies the CMK into which to import key material, which must be the same as the one specified by GetParametersForImport . |
ValidTo | No | Integer | Unix timestamp of the key material's expiration time. If this value is empty or 0, the key material will never expire. To specify the expiration time, it should be later than the current time. Maximum value: 2147443200. |
Parameter Name | Type | Description |
---|---|---|
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: kms.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=="
}
{
"Response": {
"RequestId": "1b580852-1e38-11e9-b129-5cb9019b4b00"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
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. |
Was this page helpful?