[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# View keys by project\n\nThis page shows you how to view key rings and keys in your Google Cloud\n[project resource](/resource-manager/docs/cloud-platform-resource-hierarchy#projects).\n\nBefore you begin\n----------------\n\nBefore you can view key rings and keys, complete the setup steps described\nin this section.\n\n### Enable APIs\n\nTo view key rings and keys using an API, enable the Cloud KMS\nInventory API.\n\n[Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=kmsinventory.googleapis.com)\n\n\u003cbr /\u003e\n\n### Required roles\n\n\nTo get the permissions that\nyou need to view keys,\n\nask your administrator to grant you the\n\n\n[Cloud KMS Viewer](/iam/docs/roles-permissions/cloudkms#cloudkms.viewer) (`roles/cloudkms.viewer`)\nIAM role on your project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to view keys. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to view keys:\n\n- ` ``cloudkms.keyRings.list`` `\n- ` ``cloudkms.cryptoKeys.list`` `\n- ` ``cloudkms.locations.list`` `\n- ` ``resourcemanager.projects.get`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nView key rings\n--------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Key Rings** page.\n\n [Go to Key Rings](https://console.cloud.google.com/security/kms/keyrings)\n2. Optional: To filter your list of key rings, enter your search terms in\n the filter_list **Filter** box and\n then press Enter.\n\n3. Optional: To sort the list by the values in a column, click the\n column heading.\n\nWhile viewing your key rings, you can select a key ring to view details about\nthe associated keys and import jobs.\n\nView keys\n---------\n\nUse the Google Cloud console to view the keys created in your project resource. \n\n### Console\n\n1. In the Google Cloud console, go to the **Key Inventory** page.\n\n [Go to Key Inventory](https://console.cloud.google.com/security/kms/keys)\n2. Optional: To filter your list of keys, enter your search terms in the\n filter_list **Filter** box and then\n press Enter.\n\n3. Optional: To sort the list by the values in a column, click the\n column heading.\n\n### gcloud CLI\n\n\nTo use Cloud KMS on the command line, first\n[Install or upgrade to the latest version of Google Cloud CLI](/sdk/install).\n\n\u003cbr /\u003e\n\n```\ngcloud kms inventory list-keys --project PROJECT_ID\n```\n\nReplace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the name of the project for which you\nwant to view the list of keys.\n\nFor information on all flags and possible values, run the command with the\n`--help` flag.\n\n### API\n\n\nThese examples use [curl](https://curl.haxx.se/) as an HTTP client\nto demonstrate using the API. For more information about access control, see\n[Accessing the Cloud KMS API](/kms/docs/accessing-the-api).\n\n\u003cbr /\u003e\n\n curl \"https://kmsinventory.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/cryptoKeys\"\n --request \"GET\" \\\n --header \"x-goog-user-project: \u003cvar translate=\"no\"\u003eCALLING_PROJECT_ID\u003c/var\u003e\"\n --header \"Content-Type: application/json\" \\\n --header \"Authorization: Bearer \u003cvar translate=\"no\"\u003eTOKEN\u003c/var\u003e\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that contains the key ring.\n- \u003cvar translate=\"no\"\u003eCALLING_PROJECT_ID\u003c/var\u003e: the ID of the project from which you are calling the KMS Inventory API.\n\n| **Note:** This functionality is not available in client libraries during preview.\n\nWhile viewing your keys, you can select a key to view details about the key,\nincluding its associated key versions.\n\n### Key details\n\nThe key inventory provides comprehensive information about the cryptographic\nkeys in your project. Properties in the key inventory include the following:\n\n- **Key name**: The name of the key.\n- **Status** : The current key status based on the [state](/kms/docs/key-states) of the primary key version. This field applies to symmetric keys only.\n - **Available**: The primary key version is enabled. The key is available for use to encrypt and decrypt data.\n - **Not available**: The primary key version is disabled or empty. The key isn't available for use to encrypt data.\n - **Available in GCP**: For externally managed keys, the key (not necessarily the externally managed key itself) is available for use.\n- **Key ring**: Name of the parent key ring.\n- **Location**: Location where key material resides.\n- **Current rotation**: The date and time the key was last rotated. This field shows when the current key version was created.\n- **Rotation frequency**: The current rotation frequency of the key.\n- **Next rotation**: The date of the next scheduled key rotation. A new key version will be created automatically on this date.\n- **Protection level** : The [protection level](/kms/docs/algorithms#protection_levels) of the key, for example, HSM or Software.\n- **EKM via VPC connection** : For external keys accessed over VPC, the name of the [EKM via VPC connection](/kms/docs/create-ekm-connection#terminology) that the key uses. This field is hidden by default and is blank for keys with protection levels other than `External\n via VPC`.\n- **Purpose**: The scenario in which the key may be used.\n- **Labels**: Labels applied on the key.\n\nLimitations\n-----------\n\n- The **Key ring** tab can display at most 1,000 resources (including key\n rings, keys, and key versions) per [location](/kms/docs/locations). To view key rings for a\n project and location with more than 1,000 resources, use the\n [keyRings.list API](/kms/docs/reference/rest/v1/projects.locations.keyRings/list).\n\n- The **Key inventory** tab can display at most 20,000 resources (including\n key rings, keys, and key versions) per project. To view keys for a project\n with more than 20,000 resources, use the [keyRings.cryptoKeys.list API](/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys/list)."]]