

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 查看授权
<a name="grant-view"></a>

要查看授权，请使用[ListGrants](https://docs.amazonaws.cn/kms/latest/APIReference/API_ListGrants.html)操作。您必须指定授权所适用的 KMS 密钥。您还可以按授权 ID、被授权人委托人或被授权人服务主体筛选授权列表。有关更多示例，请参阅[`ListGrants`与 Amazon SDK 或 CLI 配合使用](example_kms_ListGrants_section.md)。

要查看 Amazon Web Services 账户 和地区中具有特定[退休本金或即将退休服务本金](grants.md#terms-retiring-principal)[的所有补助金](grants.md#terms-retiring-service-principal)，请使用。[ListRetirableGrants](https://docs.amazonaws.cn/kms/latest/APIReference/API_ListRetirableGrants.html)响应包括每项授权的详细信息。

**注意**  
`ListGrants` 响应中的 `GranteePrincipal` 字段通常包含授权的被授权者委托人。但是，当赠款中的受赠方委托人是 Amazon 服务时，该`GranteePrincipal`字段包含[服务委托](https://docs.amazonaws.cn/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services)人，它可能代表几个不同的受赠方委托人。

**注意**  
使用[`GranteeServicePrincipal`](grants.md#terms-grantee-service-principal)参数创建授权时，`ListGrants`响应中会包含一个`GranteeServicePrincipal`字段，而不是`GranteePrincipal`。这将明确`GranteeServicePrincipal`为 Amazon [服务委](https://docs.amazonaws.cn/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services)托人设立的补助金与在`GranteePrincipal`实地代表 Amazon 服务的补助金区分开来。

例如，以下命令列出 KMS 密钥的所有授权。

```
$  aws kms list-grants --key-id 1234abcd-12ab-34cd-56ef-1234567890ab
{
    "Grants": [
        {
            "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
            "CreationDate": 1572216195.0,
            "GrantId": "abcde1237f76e4ba7987489ac329fbfba6ad343d6f7075dbd1ef191f0120514a",
            "Constraints": {
                "EncryptionContextSubset": {
                    "Department": "IT"
                }
            },
            "RetiringPrincipal": "arn:aws:iam::111122223333:role/adminRole",
            "Name": "",
            "IssuingAccount": "arn:aws:iam::111122223333:root",
            "GranteePrincipal": "arn:aws:iam::111122223333:user/exampleUser",
            "Operations": [
                "Decrypt"
            ]
        }
    ]
}
```

以下示例显示了使用创建的拨款的`ListGrants`响应`GranteeServicePrincipal`。请注意，响应中包含一个`GranteeServicePrincipal`字段而不是字段`GranteePrincipal`，并且该`Constraints`字段包含一个`SourceArn`值。

```
$  aws kms list-grants --key-id 1234abcd-12ab-34cd-56ef-1234567890ab
{
    "Grants": [
        {
            "KeyId": "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab",
            "CreationDate": 1718567315.0,
            "GrantId": "abcde1237f76e4ba7987489ac329fbfba6ad343d6f7075dbd1ef191f0120514a",
            "Constraints": {
                "EncryptionContextSubset": {
                    "Department": "IT"
                },
                "SourceArn": "arn:aws:dynamodb:us-east-1:111122223333:table/ExampleTable"
            },
            "RetiringServicePrincipal": "{{service-name}}.amazonaws.com",
            "Name": "",
            "IssuingAccount": "arn:aws:iam::111122223333:root",
            "GranteeServicePrincipal": "{{service-name}}.amazonaws.com",
            "Operations": [
                "Encrypt",
                "Decrypt",
                "GenerateDataKey"
            ]
        }
    ]
}
```