Key purposes and algorithms

Each Cloud Key Management Servicekey has apurpose, which defines thecryptographic capabilities of the key. The purpose also determines whichalgorithms are supported for the key's versions. Eachalgorithm defines whatparameters must be used for each cryptographic operation. Each key also has aprotection level that indicates whether cryptographic operations areperformed in software or in a Hardware Security Module (HSM).

Key purposes

Cloud KMS provides key purposes for the following scenarios:

ScenarioKey purpose (SDK)Key purpose (API)Supported methods
Symmetric encryptionencryptionENCRYPT_DECRYPTcryptoKeys.encrypt,cryptoKeys.decrypt
Raw symmetric encryptionraw-encryptionRAW_ENCRYPT_DECRYPTcryptoKeys.rawEncrypt,cryptoKeys.rawDecrypt
Asymmetric signingasymmetric-signingASYMMETRIC_SIGNcryptoKeyVersions.asymmetricSign,cryptoKeyVersions.getPublicKey
Asymmetric encryptionasymmetric-encryptionASYMMETRIC_DECRYPTcryptoKeyVersions.asymmetricDecrypt,cryptoKeyVersions.getPublicKey
Key encapsulation mechanismskey-encapsulationKEY_ENCAPSULATIONcryptoKeyVersions.decapsulate,cryptoKeyVersions.getPublicKey
MAC signingmacMACcryptoKeyVersions.macSign,cryptoKeyVersions.macVerify

When you create a key, you define the purpose and the algorithm of that key. Youcan change the algorithm when you create new key versions, subject to thescope of its purpose. The purpose cannot be changed.

Two keys with the same purpose may use different underlying algorithms, but theymust support the same set of cryptographic operations.

Symmetric encryption algorithms

The ENCRYPT_DECRYPT key purpose enables symmetric encryption. All keys with keypurpose ENCRYPT_DECRYPT use the GOOGLE_SYMMETRIC_ENCRYPTION algorithm. Noparameters are used with this algorithm. This algorithm uses 256-bit AdvancedEncryption Standard (AES-256) keys in Galois Counter Mode (GCM), padded withCloud KMS-internal metadata.

Asymmetric signing algorithms

The ASYMMETRIC_SIGN key purpose enables asymmetric signing. Keys with keypurpose ASYMMETRIC_SIGN use different algorithms, depending on whether the keysupportselliptic curve signing orRSA signing.

For a key that has purpose ASYMMETRIC_SIGN, you can switch between differentsize keys and different signature schemes via the algorithm.

Elliptic curve signing algorithms

The format of an elliptic curve signing algorithm is

EC_SIGN_[ELLIPTIC_CURVE]_[DIGEST_ALGORITHM]

where

  • [ELLIPTIC_CURVE] is the elliptic curve
  • [DIGEST_ALGORITHM] is the digest algorithm

The following table lists the possible algorithms for elliptic curve keys withpurpose ASYMMETRIC_SIGN. Use the lower-case algorithm names with thegcloudcommand, and the upper-case ones with the Cloud Key Management Service API.

Algorithm (SDK)Algorithm (API)Description
ec-sign-ed25519EC_SIGN_ED25519EdDSA on the Curve25519 inPureEdDSA mode, which takes raw data as input instead of hashed data
ec-sign-p256-sha256 **(recommended)**EC_SIGN_P256_SHA256ECDSA on the P-256 Curve with a SHA-256 digest
ec-sign-p384-sha384EC_SIGN_P384_SHA384ECDSA on the P-384 Curve with a SHA-384 digest
ec-sign-secp256k1-sha256EC_SIGN_SECP256K1_SHA256ECDSA on the Secp256k1 Curve with a SHA-256 digest
Note:secp256k1 curves generate signatures in the "normalized" formonly (also known as the "lower-S form"). For additional cryptographic detailsabout these signatures, seeDERencoding

RSA signing algorithms

The format of an RSA signing algorithm is

RSA_SIGN_[PADDING_ALGORITHM]_[MODULUS_BIT_LENGTH]_[DIGEST_ALGORITHM]

where

  • [PADDING_ALGORITHM] is the padding algorithm
  • [MODULUS_BIT_LENGTH] is the bit length of the key
  • [DIGEST_ALGORITHM] is the digest algorithm

Note that some algorithms are formatted as

RSA_SIGN_RAW_[PADDING_ALGORITHM]_[MODULUS_BIT_LENGTH]

and omit the digest algorithm. These algorithms are a variant of PKCS #1 signingthat omits encoding into a DigestInfo. In the variant:

  • a digest is computed over the message that will be signed
  • PKCS #1 padding is applied to the digest directly
  • a signature of the padded digest is computed, using the RSA private key

The following table lists the possible algorithms for RSA keys with purposeASYMMETRIC_SIGN. Use the lower-case algorithm names with thegcloudcommand, and the upper-case ones with the Cloud Key Management Service API.

Algorithm (SDK)Algorithm (API)Description
rsa-sign-pss-2048-sha256RSA_SIGN_PSS_2048_SHA256RSASSA-PSS 2048 bit key with a SHA-256 digest
rsa-sign-pss-3072-sha256(recommended)RSA_SIGN_PSS_3072_SHA256RSASSA-PSS 3072 bit key with a SHA-256 digest
rsa-sign-pss-4096-sha256RSA_SIGN_PSS_4096_SHA256RSASSA-PSS 4096 bit key with a SHA-256 digest
rsa-sign-pss-4096-sha512RSA_SIGN_PSS_4096_SHA512RSASSA-PSS 4096 bit key with a SHA-512 digest
rsa-sign-pkcs1-2048-sha256RSA_SIGN_PKCS1_2048_SHA256RSASSA-PKCS1 v1_5 with a 2048 bit key and a SHA-256 digest
rsa-sign-pkcs1-3072-sha256RSA_SIGN_PKCS1_3072_SHA256RSASSA-PKCS1 v1_5 with a 3072 bit key and a SHA-256 digest
rsa-sign-pkcs1-4096-sha256RSA_SIGN_PKCS1_4096_SHA256RSASSA-PKCS1 v1_5 with a 4096 bit key and a SHA-256 digest
rsa-sign-pkcs1-4096-sha512RSA_SIGN_PKCS1_4096_SHA512RSASSA-PKCS1 v1_5 with a 4096 bit key and a SHA-512 digest
rsa-sign-raw-pkcs1-2048RSA_SIGN_RAW_PKCS1_2048RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key
rsa-sign-raw-pkcs1-3072RSA_SIGN_RAW_PKCS1_3072RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key
rsa-sign-raw-pkcs1-4096RSA_SIGN_RAW_PKCS1_4096RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key

For Probabilistic Signature Scheme (PSS), the salt length used is equal to thelength of the digest algorithm. For example, RSA_SIGN_PSS_2048_SHA256 will usePSS with a salt length of 256 bits. In addition, for PSS the digest algorithmspecified in the algorithm name is used for the mask generation function (MGF1)as well. For example, if you are using RSA_SIGN_PSS_2048_SHA256, you will submita SHA-256 hash of the data to be signed, and Cloud KMS willinternally use SHA-256 as the hash algorithm for MGF1 when computing thesignature.

PQC signing algorithms

Preview

This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

Post-quantum cryptography (PQC) signing algorithms start with the prefixPQ_SIGN_. The following table lists the PQC algorithms that Cloud KMScan use for keys with purposeASYMMETRIC_SIGN. The pure algorithms take rawdata as input, while the pre-hash algorithms accept a hash of the data.

Algorithm (SDK)Algorithm (API)VariantDescription
pq-sign-ml-dsa-65PQ_SIGN_ML_DSA_65PureModule-lattice-based digital signature algorithm.
pq-sign-slh-dsa-sha2-128sPQ_SIGN_SLH_DSA_SHA2_128SPureStateless hash-based digital signature algorithm.
pq-sign-hash-slh-dsa-sha2-128s-sha256PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256Pre-hashStateless hash-based digital signature algorithm.

Asymmetric encryption algorithms

The ASYMMETRIC_DECRYPT key purpose enables RSA encryption. The format of anASYMMETRIC_DECRYPT algorithm is

RSA_DECRYPT_[PADDING_ALGORITHM]_[MODULUS_BIT_LENGTH]_[DIGEST_ALGORITHM]

where

  • [PADDING_ALGORITHM] is the padding algorithm
  • [MODULUS_BIT_LENGTH] is the bit length of the key
  • [DIGEST_ALGORITHM] is the digest algorithm

The following table lists the possible algorithms for RSA keys with purposeASYMMETRIC_DECRYPT. Use the lower-case algorithm names with thegcloudcommand, and the upper-case ones with the Cloud Key Management Service API.

Algorithm (SDK)Algorithm (API)Description
rsa-decrypt-oaep-2048-sha1RSA_DECRYPT_OAEP_2048_SHA1RSAES-OAEP 2048 bit key with a SHA-1 digest
rsa-decrypt-oaep-2048-sha256RSA_DECRYPT_OAEP_2048_SHA256RSAES-OAEP 2048 bit key with a SHA-256 digest
rsa-decrypt-oaep-3072-sha1RSA_DECRYPT_OAEP_3072_SHA1RSAES-OAEP 3072 bit key with a SHA-1 digest
rsa-decrypt-oaep-3072-sha256(recommended)RSA_DECRYPT_OAEP_3072_SHA256RSAES-OAEP 3072 bit key with a SHA-256 digest
rsa-decrypt-oaep-4096-sha1RSA_DECRYPT_OAEP_4096_SHA1RSAES-OAEP 4096 bit key with a SHA-1 digest
rsa-decrypt-oaep-4096-sha256RSA_DECRYPT_OAEP_4096_SHA256RSAES-OAEP 4096 bit key with a SHA-256 digest
rsa-decrypt-oaep-4096-sha512RSA_DECRYPT_OAEP_4096_SHA512RSAES-OAEP 4096 bit key with a SHA-512 digest

All of these algorithms use Optimal Asymmetric Encryption Padding (OAEP) withthe mask generation function MGF1. MGF1 requires a digest algorithm. InCloud KMS, the digest function to be used with MGF1 is specified aspart of the key algorithm name. For example, if you are using theRSA_DECRYPT_OAEP_3072_SHA256 algorithm, you should use SHA-256 with MGF1 whenencrypting data.

Key encapsulation algorithms

TheKEY_ENCAPSULATION key purpose is used to establish shared secretsusingkey encapsulation mechanisms.

The following table lists the possible algorithms for keys with purposeKEY_ENCAPSULATION. All of these algorithms are designed to be post-quantumsecure. Use the lower-case algorithm names with thegcloudcommand, and the upper-case ones with the Cloud Key Management Service API.

Algorithm (SDK)Algorithm (API)Description
ml-kem-768ML_KEM_768Module-lattice-based key-encapsulation mechanism with ML-KEM-768 parameter set (FIPS 203)
ml-kem-1024ML_KEM_1024Module-lattice-based key-encapsulation mechanism with ML-KEM-1024 parameter set (FIPS 203)
kem-xwingKEM_XWINGX-Wing hybrid KEM combining ML-KEM-768 with X25519

MAC signing algorithms

The MAC key purpose enables symmetric MAC signing. Keys with key purpose MACcurrently only supportHMAC signing.

HMAC signing algorithms

The format of an HMAC signing algorithm is

HMAC_[HASH_ALGORITHM]

where

  • [HASH_ALGORITHM] is the hash algorithm

The following table lists the currently available HMAC algorithms for keys withpurpose MAC. Use the lower-case algorithm names with thegcloud command, andthe upper-case ones with the Cloud Key Management Service API.

Algorithm (SDK)Algorithm (API)Description
hmac-sha1HMAC_SHA1HMAC with a SHA-1 digest
hmac-sha224HMAC_SHA224HMAC with a SHA-224 digest
hmac-sha256(recommended)HMAC_SHA256HMAC with a SHA-256 digest
hmac-sha384HMAC_SHA384HMAC with a SHA-384 digest
hmac-sha512HMAC_SHA512HMAC with a SHA-512 digest

Algorithm recommendations

For digital signing, the recommendation is to use elliptic curve signingalgorithms. EC_SIGN_P256_SHA256 is the recommended elliptic curve algorithm. Ifyou are going to use RSA signing algorithms, the recommended RSA signingalgorithm is RSA_SIGN_PSS_3072_SHA256.

For asymmetric encryption, RSA_DECRYPT_OAEP_3072_SHA256 is the recommendedalgorithm.

For MAC signing, HMAC_SHA256 is the recommended algorithm.

For key encapsulation, we recommend usingKEM_XWING, which is a hybridalgorithm that can provide layered defense against both classical andpotential quantum adversaries.

For the list of supported algorithm values to be used with the gcloud CLI,see--default-algorithm.

Protection levels

The protection level indicates how cryptographic operations are performed. Afteryou create a key, you cannot change the protection level.

Protection levelDescription
SOFTWARECryptographic operations are performed in software.
HSMCryptographic operations are performed in an HSM.
HSM_SINGLE_TENANTCryptographic operations are performed in a dedicated cluster of HSM partitions, exclusively created for a single-tenant Cloud HSM instance.
EXTERNALCryptographic operations are performed using a key stored in anexternal key manager connected to Google Cloud using the internet. Limited to symmetric encryption and asymmetric signing.
EXTERNAL_VPCCryptographic operations are performed using a key stored in an external key manager connected to Google Cloud over Virtual Private Cloud (VPC). Limited to symmetric encryption and asymmetric signing.

Allkey purposes are supported for keys with protection levelSOFTWARE orHSM.

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 2026-02-19 UTC.