調用DescribeKey介面查詢使用者主要金鑰(CMK)詳情。
本文將提供一個樣本,為您查詢ID為key-hzz630494463ejqjx****
的使用者主要金鑰的詳情,包括建立者、建立時間、密鑰狀態、刪除保護狀態等資訊。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
請求參數
|
名稱 |
類型 |
是否必選 |
樣本值 |
描述 |
| Action | String | 是 | DescribeKey | 要執行的操作。取值:DescribeKey。 |
| KeyId | String | 是 | key-hzz630494463ejqjx**** | 密鑰的ID,也可以指定為密鑰別名或密鑰資源名稱(ARN)。關於別名的詳細介紹,請參見管理密鑰別名。 說明 訪問其他阿里雲帳號下的密鑰時,必須輸入密鑰ARN。密鑰ARN的格式為 acs:kms:${region}:${account}:key/${keyid}。 |
返回資料
名稱 |
類型 |
樣本值 |
描述 |
| RequestId | String | f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f | 本次調用請求的ID,是由阿里雲為該請求產生的唯一識別碼,可用於排查和定位問題。 |
| KeyMetadata | Object | CMK的中繼資料。 |
|
| DeletionProtection | String | Enabled | 是否開啟刪除保護,取值:
|
| KeyId | String | key-hzz630494463ejqjx**** | 密鑰ID。如果請求中的KeyId參數使用的是密鑰別名、密鑰ARN,在響應中也會返回密鑰ID。 |
| 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/key-hzz630494463ejqjx**** | CMK的資源名稱(ARN)。 |
| Creator | String | 154035569884**** | 建立CMK的阿里雲帳號。 |
| LastRotationDate | String | 2024-05-20T06:34:21Z | 最近一次輪轉的時間(UTC)。如果是新建立的密鑰,則為初始密鑰版本產生時間。 |
| DeleteDate | String | 2024-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 | 2024-07-06T18:22:03Z | 密鑰材料的到期時間(UTC)。當該值為空白時,表示密鑰材料不會到期。 |
| DeletionProtectionDescription | String | 該密鑰正在被XXX服務使用。已為您設定刪除保護。 | 刪除保護描述。 |
| AutomaticRotation | String | Disabled | 是否開啟自動輪轉,取值:
更多資訊,請參見自動輪轉密鑰。 說明 僅對稱金鑰支援自動輪轉。 |
| ProtectionLevel | String | HSM | CMK的保護層級。 |
| KeyUsage | String | ENCRYPT/DECRYPT | CMK的用途。 |
| CreationDate | String | 2024-05-20T06:34:21Z | CMK的建立時間(UTC)。 |
| DKMSInstanceId | String | kst-bjj62d8f5e0sgtx8h**** | KMS執行個體的執行個體ID。 |
樣本
請求樣本
http(s)://[Endpoint]/?Action=DescribeKey
&KeyId=key-hzz630494463ejqjx****
&公用請求參數
正常返回樣本
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeKeyResponse>
<RequestId>f1fdfa9d-bd49-418b-942f-8f3e3ec00a4f</RequestId>
<KeyMetadata>
<DeletionProtection>Enabled</DeletionProtection>
<KeyId>key-hzz630494463ejqjx****</KeyId>
<NextRotationDate>2021-07-06T18:22:03Z</NextRotationDate>
<KeyState>Enabled</KeyState>
<RotationInterval>31536000s</RotationInterval>
<Arn>acs:kms:cn-hangzhou:154035569884****:key/key-hzz630494463ejqjx****</Arn>
<Creator>154035569884****</Creator>
<LastRotationDate>2024-05-20T06:34:21Z</LastRotationDate>
<DeleteDate>2024-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>2024-07-06T18:22:03Z</MaterialExpireTime>
<DeletionProtectionDescription>該密鑰正在被XXX服務使用。已為您設定刪除保護。</DeletionProtectionDescription>
<AutomaticRotation>Disabled</AutomaticRotation>
<ProtectionLevel>HSM</ProtectionLevel>
<KeyUsage>ENCRYPT/DECRYPT</KeyUsage>
<CreationDate>2024-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" : "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****"
}
}
錯誤碼
|
HttpCode |
錯誤碼 |
錯誤資訊 |
描述 |
| 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. | 指定的別名找不到 |
訪問錯誤中心查看更多錯誤碼。