查询用户主密钥(CMK)详情。
接口说明
RAM 用户或 RAM 角色调用该 OpenAPI 需要被授予的权限策略详情,请参见访问控制。
本文将提供一个示例,为您查询 ID 为key-hzz630494463ejqjx**** 的用户主密钥的详情,包括创建者、创建时间、密钥状态、删除保护状态等信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| KeyId |
string |
是 |
密钥的 ID,也可以指定为密钥别名或密钥资源名称(ARN)。关于别名的详细介绍,请参见管理密钥别名。 说明
访问其他阿里云账号下的密钥时,必须输入密钥 ARN。密钥 ARN 的格式为 |
key-hzz630494463ejqjx**** |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
本次调用请求的 ID,是由阿里云为该请求生成的唯一标识符,可用于排查和定位问题。 |
f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f |
| KeyMetadata |
object |
CMK 的元数据。 |
|
| DeletionProtection |
string |
是否开启删除保护,取值:
|
Enabled |
| KeyId |
string |
密钥 ID。如果请求中的 KeyId 参数使用的是密钥别名、密钥 ARN,在响应中也会返回密钥 ID。 |
key-hzz630494463ejqjx**** |
| NextRotationDate |
string |
下一次轮转的时间。 说明
当 AutomaticRotation 取值为 Enabled 或 Suspended 时,返回该参数。 |
2021-07-06T18:22:03Z |
| KeyState |
string |
CMK 的状态。 |
Enabled |
| RotationInterval |
string |
密钥自动轮转的周期。 说明
当 AutomaticRotation 取值为 Enabled 或 Suspended 时,返回该参数。 |
31536000s |
| Arn |
string |
CMK 的资源名称(ARN)。 |
acs:kms:cn-hangzhou:154035569884****:key/key-hzz630494463ejqjx**** |
| Creator |
string |
创建 CMK 的阿里云账号。 |
154035569884**** |
| LastRotationDate |
string |
最近一次轮转的时间(UTC)。如果是新创建的密钥,则为初始密钥版本生成时间。 |
2024-05-20T06:34:21Z |
| DeleteDate |
string |
CMK 的预计删除时间(UTC)。 说明
当 KeyState 取值为 PendingDeletion 时,返回该参数。 |
2024-05-26T18:22:03Z |
| PrimaryKeyVersion |
string |
对称类型 CMK 当前的主版本标识符。 |
515e0b0a-624f-45ab-92b5-54f9b551**** |
| Description |
string |
CMK 的描述。 |
key description example |
| KeySpec |
string |
CMK 的类型。 |
Aliyun_AES_256 |
| Origin |
string |
CMK 的密钥材料来源。 |
Aliyun_KMS |
| MaterialExpireTime |
string |
密钥材料的过期时间(UTC)。当该值为空时,表示密钥材料不会过期。 |
2024-07-06T18:22:03Z |
| DeletionProtectionDescription |
string |
删除保护描述。 |
该密钥正在被XXX服务使用。已为您设置删除保护。 |
| AutomaticRotation |
string |
是否开启自动轮转,取值:
更多信息,请参见自动轮转密钥。 说明
仅对称密钥支持自动轮转。 |
Disabled |
| ProtectionLevel |
string |
CMK 的保护级别。 |
HSM |
| KeyUsage |
string |
CMK 的用途。 |
ENCRYPT/DECRYPT |
| CreationDate |
string |
CMK 的创建时间(UTC)。 |
2024-05-20T06:34:21Z |
| DKMSInstanceId |
string |
KMS 实例的实例 ID。 |
kst-bjj62d8f5e0sgtx8h**** |
示例
正常返回示例
JSON格式
{
"RequestId": "f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f",
"KeyMetadata": {
"DeletionProtection": "Enabled",
"KeyId": "key-hzz630494463ejqjx****",
"NextRotationDate": "2021-07-06T18:22:03Z",
"KeyState": "Enabled",
"RotationInterval": "31536000s",
"Arn": "acs:kms:cn-hangzhou:154035569884****:key/key-hzz630494463ejqjx****",
"Creator": "154035569884****",
"LastRotationDate": "2024-05-20T06:34:21Z",
"DeleteDate": "2024-05-26T18:22:03Z",
"PrimaryKeyVersion": "515e0b0a-624f-45ab-92b5-54f9b551****",
"Description": "key description example",
"KeySpec": "Aliyun_AES_256",
"Origin": "Aliyun_KMS",
"MaterialExpireTime": "2024-07-06T18:22:03Z",
"DeletionProtectionDescription": "该密钥正在被XXX服务使用。已为您设置删除保护。",
"AutomaticRotation": "Disabled",
"ProtectionLevel": "HSM",
"KeyUsage": "ENCRYPT/DECRYPT",
"CreationDate": "2024-05-20T06:34:21Z",
"DKMSInstanceId": "kst-bjj62d8f5e0sgtx8h****"
}
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is not valid. | 参数非法。 |
| 404 | Forbidden.KeyNotFound | The specified Key is not found. | 指定的密钥不存在。 |
| 404 | Forbidden.AliasNotFound | The specified Alias is not found. | 指定的别名找不到 |
| 404 | InvalidAccessKeyId.NotFound | The Access Key ID provided does not exist in our records. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。