Reference documentation and code samples for the KMS Inventory V1 API module Google::Cloud::Kms::V1::CryptoKey::CryptoKeyPurpose.
CryptoKeyPurpose
describes the cryptographic capabilities of a
CryptoKey. A given key can only be used
for the operations allowed by its purpose. For more information, see Key
purposes.
Constants
CRYPTO_KEY_PURPOSE_UNSPECIFIED
value: 0 Not specified.
ENCRYPT_DECRYPT
value: 1 CryptoKeys with this purpose may be used
with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
[Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
ASYMMETRIC_SIGN
value: 5 CryptoKeys with this purpose may be used
with
[AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
and
[GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
ASYMMETRIC_DECRYPT
value: 6 CryptoKeys with this purpose may be used
with
[AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
and
[GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
RAW_ENCRYPT_DECRYPT
value: 7 CryptoKeys with this purpose may be used
with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
This purpose is meant to be used for interoperable symmetric
encryption and does not support automatic CryptoKey rotation.
MAC
value: 9 CryptoKeys with this purpose may be used
with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# KMS Inventory V1 API - Module Google::Cloud::Kms::V1::CryptoKey::CryptoKeyPurpose (v0.15.1)\n\nVersion latestkeyboard_arrow_down\n\n- [0.15.1 (latest)](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.15.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.15.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.14.1](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.14.1/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.13.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.13.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.12.2](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.12.2/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.11.3](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.11.3/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.10.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.10.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.9.1](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.9.1/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.8.3](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.8.3/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.7.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.7.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.6.1](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.6.1/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.5.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.5.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.4.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.4.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.3.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.3.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.2.1](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.2.1/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose)\n- [0.1.0](/ruby/docs/reference/google-cloud-kms-inventory-v1/0.1.0/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose) \nReference documentation and code samples for the KMS Inventory V1 API module Google::Cloud::Kms::V1::CryptoKey::CryptoKeyPurpose.\n\n[CryptoKeyPurpose](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey-CryptoKeyPurpose \"Google::Cloud::Kms::V1::CryptoKey::CryptoKeyPurpose (module)\")\ndescribes the cryptographic capabilities of a\n[CryptoKey](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey \"Google::Cloud::Kms::V1::CryptoKey (class)\"). A given key can only be used\nfor the operations allowed by its purpose. For more information, see [Key\npurposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).\n\nConstants\n---------\n\n### CRYPTO_KEY_PURPOSE_UNSPECIFIED\n\n**value:** 0 \nNot specified.\n\n### ENCRYPT_DECRYPT\n\n**value:** 1 \n[CryptoKeys](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey \"Google::Cloud::Kms::V1::CryptoKey (class)\") with this purpose may be used\nwith \\[Encrypt\\]\\[google.cloud.kms.v1.KeyManagementService.Encrypt\\] and\n\\[Decrypt\\]\\[google.cloud.kms.v1.KeyManagementService.Decrypt\\].\n\n### ASYMMETRIC_SIGN\n\n**value:** 5 \n[CryptoKeys](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey \"Google::Cloud::Kms::V1::CryptoKey (class)\") with this purpose may be used\nwith\n\\[AsymmetricSign\\]\\[google.cloud.kms.v1.KeyManagementService.AsymmetricSign\\]\nand\n\\[GetPublicKey\\]\\[google.cloud.kms.v1.KeyManagementService.GetPublicKey\\].\n\n### ASYMMETRIC_DECRYPT\n\n**value:** 6 \n[CryptoKeys](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey \"Google::Cloud::Kms::V1::CryptoKey (class)\") with this purpose may be used\nwith\n\\[AsymmetricDecrypt\\]\\[google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt\\]\nand\n\\[GetPublicKey\\]\\[google.cloud.kms.v1.KeyManagementService.GetPublicKey\\].\n\n### RAW_ENCRYPT_DECRYPT\n\n**value:** 7 \n[CryptoKeys](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey \"Google::Cloud::Kms::V1::CryptoKey (class)\") with this purpose may be used\nwith \\[RawEncrypt\\]\\[google.cloud.kms.v1.KeyManagementService.RawEncrypt\\]\nand \\[RawDecrypt\\]\\[google.cloud.kms.v1.KeyManagementService.RawDecrypt\\].\nThis purpose is meant to be used for interoperable symmetric\nencryption and does not support automatic CryptoKey rotation.\n\n### MAC\n\n**value:** 9 \n[CryptoKeys](/ruby/docs/reference/google-cloud-kms-inventory-v1/latest/Google-Cloud-Kms-V1-CryptoKey \"Google::Cloud::Kms::V1::CryptoKey (class)\") with this purpose may be used\nwith \\[MacSign\\]\\[google.cloud.kms.v1.KeyManagementService.MacSign\\]."]]