GetParametersForImport

Last updated: 2020-03-20 19:00:14

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 10 requests can be initiated per second for this API.

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: GetParametersForImport.
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.
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 Get the parameters for importing the master key (CMK) material

Input Example

https://kms.tencentcloudapi.com/?Action=GetParametersForImport
&KeyId=1ff78c0d-c54b-11e9-9cc9-5254006d0810
&WrappingAlgorithm=RSAES_OAEP_SHA_1
&WrappingKeySpec=RSA_2048
&<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

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

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.
ResourceUnavailable.CmkNotFound CMK does not exist.
UnsupportedOperation.NotExternalCmk Incorrect CMK type. Only External CMKs are supported.