Class CryptoKeyVersion (2.21.2)

CryptoKeyVersion(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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.

Attributes

NameDescription
name str
Output only. The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*.
state google.cloud.kms_v1.types.CryptoKeyVersion.CryptoKeyVersionState
The current state of the CryptoKeyVersion.
protection_level google.cloud.kms_v1.types.ProtectionLevel
Output only. The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion.
algorithm google.cloud.kms_v1.types.CryptoKeyVersion.CryptoKeyVersionAlgorithm
Output only. The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
attestation google.cloud.kms_v1.types.KeyOperationAttestation
Output only. Statement that was generated and signed by the HSM at key creation time. Use this statement to verify attributes of the key as stored on the HSM, independently of Google. Only provided for key versions with protection_level HSM.
create_time google.protobuf.timestamp_pb2.Timestamp
Output only. The time at which this CryptoKeyVersion was created.
generate_time google.protobuf.timestamp_pb2.Timestamp
Output only. The time this CryptoKeyVersion's key material was generated.
destroy_time google.protobuf.timestamp_pb2.Timestamp
Output only. The time this CryptoKeyVersion's key material is scheduled for destruction. Only present if state is DESTROY_SCHEDULED.
destroy_event_time google.protobuf.timestamp_pb2.Timestamp
Output only. The time this CryptoKeyVersion's key material was destroyed. Only present if state is DESTROYED.
import_job str
Output only. The name of the ImportJob used in the most recent import of this CryptoKeyVersion. Only present if the underlying key material was imported.
import_time google.protobuf.timestamp_pb2.Timestamp
Output only. The time at which this CryptoKeyVersion's key material was most recently imported.
import_failure_reason str
Output only. The root cause of the most recent import failure. Only present if state is IMPORT_FAILED.
generation_failure_reason str
Output only. The root cause of the most recent generation failure. Only present if state is GENERATION_FAILED.
external_destruction_failure_reason str
Output only. The root cause of the most recent external destruction failure. Only present if state is EXTERNAL_DESTRUCTION_FAILED.
external_protection_level_options google.cloud.kms_v1.types.ExternalProtectionLevelOptions
ExternalProtectionLevelOptions stores a group of additional fields for configuring a CryptoKeyVersion that are specific to the EXTERNAL protection level and EXTERNAL_VPC protection levels.
reimport_eligible bool
Output only. Whether or not this key version is eligible for reimport, by being specified as a target in ImportCryptoKeyVersionRequest.crypto_key_version.

Classes

CryptoKeyVersionAlgorithm

CryptoKeyVersionAlgorithm(value)

The algorithm of the CryptoKeyVersion, indicating what parameters must be used for each cryptographic operation.

The GOOGLE_SYMMETRIC_ENCRYPTION algorithm is usable with CryptoKey.purpose ENCRYPT_DECRYPT.

Algorithms beginning with RSA_SIGN_ are usable with CryptoKey.purpose ASYMMETRIC_SIGN.

The fields in the name after RSA_SIGN_ correspond to the following parameters: padding algorithm, modulus bit length, and digest algorithm.

For PSS, the salt length used is equal to the length of digest algorithm. For example, RSA_SIGN_PSS_2048_SHA256 will use PSS with a salt length of 256 bits or 32 bytes.

Algorithms beginning with RSA_DECRYPT_ are usable with CryptoKey.purpose ASYMMETRIC_DECRYPT.

The fields in the name after RSA_DECRYPT_ correspond to the following parameters: padding algorithm, modulus bit length, and digest algorithm.

Algorithms beginning with EC_SIGN_ are usable with CryptoKey.purpose ASYMMETRIC_SIGN.

The fields in the name after EC_SIGN_ correspond to the following parameters: elliptic curve, digest algorithm.

Algorithms beginning with HMAC_ are usable with CryptoKey.purpose MAC.

The suffix following HMAC_ corresponds to the hash algorithm being used (eg. SHA256).

For more information, see Key purposes and algorithms.

Values: CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED (0): Not specified. GOOGLE_SYMMETRIC_ENCRYPTION (1): Creates symmetric encryption keys. AES_128_GCM (41): AES-GCM (Galois Counter Mode) using 128-bit keys. AES_256_GCM (19): AES-GCM (Galois Counter Mode) using 256-bit keys. AES_128_CBC (42): AES-CBC (Cipher Block Chaining Mode) using 128-bit keys. AES_256_CBC (43): AES-CBC (Cipher Block Chaining Mode) using 256-bit keys. AES_128_CTR (44): AES-CTR (Counter Mode) using 128-bit keys. AES_256_CTR (45): AES-CTR (Counter Mode) using 256-bit keys. RSA_SIGN_PSS_2048_SHA256 (2): RSASSA-PSS 2048 bit key with a SHA256 digest. RSA_SIGN_PSS_3072_SHA256 (3): RSASSA-PSS 3072 bit key with a SHA256 digest. RSA_SIGN_PSS_4096_SHA256 (4): RSASSA-PSS 4096 bit key with a SHA256 digest. RSA_SIGN_PSS_4096_SHA512 (15): RSASSA-PSS 4096 bit key with a SHA512 digest. RSA_SIGN_PKCS1_2048_SHA256 (5): RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. RSA_SIGN_PKCS1_3072_SHA256 (6): RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. RSA_SIGN_PKCS1_4096_SHA256 (7): RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. RSA_SIGN_PKCS1_4096_SHA512 (16): RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest. RSA_SIGN_RAW_PKCS1_2048 (28): RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key. RSA_SIGN_RAW_PKCS1_3072 (29): RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key. RSA_SIGN_RAW_PKCS1_4096 (30): RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key. RSA_DECRYPT_OAEP_2048_SHA256 (8): RSAES-OAEP 2048 bit key with a SHA256 digest. RSA_DECRYPT_OAEP_3072_SHA256 (9): RSAES-OAEP 3072 bit key with a SHA256 digest. RSA_DECRYPT_OAEP_4096_SHA256 (10): RSAES-OAEP 4096 bit key with a SHA256 digest. RSA_DECRYPT_OAEP_4096_SHA512 (17): RSAES-OAEP 4096 bit key with a SHA512 digest. RSA_DECRYPT_OAEP_2048_SHA1 (37): RSAES-OAEP 2048 bit key with a SHA1 digest. RSA_DECRYPT_OAEP_3072_SHA1 (38): RSAES-OAEP 3072 bit key with a SHA1 digest. RSA_DECRYPT_OAEP_4096_SHA1 (39): RSAES-OAEP 4096 bit key with a SHA1 digest. EC_SIGN_P256_SHA256 (12): ECDSA on the NIST P-256 curve with a SHA256 digest. Other hash functions can also be used: https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms EC_SIGN_P384_SHA384 (13): ECDSA on the NIST P-384 curve with a SHA384 digest. Other hash functions can also be used: https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms EC_SIGN_SECP256K1_SHA256 (31): ECDSA on the non-NIST secp256k1 curve. This curve is only supported for HSM protection level. Other hash functions can also be used: https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms HMAC_SHA256 (32): HMAC-SHA256 signing with a 256 bit key. HMAC_SHA1 (33): HMAC-SHA1 signing with a 160 bit key. HMAC_SHA384 (34): HMAC-SHA384 signing with a 384 bit key. HMAC_SHA512 (35): HMAC-SHA512 signing with a 512 bit key. HMAC_SHA224 (36): HMAC-SHA224 signing with a 224 bit key. EXTERNAL_SYMMETRIC_ENCRYPTION (18): Algorithm representing symmetric encryption by an external key manager.

CryptoKeyVersionState

CryptoKeyVersionState(value)

The state of a CryptoKeyVersion, indicating if it can be used.

Values: CRYPTO_KEY_VERSION_STATE_UNSPECIFIED (0): Not specified. PENDING_GENERATION (5): This version is still being generated. It may not be used, enabled, disabled, or destroyed yet. Cloud KMS will automatically mark this version ENABLED as soon as the version is ready. ENABLED (1): This version may be used for cryptographic operations. DISABLED (2): This version may not be used, but the key material is still available, and the version can be placed back into the ENABLED state. DESTROYED (3): This version is destroyed, and the key material is no longer stored. This version may only become ENABLED again if this version is reimport_eligible and the original key material is reimported with a call to KeyManagementService.ImportCryptoKeyVersion. DESTROY_SCHEDULED (4): This version is scheduled for destruction, and will be destroyed soon. Call RestoreCryptoKeyVersion to put it back into the DISABLED state. PENDING_IMPORT (6): This version is still being imported. It may not be used, enabled, disabled, or destroyed yet. Cloud KMS will automatically mark this version ENABLED as soon as the version is ready. IMPORT_FAILED (7): This version was not imported successfully. It may not be used, enabled, disabled, or destroyed. The submitted key material has been discarded. Additional details can be found in CryptoKeyVersion.import_failure_reason. GENERATION_FAILED (8): This version was not generated successfully. It may not be used, enabled, disabled, or destroyed. Additional details can be found in CryptoKeyVersion.generation_failure_reason. PENDING_EXTERNAL_DESTRUCTION (9): This version was destroyed, and it may not be used or enabled again. Cloud KMS is waiting for the corresponding key material residing in an external key manager to be destroyed. EXTERNAL_DESTRUCTION_FAILED (10): This version was destroyed, and it may not be used or enabled again. However, Cloud KMS could not confirm that the corresponding key material residing in an external key manager was destroyed. Additional details can be found in CryptoKeyVersion.external_destruction_failure_reason.

CryptoKeyVersionView

CryptoKeyVersionView(value)

A view for CryptoKeyVersions. Controls the level of detail returned for CryptoKeyVersions in KeyManagementService.ListCryptoKeyVersions and KeyManagementService.ListCryptoKeys.

Values: CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED (0): Default view for each CryptoKeyVersion. Does not include the attestation field. FULL (1): Provides all fields in each CryptoKeyVersion, including the attestation.