crypto_keys
Creates, updates, deletes, gets or lists a crypto_keys
resource.
Overview
Name | crypto_keys |
Type | Resource |
Id | google.cloudkms.crypto_keys |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Output only. The resource name for this CryptoKey in the format projects/*/locations/*/keyRings/*/cryptoKeys/* . |
createTime | string | Output only. The time at which this CryptoKey was created. |
cryptoKeyBackend | string | Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format projects/*/locations/*/ekmConnections/* . Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future. |
destroyScheduledDuration | string | Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days. |
importOnly | boolean | Immutable. Whether this key may contain imported versions only. |
keyAccessJustificationsPolicy | object | A KeyAccessJustificationsPolicy specifies zero or more allowed AccessReason values for encrypt, decrypt, and sign operations on a CryptoKey. |
labels | object | Labels with user-defined metadata. For more information, see Labeling Keys. |
nextRotationTime | string | At next_rotation_time, the Key Management Service will automatically: 1. Create a new version of this CryptoKey. 2. Mark the new version as primary. Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time. Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted. |
primary | object | A CryptoKeyVersion represents an individual cryptographic key, and the associated key material. An ENABLED version can be used for cryptographic operations. For security reasons, the raw cryptographic key material represented by a CryptoKeyVersion can never be viewed or exported. It can only be used to encrypt, decrypt, or sign data when an authorized user or application invokes Cloud KMS. |
purpose | string | Immutable. The immutable purpose of this CryptoKey. |
rotationPeriod | string | next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours. If rotation_period is set, next_rotation_time must also be set. Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted. |
versionTemplate | object | A CryptoKeyVersionTemplate specifies the properties to use when creating a new CryptoKeyVersion, either manually with CreateCryptoKeyVersion or automatically as a result of auto-rotation. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | cryptoKeysId, keyRingsId, locationsId, projectsId | Returns metadata for a given CryptoKey, as well as its primary CryptoKeyVersion. |
list | SELECT | keyRingsId, locationsId, projectsId | Lists CryptoKeys. |
create | INSERT | keyRingsId, locationsId, projectsId | Create a new CryptoKey within a KeyRing. CryptoKey.purpose and CryptoKey.version_template.algorithm are required. |
patch | UPDATE | cryptoKeysId, keyRingsId, locationsId, projectsId | Update a CryptoKey. |
decrypt | EXEC | cryptoKeysId, keyRingsId, locationsId, projectsId | Decrypts data that was protected by Encrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT. |
encrypt | EXEC | cryptoKeysId, keyRingsId, locationsId, projectsId | Encrypts data, so that it can only be recovered by a call to Decrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT. |
SELECT
examples
Lists CryptoKeys.
SELECT
name,
createTime,
cryptoKeyBackend,
destroyScheduledDuration,
importOnly,
keyAccessJustificationsPolicy,
labels,
nextRotationTime,
primary,
purpose,
rotationPeriod,
versionTemplate
FROM google.cloudkms.crypto_keys
WHERE keyRingsId = '{{ keyRingsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new crypto_keys
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.cloudkms.crypto_keys (
keyRingsId,
locationsId,
projectsId,
purpose,
nextRotationTime,
rotationPeriod,
versionTemplate,
labels,
importOnly,
destroyScheduledDuration,
cryptoKeyBackend,
keyAccessJustificationsPolicy
)
SELECT
'{{ keyRingsId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ purpose }}',
'{{ nextRotationTime }}',
'{{ rotationPeriod }}',
'{{ versionTemplate }}',
'{{ labels }}',
{{ importOnly }},
'{{ destroyScheduledDuration }}',
'{{ cryptoKeyBackend }}',
'{{ keyAccessJustificationsPolicy }}'
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: primary
value:
- name: name
value: string
- name: state
value: string
- name: protectionLevel
value: string
- name: algorithm
value: string
- name: attestation
value:
- name: format
value: string
- name: content
value: string
- name: certChains
value:
- name: caviumCerts
value:
- string
- name: googleCardCerts
value:
- string
- name: googlePartitionCerts
value:
- string
- name: createTime
value: string
- name: generateTime
value: string
- name: destroyTime
value: string
- name: destroyEventTime
value: string
- name: importJob
value: string
- name: importTime
value: string
- name: importFailureReason
value: string
- name: generationFailureReason
value: string
- name: externalDestructionFailureReason
value: string
- name: externalProtectionLevelOptions
value:
- name: externalKeyUri
value: string
- name: ekmConnectionKeyPath
value: string
- name: reimportEligible
value: boolean
- name: purpose
value: string
- name: createTime
value: string
- name: nextRotationTime
value: string
- name: rotationPeriod
value: string
- name: versionTemplate
value:
- name: protectionLevel
value: string
- name: algorithm
value: string
- name: labels
value: object
- name: importOnly
value: boolean
- name: destroyScheduledDuration
value: string
- name: cryptoKeyBackend
value: string
- name: keyAccessJustificationsPolicy
value:
- name: allowedAccessReasons
value:
- string
UPDATE
example
Updates a crypto_keys
resource.
/*+ update */
UPDATE google.cloudkms.crypto_keys
SET
purpose = '{{ purpose }}',
nextRotationTime = '{{ nextRotationTime }}',
rotationPeriod = '{{ rotationPeriod }}',
versionTemplate = '{{ versionTemplate }}',
labels = '{{ labels }}',
importOnly = true|false,
destroyScheduledDuration = '{{ destroyScheduledDuration }}',
cryptoKeyBackend = '{{ cryptoKeyBackend }}',
keyAccessJustificationsPolicy = '{{ keyAccessJustificationsPolicy }}'
WHERE
cryptoKeysId = '{{ cryptoKeysId }}'
AND keyRingsId = '{{ keyRingsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';