CreateWhiteBoxKey

Last updated: 2021-10-25 17:09:14

    1. API Description

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

    This API is used to create a white-box key. Up to 50 ones can be created.

    A maximum of 50 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 parameter. The value used for this API: CreateWhiteBoxKey.
    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 should be 1 to 60 letters, digits, -, and _; it must begin with a letter or digit and cannot be left empty.
    Algorithm Yes String All algorithm types for creating keys. Valid values: AES_256, SM4
    Description No String Key description of up to 1024 bytes
    Tags.N No Array of Tag Tag list

    3. Output Parameters

    Parameter Name Type Description
    EncryptKey String Base64-encoded encryption key
    DecryptKey String Base64-encoded decryption key
    KeyId String Globally unique white-box key ID
    TagCode Integer Tag operation return code. 0: success; 1: internal error; 2: business processing error
    TagMsg String Tag operation return message
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Creating white-box key

    Input Example

    https://kms.tencentcloudapi.com/?Action=CreateWhiteBoxKey
    &Alias=test_alias&Description=test_description&Algorithm=SM4
    &<Common request parameters>
    

    Output Example

    {
    "Response": {
      "RequestId": "3691b76c-1ba5-4f93-88ad-858d23ba6c8a",
      "EncryptKey": "AAAAAHP6lsgUa4mYE/cT5LGkquR3xKzUG+cB6oWJ7exbmfR37G6QCB2dEjpdq6+JvmC7cbiDXUFaExxSHQTjlJAzTh/T4p6BZy31uiPXogOnsDEm/vGnh3AJQBopXreiUYe54ZlpJPd/yZocQhsFhiNw2Bmqy6bkp4LrzT2FvzHh5YhwNLRuJnou3G5OecuvaNQoz2L9hkCSc4s7iUaiCMzzDgCnfCYhqgKP+HtaqOMv0LKRzTjSYKxdmzWjPT1vMUxv2Mtk+fF/5gEI6z++eybnWsyJHTx03YnF52sVw5RNs3axXRmOQWUOIoswKmb8M/urWdUio6ZZeE2fMPBg2H2GJvf5wbtCsHLFwdUZBQJ/VcgLXHj0VQxUdUFffL/yZfvIOXAzACvkiZmUEIRP422s5EXIJFfLzA5S+aJgl1Kwp7XI",
      "DecryptKey": "AAAAAHP6lsgUa4mYE/cT5LGkquR3xKzUG+cB6oWJ7exbmfR37G6QCB2dEjpdq6+JvmC7cbiDXUFaExxSHQTjlJAzTh/T4p6BZy31uiPXogOnsDEm/vGnh3AJQBopXreiUYe54ZlpJPd/yZocQhsFhiNw2Bmqy6bkp4LrzT2FvzHh5YhwNLRuJnou3G5OecuvaNQoz2L9hkCSc4s7iUaiCMzzDgCnfCYhqgKP+HtaqOMv0LKRzTjSYKxdmzWjPT1vMUxv2Mtk+fF/5gEI6z++eybnWsyJHTx03YnF52sVw5RNs3axXRmOQWUOIoswKmb8M/urWdUio6ZZeE2fMPBg2H2GJvf5wbtCsHLFwdUZBQJ/VcgLXHj0VQxUdUFffL/yZfvIOXAzACvkiZmUEIRP422s5EXIJFfLzA5S+aJgl1Kwp7XI",
      "KeyId": "3235f222-6e40-11ea-8f2f-5254006d0810"
    }
    }
    

    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.
    InvalidParameterValue Incorrect parameter value.
    InvalidParameterValue.AliasAlreadyExists The alias already exists.
    InvalidParameterValue.InvalidAlias Incorrect alias format
    InvalidParameterValue.TagKeysDuplicated Duplicate tag key.
    InvalidParameterValue.TagsNotExisted The tag key or tag value does not exist.
    LimitExceeded.KeyLimitExceeded The number of created keys exceeded the limit.
    ResourceUnavailable.NotPurchased The white-box key service has not been activated.
    UnauthorizedOperation Unauthorized operation.