gcloud alpha kms keys versions get-public-key

NAME
gcloud alpha kms keys versions get-public-key - get the public key for a given version
SYNOPSIS
gcloud alpha kms keys versions get-public-keyVERSION[--key=KEY][--keyring=KEYRING][--location=LOCATION][--output-file=OUTPUT_FILE][--public-key-format=PUBLIC_KEY_FORMAT][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Returns the public key of the given asymmetric key versionin the specified format.

The optional flagoutput-file indicates the path to store thepublic key. If not specified, the public key will be printed to stdout.

The optional flagpublic-key-format indicates the format in whichthe public key will be returned. For the NIST PQC algorithms, this must bespecified and set tonist-pqc. For kem-xwing this must be specifiedand set toxwing-raw-bytes. For all other algorithms, this flag isoptional and can be eitherpem order; the defaultvalue ispem. See "Retrieve a public key" in the Cloud KMSdocumentation (https://cloud.google.com/kms/help/get-public-key) for moreinformation about the supported formats.

EXAMPLES
The following command saves the public key for CryptoKeyfrodoVersion 2 to '/tmp/my/public_key.file':
gcloudalphakmskeysversionsget-public-key2--key=frodo--keyring=fellowship--location=us-east1--public-key-format=pem--output-file=/tmp/my/public_key.file
POSITIONAL ARGUMENTS
VERSION
Name of the version to get public key.
FLAGS
--key=KEY
The containing key.
--keyring=KEYRING
Key ring of the key.
--location=LOCATION
Location of the keyring.
--output-file=OUTPUT_FILE
Path to the output file to store public key.
--public-key-format=PUBLIC_KEY_FORMAT
The format in which the public key will be returned.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudkmskeysversionsget-public-key
gcloudbetakmskeysversionsget-public-key

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-16 UTC.