tencent cloud



Last updated: 2023-08-07 17:45:15

1. API Description

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

This API is used to obtain the parameters of the material to be imported into a CMK. The returned Token is used as one of the parameters to execute ImportKeyMaterial, and the returned PublicKey is used to encrypt the key material. The Token and PublicKey are valid for 24 hours. If they are expired, you will need to call the API again to get a new Token and PublicKey.

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: GetParametersForImport.
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.
KeyId Yes String Unique ID of a CMK. The CMK for which to get the key parameters must be of the EXTERNAL type, i.e., Type = 2 when the CMK is created by the CreateKey API.
WrappingAlgorithm Yes String Specifies the algorithm for key material encryption. Currently, RSAES_PKCS1_V1_5, RSAES_OAEP_SHA_1, and RSAES_OAEP_SHA_256 are supported.
WrappingKeySpec Yes String Specifies the type of wrapping key. Currently, only RSA_2048 is supported.

3. Output Parameters

Parameter Name Type Description
KeyId String Unique ID of a CMK, which is used to specify the CMK into which to import key material.
ImportToken String The token required for importing key material, which is used as a parameter for ImportKeyMaterial.
PublicKey String The Base64-encoded RSA public key used to encrypt key material before importing it with ImportKeyMaterial.
ParametersValidTo Integer Validity period of the token and public key. A token and public key can only be imported when they are valid. If they are expired, you will need to call the GetParametersForImport API again to get a new token and public key.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Getting the parameters of the key material imported to a CMK

Input Example

&<Common request parameters>

Output Example

    "Response": {
        "KeyId": "1ff78c0d-c54b-11e9-9cc9-5254006d0810",
        "ImportToken": "Sy+GF4f+XxUan1sfSBfqWQmyJeVO30wcqLEMoW4REpw3adjEFXyCP2yqzV8xdD5GMY4gIZoDfJ33SnnbxDMRND8lzh4mZjzFNM8PsjhYrgVSxIiJOCHupZvD4QcoGco8",
        "PublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1IjpYRubNKn97lPU0/eR8UBaV11glfQLNqlub+YspXwBsvVqcnSvu5c8GoLTEYGSTVbvsREDCq6VfFoSeoIqbv8aWukxbPGWgI1nu55ocvWwthzROFA5UPGC8LOuH0ftZ5Z7cIaigEenS3ngfo4MYTJtg6/Bl1jJVWvjnKzgswsZeFclSURedSXUcMxfSI344s6I17DTNAQ/vQqyjFGIyo2+JctaxVlY2XuBZf7tPimNdoxAoJ14QxAl1gQGu959xnRJ4rwZbxsklJnEivQqTBeFIiv3KTzFJS6bkz2eqRJ1p4jTBDWbHEWTVt6tdXPj4+4D21RFGAt3706vf4PIrwIDAQAB",
        "ParametersValidTo": 1566614716,
        "RequestId": "5e137679-519f-409f-9a99-579a034cc320"

5. Developer Resources


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.
InvalidParameterValue.InvalidKeyId Invalid KeyId.
ResourceUnavailable.CmkNotFound The CMK does not exist.
UnsupportedOperation.NotExternalCmk Incorrect CMK type. Only External CMKs are supported.
UnsupportedOperation.ServiceTemporaryUnavailable The service is temporarily unavailable.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support