Domain name for API request: kms.tencentcloudapi.com.
Create a master key CMK (Custom Master Key) for user management data keys
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.
This document describes the parameters for Signature V1. It's recommended to use the V3 signature, which provides higher security. Note that for Signature V3, the common parameters need to be placed in the HTTP Header. See details.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common parameter. The value used for this API: CreateKey. |
Version | Yes | String | Common parameter. The value used for this API: 2019-01-18. |
Region | Yes | String | Common parameter. For more information, please see the list of regions supported by the product. |
Alias | Yes | String | Unique alias that makes a key more recognizable and understandable. This parameter cannot be empty, can contain 1-60 letters, digits, - , and _ , and must begin with a letter or digit. The kms- prefix is used for Tencent Cloud products. |
Description | No | String | CMK description of up to 1,024 bytes in length |
KeyUsage | No | String | Defines the purpose of the key. The valid values are as follows: ENCRYPT_DECRYPT (default): creates a symmetric encryption/decryption key; ASYMMETRIC_DECRYPT_RSA_2048 : creates an asymmetric encryption/decryption 2048-bit RSA key; ASYMMETRIC_DECRYPT_SM2 : creates an asymmetric encryption/decryption SM2 key; ASYMMETRIC_SIGN_VERIFY_SM2 : creates an asymmetric SM2 key for signature verification; ASYMMETRIC_SIGN_VERIFY_ECC : creates an asymmetric 2048-bit RSA key for signature verification; ASYMMETRIC_SIGN_VERIFY_ECDSA384 : creates an asymmetric ECDSA384 key for signature verification. You can get a full list of supported key purposes and algorithms using the ListAlgorithms API. |
Type | No | Integer | Specifies the key type. Default value: 1. Valid value: 1 - default type, indicating that the CMK is created by KMS; 2 - EXTERNAL type, indicating that you need to import key material. For more information, please see the GetParametersForImport and ImportKeyMaterial API documents. |
Tags.N | No | Array of Tag | Tag list |
Parameter Name | Type | Description |
---|---|---|
KeyId | String | Globally unique CMK ID |
Alias | String | Alias that makes a key more recognizable and understandable |
CreateTime | Integer | Key creation time in UNIX timestamp format |
Description | String | CMK description |
KeyState | String | CMK status |
KeyUsage | String | CMK usage |
TagCode | Integer | Tag operation return code. 0: success; 1: internal error; 2: business processing error |
TagMsg | String | Tag operation return information |
RequestId | String | The unique request ID, which is returned for each request. RequestId is required for locating a problem. |
This example shows you how to create a CMK for data encryption key management. The CMK can be used in other APIs to create data encryption keys, perform encryption and decryption, and do more.
https://kms.tencentcloudapi.com/?Action=CreateKey
&Alias=mykey
&KeyUsage=ENCRYPT_DECRYPT
&Description=test
&<Common request parameters>
{
"Response": {
"KeyId": "9999aed0-4956-11e9-bc70-5254005e86b4",
"Alias": "alias-0001",
"CreateTime": 1552897190,
"Description": "test cmk",
"TagMsg": "Success",
"TagCode": 0,
"KeyState": "Enabled",
"KeyUsage": "ENCRYPT_DECRYPT",
"RequestId": "850bf779-2249-4995-8c55-b3966daf0a8c"
}
}
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. |
InvalidParameterValue.AliasAlreadyExists | The alias already exists. |
InvalidParameterValue.InvalidAlias | Incorrect alias format |
InvalidParameterValue.InvalidKeyUsage | Incorrect KeyUsage parameter. |
InvalidParameterValue.InvalidType | Incorrect Type parameter. |
InvalidParameterValue.TagKeysDuplicated | Duplicate tag key. |
InvalidParameterValue.TagsNotExisted | The tag key or tag value does not exist. |
LimitExceeded.CmkLimitExceeded | The number of CMKs has reached the upper limit. |
UnauthorizedOperation | Unauthorized operation. |
UnsupportedOperation.ServiceTemporaryUnavailable | The service is temporarily unavailable. |
UnsupportedOperation.UnsupportedKeyUsageInCurrentRegion | The encryption method is not supported in the current region. |
Was this page helpful?