返回指定主密钥(CMK)的相关信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DescribeKey |
系统规定参数。取值:DescribeKey。 |
KeyId | String | 是 | 1234abcd-12ab-34cd-56ef-12345678**** |
CMK的全局唯一标识符。该参数也可以被指定为CMK绑定的别名,详情请参见别名使用说明。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 3455b9b4-95c1-419d-b310-db6a53b09a39 |
本次请求的ID。 |
KeyMetadata | Struct |
CMK的metadata。 |
|
CreationDate | String | 2016-03-25T10:42:40Z |
创建CMK的日期和时间(UTC)。 |
Description | String | key description example |
CMK的描述。 |
KeyId | String | 08c33a6f-4e0a-4a1b-a3fa-7ddf**** |
CMK的全局唯一标识符。 |
KeyState | String | Enabled |
CMK的状态,详情请参见用户主密钥的状态对API调用的影响。 |
KeyUsage | String | ENCRYPT/DECRYPT |
CMK的用途。 |
DeleteDate | String | 2020-07-06T18:22:03Z |
CMK的预计删除时间,详情请参见ScheduleKeyDeletion。只有当KeyState值为PendingDeletion时,返回该值。 |
Creator | String | 123456 |
CMK创建者。 |
Arn | String | acs:kms:cn-hangzhou:123456:key/08c33a6f-4e0a-4a1b-a3fa-7ddf**** |
阿里云资源名称。 |
Origin | String | Aliyun_KMS |
CMK的密钥材料来源。 |
MaterialExpireTime | String | 2020-07-06T18:22:03Z |
密钥材料的过期时间(UTC)。当该值为空时,表示密钥材料不会过期。 |
ProtectionLevel | String | SOFTWARE |
密钥的保护级别。 |
PrimaryKeyVersion | String | 0ec2d249-9f64-4d8f-9587-1215525e**** |
对称类型CMK的当前的主版本标志符。主版本是对称类型CMK的活跃加密密钥,KMS使用主版本处理加密请求。不适用于非对称类型的CMK。 |
LastRotationDate | String | 2019-06-06T18:22:03Z |
最近一次轮转的时间(UTC)。如果是新创建密钥,则为初始密钥版本生成时间。 |
AutomaticRotation | String | Enabled |
是否开启自动密钥轮转,取值如下:
仅适用于对称类型的CMK。非对称类型的CMK不支持自动轮转。 |
RotationInterval | String | 31536000s |
密钥自动轮转的周期(秒数)。格式为整数值后加上字符s。例如,7天的轮转周期为604800s。只有当AutomaticRotation参数值为Enabled或Suspended时,返回该值。 |
NextRotationDate | String | 2020-07-06T18:22:03Z |
下一次轮转的时间。只有当AutomaticRotation参数值为Enabled或Suspended时,返回该值。 |
KeySpec | String | Aliyun_AES_256 |
CMK的类型。 |
示例
请求示例
https://[Endpoint]/?Action=DescribeKey
&KeyId=1234abcd-12ab-34cd-56ef-12345678****
&<公共请求参数>
正常返回示例
XML
格式
<KMS>
<KeyMetadata>
<CreationDate>2016-03-25T10:42:40Z</CreationDate>
<Description>key description example</Description>
<KeyId>08c33a6f-4e0a-4a1b-a3fa-7ddf****</KeyId>
<KeySpec>Aliyun_AES_256</KeySpec>
<KeyState>Enabled</KeyState>
<KeyUsage>ENCRYPT/DECRYPT</KeyUsage>
<PrimaryKeyVersion>0ec2d249-9f64-4d8f-9587-1215525e****</PrimaryKeyVersion>
<DeleteDate></DeleteDate>
<Creator>123456</Creator>
<Arn>acs:kms:cn-hangzhou:123456:key/08c33a6f-4e0a-4a1b-a3fa-7ddf****</Arn>
<Origin>Aliyun_KMS</Origin>
<MaterialExpireTime></MaterialExpireTime>
<ProtectionLevel>SOFTWARE</ProtectionLevel>
<LastRotationDate>2019-06-06T18:22:03Z</LastRotationDate>
<AutomaticRotation>Enabled</AutomaticRotation>
<RotationInterval>31536000s</RotationInterval>
<NextRotationDate>2020-07-06T18:22:03Z</NextRotationDate>
</KeyMetadata>
<RequestId>3455b9b4-95c1-419d-b310-db6a53b09a39</RequestId>
</KMS>
JSON
格式
{
"KeyMetadata": {
"CreationDate": "2016-03-25T10:42:40Z",
"Description": "key description example",
"KeyId": "08c33a6f-4e0a-4a1b-a3fa-7ddf****",
"KeySpec": "Aliyun_AES_256",
"KeyState": "Enabled",
"KeyUsage": "ENCRYPT/DECRYPT",
"PrimaryKeyVersion": "0ec2d249-9f64-4d8f-9587-1215525e****",
"DeleteDate": "",
"Creator":"123456",
"Arn":"acs:kms:cn-hangzhou:123456:key/08c33a6f-4e0a-4a1b-a3fa-7ddf****",
"Origin":"Aliyun_KMS",
"MaterialExpireTime":"",
"ProtectionLevel":"SOFTWARE",
"LastRotationDate": "2019-06-06T18:22:03Z",
"AutomaticRotation": "Enabled",
"RotationInterval": "31536000s",
"NextRotationDate": "2020-07-06T18:22:03Z"
},
"RequestId": "3455b9b4-95c1-419d-b310-db6a53b09a39"
}
错误码
访问错误中心查看更多错误码。