doc-exports/docs/kms/api-ref/kms_02_0012.html
gtema 83150ed5aa replacement of #300
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: gtema <artem.goncharov@gmail.com>
Co-committed-by: gtema <artem.goncharov@gmail.com>
2022-11-21 08:53:44 +00:00

191 lines
17 KiB
HTML

<a name="kms_02_0012"></a><a name="kms_02_0012"></a>
<h1 class="topictitle1">Creating a CMK</h1>
<div id="body8662426"><div class="section" id="kms_02_0012__en-us_topic_0112992294_s1731a14fb0144c79bf0fa90c694f34f7"><h4 class="sectiontitle">Function</h4><p id="kms_02_0012__en-us_topic_0112992294_p13339087141253">This API is used to create customer master keys (CMKs) used to encrypt data encryption keys (DEKs).</p>
<div class="note" id="kms_02_0012__en-us_topic_0112992294_note5633572415214"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="kms_02_0012__en-us_topic_0112992294_p3725947115214">Default Master Keys are created by services integrated with KMS. Names of Default Master Keys end with <span class="parmname" id="kms_02_0012__en-us_topic_0112992294_parmname1248001399164536"><b>/default</b></span>. Therefore, in naming your CMKs, do not choose those ending with <span class="parmname" id="kms_02_0012__en-us_topic_0112992294_parmname723345229164526"><b>/default</b></span>.</p>
</div></div>
</div>
<div class="section" id="kms_02_0012__en-us_topic_0112992294_se70c3e5518a04f60b06032524dddfef4"><h4 class="sectiontitle">URI</h4><ul id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0020091565_ul60390938"><li id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0020091565_li6647531">URI format<p id="kms_02_0012__en-us_topic_0112992294_p138073181080"><a name="kms_02_0012__en-us_topic_0112992294_en-us_topic_0020091565_li6647531"></a><a name="en-us_topic_0112992294_en-us_topic_0020091565_li6647531"></a>POST /v1.0/{project_id}/kms/create-key</p>
</li><li id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0020091565_li14211994">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0012__en-us_topic_0112992294_t982da1e0196d4ec1a28d1fbff2cc8191" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="kms_02_0012__en-us_topic_0112992294_r6e963322c1e740d181726d2f0e91df5a"><th align="left" class="cellrowborder" valign="top" width="22.74%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="kms_02_0012__en-us_topic_0112992294_a3b5bbe5a7f644fd3a74cecbfb3f7ed60"><strong id="kms_02_0012__en-us_topic_0112992294_b842352706165836">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="23.31%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="kms_02_0012__en-us_topic_0112992294_ad98d2f62bd064b4e96ea922645197c24"><strong id="kms_02_0012__en-us_topic_0112992294_b842352706165839">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.86%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="kms_02_0012__en-us_topic_0112992294_a3becf0b3aec9468984c2efc8d5abbea5">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.09%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="kms_02_0012__en-us_topic_0112992294_a6bb6f1fe56a2454982832e8d56d354d8">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0012__en-us_topic_0112992294_r69bf37b65d3f446eab7b3f4d1b2fcec0"><td class="cellrowborder" valign="top" width="22.74%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_ae42d73592f58424ea93a11e52d2478dd">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="23.31%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_a56440c0f0ae34ba3b8033d1247673984">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20.86%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_a1a4a71c11a4a45a58d0de2fbe009e9d9">String</p>
</td>
<td class="cellrowborder" valign="top" width="33.09%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_a1314869d2dc147b38461e037d622f7b4">Project ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="kms_02_0012__en-us_topic_0112992294_seb7b7901701247fab30a59b76f1c7f93"><h4 class="sectiontitle">Requests</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0012__en-us_topic_0112992294_table46221022101230" width="100%" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="kms_02_0012__en-us_topic_0112992294_row9315574101230"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.3.2.2.5.1.1"><p id="kms_02_0012__en-us_topic_0112992294_p16364058101230">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.3.2.2.5.1.2"><p id="kms_02_0012__en-us_topic_0112992294_p57514295101230"><strong id="kms_02_0012__en-us_topic_0112992294_b842352706165630">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.3.2.2.5.1.3"><p id="kms_02_0012__en-us_topic_0112992294_p50420322101230"><strong id="kms_02_0012__en-us_topic_0112992294_b842352706165626">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.3.2.2.5.1.4"><p id="kms_02_0012__en-us_topic_0112992294_p28146304101230">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0012__en-us_topic_0112992294_row65258150101230"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p1543290910164">key_alias</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p5515069010164">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p4210609710164">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_p3802087110164">Alias of a non-default master key (The alias's length ranges from 1 to 255 characters and matches the regular expression <span class="parmvalue" id="kms_02_0012__en-us_topic_0112992294_parmvalue698033652174049"><b>^[a-zA-Z0-9:/_-]{1,255}$</b></span>. In addition, it must be different from the alias of a Default Master Key created by the system.)</p>
</td>
</tr>
<tr id="kms_02_0012__en-us_topic_0112992294_row2245699720624"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p707743220624">key_description</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p6281259420624">No</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p3640115720624">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_p5465533520624">CMK description (The value ranges from 0 to 255 characters.)</p>
</td>
</tr>
<tr id="kms_02_0012__en-us_topic_0112992294_row56396726142438"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p4732068142438">origin</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p42803505142438">No</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p47753194142438">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.2.5.1.4 "><div class="p" id="kms_02_0012__en-us_topic_0112992294_p44531872142438">Origin of a CMK. The default value is <span class="parmvalue" id="kms_02_0012__en-us_topic_0112992294_parmvalue1849726112141249"><b>kms</b></span>. The following values are enumerated:<ul id="kms_02_0012__en-us_topic_0112992294_ul43826915161742"><li id="kms_02_0012__en-us_topic_0112992294_li52989133161745"><span class="parmvalue" id="kms_02_0012__en-us_topic_0112992294_parmvalue1011124252141313"><b>kms</b></span> indicates that the CMK material is generated by KMS.</li><li id="kms_02_0012__en-us_topic_0112992294_li60185190142747"><span class="parmvalue" id="kms_02_0012__en-us_topic_0112992294_parmvalue501259129141335"><b>external</b></span> indicates that the CMK material is imported.</li></ul>
</div>
</td>
</tr>
<tr id="kms_02_0012__en-us_topic_0112992294_row35142504101726"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p269135101746">sequence</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p20967256101746">No</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p21799971101746">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.3.2.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_p89331932112120">36-byte serial number of a request message</p>
<p id="kms_02_0012__en-us_topic_0112992294_p20626198101746">Example: 919c82d4-8046-4722-9094-35c3c6524cff</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="kms_02_0012__en-us_topic_0112992294_sfadd53a5f4714e8f87811818d62d0296"><h4 class="sectiontitle">Responses</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0012__en-us_topic_0112992294_table7517184618545" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Response parameters</caption><thead align="left"><tr id="kms_02_0012__en-us_topic_0112992294_row55181746125413"><th align="left" class="cellrowborder" valign="top" width="18.04%" id="mcps1.3.4.2.2.5.1.1"><p id="kms_02_0012__en-us_topic_0112992294_p1151811468544">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.67%" id="mcps1.3.4.2.2.5.1.2"><p id="kms_02_0012__en-us_topic_0112992294_p145186465549">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.35%" id="mcps1.3.4.2.2.5.1.3"><p id="kms_02_0012__en-us_topic_0112992294_p13518194615547">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="49.94%" id="mcps1.3.4.2.2.5.1.4"><p id="kms_02_0012__en-us_topic_0112992294_p18518194625416">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0012__en-us_topic_0112992294_row951818462548"><td class="cellrowborder" valign="top" width="18.04%" headers="mcps1.3.4.2.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p1651844612541">key_info</p>
</td>
<td class="cellrowborder" valign="top" width="15.67%" headers="mcps1.3.4.2.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p7518184665412">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.35%" headers="mcps1.3.4.2.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p165181046115411">Array of objects</p>
</td>
<td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.3.4.2.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_p85181246135416">Information about keys. For details, see <a href="#kms_02_0012__en-us_topic_0112992294_t98d238e10953421e84a073707024c329">Table 4</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="kms_02_0012__en-us_topic_0112992294_t98d238e10953421e84a073707024c329"></a><a name="en-us_topic_0112992294_t98d238e10953421e84a073707024c329"></a><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0012__en-us_topic_0112992294_t98d238e10953421e84a073707024c329" frame="border" border="1" rules="all"><caption><b>Table 4 </b><strong id="kms_02_0012__en-us_topic_0112992294_b161554576586">key_info</strong> field description</caption><thead align="left"><tr id="kms_02_0012__en-us_topic_0112992294_r144a2c52c5054c6d9243eb2ef3875a21"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.4.3.2.5.1.1"><p id="kms_02_0012__en-us_topic_0112992294_a9156e0b03f054d4e8547e0787f88a51b">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.4.3.2.5.1.2"><p id="kms_02_0012__en-us_topic_0112992294_a1851157c81e14d7f82db752a5737195a"><strong id="kms_02_0012__en-us_topic_0112992294_b842352706165935">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.4.3.2.5.1.3"><p id="kms_02_0012__en-us_topic_0112992294_a39360acf5daf4c01a1ebddeff5d68a1c"><strong id="kms_02_0012__en-us_topic_0112992294_b842352706165929">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.3.2.5.1.4"><p id="kms_02_0012__en-us_topic_0112992294_a0097000016b14857972b7929bcaaa038">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0012__en-us_topic_0112992294_r3c4af7b36e9240d197ab56255e37b83c"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.4.3.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p43705601102713">key_id</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.4.3.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p63384753102713">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.4.3.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p50492797102713">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_p33891398102713">CMK ID</p>
</td>
</tr>
<tr id="kms_02_0012__en-us_topic_0112992294_rf212a916c502452a8e151eba2f118272"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.4.3.2.5.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_p15241273102723">domain_id</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.4.3.2.5.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p5791264102723">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.4.3.2.5.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p26583640102723">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.3.2.5.1.4 "><p id="kms_02_0012__en-us_topic_0112992294_p66439224102723">User domain ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="kms_02_0012__en-us_topic_0112992294_section1079019295212"><h4 class="sectiontitle">Examples</h4><p id="kms_02_0012__en-us_topic_0112992294_p8589172417523">The following example describes how to create a CMK with an alias of <span class="parmvalue" id="kms_02_0012__en-us_topic_0112992294_parmvalue19739413241729"><b>test</b></span>.</p>
<ul id="kms_02_0012__en-us_topic_0112992294_ul682415255214"><li id="kms_02_0012__en-us_topic_0112992294_li118242285213">Example request<pre class="screen" id="kms_02_0012__en-us_topic_0112992294_screen158241025527">{
"key_alias": "test"
}</pre>
</li><li id="kms_02_0012__en-us_topic_0112992294_li1582402185212">Example response<pre class="screen" id="kms_02_0012__en-us_topic_0112992294_screen13824132195210">{
"key_info": {
"key_id": "bb6a3d22-dc93-47ac-b5bd-88df7ad35f1e",
"domain_id": "b168fe00ff56492495a7d22974df2d0b"
}
}</pre>
<p id="kms_02_0012__en-us_topic_0112992294_p16824925521">or</p>
<pre class="screen" id="kms_02_0012__en-us_topic_0112992294_screen2824162165217">{
"error": {
"error_code": "KMS.XXXX",
"error_msg": "XXX"
}
}</pre>
</li></ul>
</div>
<div class="section" id="kms_02_0012__en-us_topic_0112992294_s811d1a98cd5242509abd6671a9959d55"><h4 class="sectiontitle">Status Codes</h4><div class="p" id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_p17772351"><a href="#kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_table20596071">Table 5</a> lists the normal status code returned by the response.
<div class="tablenoborder"><a name="kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_table20596071"></a><a name="en-us_topic_0112992294_en-us_topic_0079615001_table20596071"></a><table cellpadding="4" cellspacing="0" summary="" id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_table20596071" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Status codes</caption><thead align="left"><tr id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_row9746163"><th align="left" class="cellrowborder" valign="top" width="16.16%" id="mcps1.3.6.2.2.2.4.1.1"><p id="kms_02_0012__en-us_topic_0112992294_p57545694203043">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="28.28%" id="mcps1.3.6.2.2.2.4.1.2"><p id="kms_02_0012__en-us_topic_0112992294_p4531342288">Status</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="55.559999999999995%" id="mcps1.3.6.2.2.2.4.1.3"><p id="kms_02_0012__en-us_topic_0112992294_p30689603203043">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_row48621261"><td class="cellrowborder" valign="top" width="16.16%" headers="mcps1.3.6.2.2.2.4.1.1 "><p id="kms_02_0012__en-us_topic_0112992294_en-us_topic_0079615001_p46008046">200</p>
</td>
<td class="cellrowborder" valign="top" width="28.28%" headers="mcps1.3.6.2.2.2.4.1.2 "><p id="kms_02_0012__en-us_topic_0112992294_p7538425819">OK</p>
</td>
<td class="cellrowborder" valign="top" width="55.559999999999995%" headers="mcps1.3.6.2.2.2.4.1.3 "><p id="kms_02_0012__en-us_topic_0112992294_p1885682315512">Request processed successfully.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p id="kms_02_0012__en-us_topic_0112992294_p5626181018551">Exception status code. For details, see <a href="kms_02_0301.html#kms_02_0301">Status Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="kms_02_0010.html">APIs</a></div>
</div>
</div>