<p class="shortdesc"></p>
<section class="section" id="getparameters__section_o3b_ydj_mlb"><h2 class="doc-tairway">GetParametersForImport </h2>
<p class="p"><strong class="ph b">Description</strong></p>
<p class="p">Getting the parameters for importing key material. The data returned is used as parameters for the ImportKeyMaterial API. </p>
<div class="note note note_note"><span class="note__title">Note:</span>
<ol class="ol" id="getparameters__ol_kdl_wcj_mlb">
<li class="li">The origin of the key material must be EXTERNAL; </li>
<li class="li">Each API call returns a different public key and import token; </li>
<li class="li">The API returns a public key, an import token, and the expiration time of the import token. The public key and the import token are hexadecimal strings. The import token is valid for 24 hours; </li>
<li class="li">You need to specify the type of the public key used to encrypt the key material (supporting type: RSA_2048). You also need to specify the encryption algorithm (supporting encryption algorithms: RSAES_PKCS1_V1_5, RSAES_OAEP_SHA_1, and RSAES_OAEP_SHA_256); </li>
<li class="li">You must use the public key and import token returned from the same API call in combination. You can only use them for the CMK specified in that call; </li>
<li class="li">The algorithm you specify when getting the parameters for importing the key material must be the same as the one you use to encrypt the key material. </li>
</ol>
</div>
<p class="p"><strong class="ph b">Request Parameters</strong></p>
<table class="table" id="getparameters__table_ldl_wcj_mlb"><caption></caption><colgroup><col><col><col><col></colgroup><thead class="thead">
<tr class="row">
<th class="entry" id="getparameters__table_ldl_wcj_mlb__entry__1">
<p class="p">Name </p>
</th>
<th class="entry" id="getparameters__table_ldl_wcj_mlb__entry__2">
<p class="p">Type </p>
</th>
<th class="entry" id="getparameters__table_ldl_wcj_mlb__entry__3">
<p class="p">Necessary or Not </p>
</th>
<th class="entry" id="getparameters__table_ldl_wcj_mlb__entry__4">
<p class="p">Description </p>
</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__1 ">
<p class="p">keyId </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__3 ">
<p class="p">Yes </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__4 ">
<p class="p">Globally unique identifier of the CMK. The origin of the key material must be EXTERNAL. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__1 ">
<p class="p">wrappingAlgorithm </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__3 ">
<p class="p">Yes </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__4 ">
<p class="p">Algorithm used to encrypt the key material. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__1 ">
<p class="p">wrappingKeySpec </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__3 ">
<p class="p">Yes </p>
</td>
<td class="entry" headers="getparameters__table_ldl_wcj_mlb__entry__4 ">
<p class="p">Type (RSA) of the public key used to encrypt the key material. </p>
</td>
</tr>
</tbody></table>
<p class="p"><strong class="ph b">Return Parameters</strong></p>
<table class="table" id="getparameters__table_mdl_wcj_mlb"><caption></caption><colgroup><col><col><col></colgroup><thead class="thead">
<tr class="row">
<th class="entry" id="getparameters__table_mdl_wcj_mlb__entry__1">
<p class="p">Name </p>
</th>
<th class="entry" id="getparameters__table_mdl_wcj_mlb__entry__2">
<p class="p">Type </p>
</th>
<th class="entry" id="getparameters__table_mdl_wcj_mlb__entry__3">
<p class="p">Description </p>
</th>
</tr>
</thead><tbody class="tbody">
<tr class="row">
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__1 ">
<p class="p">code </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__3 ">
<p class="p">Return code. “SUCCESS” will be returned if the request is succeeded. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__1 ">
<p class="p">keyId </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__3 ">
<p class="p">Globally unique identifier of the CMK. You need to specify this parameter when calling ImportKeyMaterial. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__1 ">
<p class="p">importToken </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__3 ">
<p class="p">Import token needed when calling ImportKeyMaterial. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__1 ">
<p class="p">publicKey </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__3 ">
<p class="p">Before importing the key material, you need to encrypt it with the public key. </p>
</td>
</tr>
<tr class="row">
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__1 ">
<p class="p">tokenExpireTime </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__2 ">
<p class="p">String </p>
</td>
<td class="entry" headers="getparameters__table_mdl_wcj_mlb__entry__3 ">
<p class="p">Expiration time of the imported token. </p>
</td>
</tr>
</tbody></table>
<p class="p"><strong class="ph b">Request Example</strong></p>
<pre class="pre codeblock"><code>https://kms-cn-shanghai.yun.pingan.com/?action=GetParametersForImport
&wrappingKeySpec=RSA
&keyId=<cmkid>
&wrappingAlgorithm=<wrapping algorithm>
&<公共请求参数> </code></pre>
<p class="p"><strong class="ph b">Return Example</strong></p>
<pre class="pre codeblock"><code>{
"code": "SUCCESS",
"importToken": "import token",
"keyId": "your key id",
"publicKey": "public key",
"tokenExpireTime": "2018-12-05 15:58:27",
"requestId": "2ef5c013-0662-453c-9f63-ed43c1c20f63"
} </code></pre>
</section>