调用DescribeKey接口查询用户主密钥(CMK)详情。
本文将提供一个示例,为您查询ID为05754286-3ba2-4fa6-8d41-4323aca6****
的用户主密钥的详情,包括创建者、创建时间、密钥状态、删除保护状态等信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | DescribeKey |
要执行的操作。取值:DescribeKey。 |
KeyId | String | 是 | 05754286-3ba2-4fa6-8d41-4323aca6**** |
CMK的全局唯一标识符。 该参数也可以被指定为CMK绑定的别名。更多信息,请参见别名概述。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f |
本次调用请求的ID,是由阿里云为该请求生成的唯一标识符,可用于排查和定位问题。 |
KeyMetadata | Object |
CMK的元数据。 |
|
DeletionProtection | String | Enabled |
是否开启删除保护,取值:
|
KeyId | String | 05754286-3ba2-4fa6-8d41-4323aca6**** |
CMK的全局唯一标识符。 |
NextRotationDate | String | 2021-07-06T18:22:03Z |
下一次轮转的时间。 说明 当AutomaticRotation取值为Enabled或Suspended时,返回该参数。
|
KeyState | String | Enabled |
CMK的状态。 更多信息,请参见用户主密钥的状态对API调用的影响。 |
RotationInterval | String | 31536000s |
密钥自动轮转的周期。 单位:s。 例如:7天的轮转周期为604800s。 说明 当AutomaticRotation取值为Enabled或Suspended时,返回该参数。
|
Arn | String | acs:kms:cn-hangzhou:154035569884****:key/05754286-3ba2-4fa6-8d41-4323aca6**** |
CMK的资源名称(ARN)。 |
Creator | String | 154035569884**** |
创建CMK的阿里云账号。 |
LastRotationDate | String | 2021-05-20T06:34:21Z |
最近一次轮转的时间(UTC)。如果是新创建的密钥,则为初始密钥版本生成时间。 |
DeleteDate | String | 2021-05-26T18:22:03Z |
CMK的预计删除时间(UTC)。 更多信息,请参见ScheduleKeyDeletion。 说明 当KeyState取值为PendingDeletion时,返回该参数。
|
PrimaryKeyVersion | String | 515e0b0a-624f-45ab-92b5-54f9b551**** |
对称类型CMK当前的主版本标识符。 |
Description | String | key description example |
CMK的描述。 |
KeySpec | String | Aliyun_AES_256 |
CMK的类型。 |
Origin | String | Aliyun_KMS |
CMK的密钥材料来源。 |
MaterialExpireTime | String | 2021-07-06T18:22:03Z |
密钥材料的过期时间(UTC)。当该值为空时,表示密钥材料不会过期。 |
DeletionProtectionDescription | String | 该密钥正在被XXX服务使用。已为您设置删除保护。 |
删除保护描述。 |
AutomaticRotation | String | Disabled |
是否开启自动轮转,取值:
更多信息,请参见自动轮转密钥。 说明 仅对称密钥支持自动轮转。
|
ProtectionLevel | String | HSM |
CMK的保护级别。 |
KeyUsage | String | ENCRYPT/DECRYPT |
CMK的用途。 |
CreationDate | String | 2021-05-20T06:34:21Z |
CMK的创建时间(UTC)。 |
DKMSInstanceId | String | kst-bjj62d8f5e0sgtx8h**** |
专属KMS实例的实例ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=DescribeKey
&KeyId=05754286-3ba2-4fa6-8d41-4323aca6****
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeKeyResponse>
<RequestId>f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f</RequestId>
<KeyMetadata>
<DeletionProtection>Enabled</DeletionProtection>
<KeyId>05754286-3ba2-4fa6-8d41-4323aca6****</KeyId>
<NextRotationDate>2021-07-06T18:22:03Z</NextRotationDate>
<KeyState>Enabled</KeyState>
<RotationInterval>31536000s</RotationInterval>
<Arn>acs:kms:cn-hangzhou:154035569884****:key/05754286-3ba2-4fa6-8d41-4323aca6****</Arn>
<Creator>154035569884****</Creator>
<LastRotationDate>2021-05-20T06:34:21Z</LastRotationDate>
<DeleteDate>2021-05-26T18:22:03Z</DeleteDate>
<PrimaryKeyVersion>515e0b0a-624f-45ab-92b5-54f9b551****</PrimaryKeyVersion>
<Description>key description example</Description>
<KeySpec>Aliyun_AES_256</KeySpec>
<Origin>Aliyun_KMS</Origin>
<MaterialExpireTime>2021-07-06T18:22:03Z</MaterialExpireTime>
<DeletionProtectionDescription>该密钥正在被XXX服务使用。已为您设置删除保护。</DeletionProtectionDescription>
<AutomaticRotation>Disabled</AutomaticRotation>
<ProtectionLevel>HSM</ProtectionLevel>
<KeyUsage>ENCRYPT/DECRYPT</KeyUsage>
<CreationDate>2021-05-20T06:34:21Z</CreationDate>
<DKMSInstanceId>kst-bjj62d8f5e0sgtx8h****</DKMSInstanceId>
</KeyMetadata>
</DescribeKeyResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f",
"KeyMetadata" : {
"DeletionProtection" : "Enabled",
"KeyId" : "05754286-3ba2-4fa6-8d41-4323aca6****",
"NextRotationDate" : "2021-07-06T18:22:03Z",
"KeyState" : "Enabled",
"RotationInterval" : "31536000s",
"Arn" : "acs:kms:cn-hangzhou:154035569884****:key/05754286-3ba2-4fa6-8d41-4323aca6****",
"Creator" : "154035569884****",
"LastRotationDate" : "2021-05-20T06:34:21Z",
"DeleteDate" : "2021-05-26T18:22:03Z",
"PrimaryKeyVersion" : "515e0b0a-624f-45ab-92b5-54f9b551****",
"Description" : "key description example",
"KeySpec" : "Aliyun_AES_256",
"Origin" : "Aliyun_KMS",
"MaterialExpireTime" : "2021-07-06T18:22:03Z",
"DeletionProtectionDescription" : "该密钥正在被XXX服务使用。已为您设置删除保护。",
"AutomaticRotation" : "Disabled",
"ProtectionLevel" : "HSM",
"KeyUsage" : "ENCRYPT/DECRYPT",
"CreationDate" : "2021-05-20T06:34:21Z",
"DKMSInstanceId" : "kst-bjj62d8f5e0sgtx8h****"
}
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
404 | Forbidden.KeyNotFound | The specified Key is not found. | 指定的密钥不存在。 |
404 | Forbidden.AliasNotFound | The specified Alias is not found. | 指定的别名找不到 |
访问错误中心查看更多错误码。