Class CryptoKeyVersion (2.58.0)

public final class CryptoKeyVersion extends GeneratedMessageV3 implements CryptoKeyVersionOrBuilder

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.

Protobuf type google.cloud.kms.v1.CryptoKeyVersion

Static Fields

ALGORITHM_FIELD_NUMBER

public static final int ALGORITHM_FIELD_NUMBER
Field Value
Type Description
int

ATTESTATION_FIELD_NUMBER

public static final int ATTESTATION_FIELD_NUMBER
Field Value
Type Description
int

CREATE_TIME_FIELD_NUMBER

public static final int CREATE_TIME_FIELD_NUMBER
Field Value
Type Description
int

DESTROY_EVENT_TIME_FIELD_NUMBER

public static final int DESTROY_EVENT_TIME_FIELD_NUMBER
Field Value
Type Description
int

DESTROY_TIME_FIELD_NUMBER

public static final int DESTROY_TIME_FIELD_NUMBER
Field Value
Type Description
int

EXTERNAL_DESTRUCTION_FAILURE_REASON_FIELD_NUMBER

public static final int EXTERNAL_DESTRUCTION_FAILURE_REASON_FIELD_NUMBER
Field Value
Type Description
int

EXTERNAL_PROTECTION_LEVEL_OPTIONS_FIELD_NUMBER

public static final int EXTERNAL_PROTECTION_LEVEL_OPTIONS_FIELD_NUMBER
Field Value
Type Description
int

GENERATE_TIME_FIELD_NUMBER

public static final int GENERATE_TIME_FIELD_NUMBER
Field Value
Type Description
int

GENERATION_FAILURE_REASON_FIELD_NUMBER

public static final int GENERATION_FAILURE_REASON_FIELD_NUMBER
Field Value
Type Description
int

IMPORT_FAILURE_REASON_FIELD_NUMBER

public static final int IMPORT_FAILURE_REASON_FIELD_NUMBER
Field Value
Type Description
int

IMPORT_JOB_FIELD_NUMBER

public static final int IMPORT_JOB_FIELD_NUMBER
Field Value
Type Description
int

IMPORT_TIME_FIELD_NUMBER

public static final int IMPORT_TIME_FIELD_NUMBER
Field Value
Type Description
int

NAME_FIELD_NUMBER

public static final int NAME_FIELD_NUMBER
Field Value
Type Description
int

PROTECTION_LEVEL_FIELD_NUMBER

public static final int PROTECTION_LEVEL_FIELD_NUMBER
Field Value
Type Description
int

REIMPORT_ELIGIBLE_FIELD_NUMBER

public static final int REIMPORT_ELIGIBLE_FIELD_NUMBER
Field Value
Type Description
int

STATE_FIELD_NUMBER

public static final int STATE_FIELD_NUMBER
Field Value
Type Description
int

Static Methods

getDefaultInstance()

public static CryptoKeyVersion getDefaultInstance()
Returns
Type Description
CryptoKeyVersion

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

newBuilder()

public static CryptoKeyVersion.Builder newBuilder()
Returns
Type Description
CryptoKeyVersion.Builder

newBuilder(CryptoKeyVersion prototype)

public static CryptoKeyVersion.Builder newBuilder(CryptoKeyVersion prototype)
Parameter
Name Description
prototype CryptoKeyVersion
Returns
Type Description
CryptoKeyVersion.Builder

parseDelimitedFrom(InputStream input)

public static CryptoKeyVersion parseDelimitedFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static CryptoKeyVersion parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
IOException

parseFrom(byte[] data)

public static CryptoKeyVersion parseFrom(byte[] data)
Parameter
Name Description
data byte[]
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static CryptoKeyVersion parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data byte[]
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data)

public static CryptoKeyVersion parseFrom(ByteString data)
Parameter
Name Description
data ByteString
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static CryptoKeyVersion parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteString
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static CryptoKeyVersion parseFrom(CodedInputStream input)
Parameter
Name Description
input CodedInputStream
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static CryptoKeyVersion parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
IOException

parseFrom(InputStream input)

public static CryptoKeyVersion parseFrom(InputStream input)
Parameter
Name Description
input InputStream
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static CryptoKeyVersion parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input InputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
IOException

parseFrom(ByteBuffer data)

public static CryptoKeyVersion parseFrom(ByteBuffer data)
Parameter
Name Description
data ByteBuffer
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static CryptoKeyVersion parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
data ByteBuffer
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKeyVersion
Exceptions
Type Description
InvalidProtocolBufferException

parser()

public static Parser<CryptoKeyVersion> parser()
Returns
Type Description
Parser<CryptoKeyVersion>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAlgorithm()

public CryptoKeyVersion.CryptoKeyVersionAlgorithm getAlgorithm()

Output only. The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CryptoKeyVersion.CryptoKeyVersionAlgorithm

The algorithm.

getAlgorithmValue()

public int getAlgorithmValue()

Output only. The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for algorithm.

getAttestation()

public KeyOperationAttestation getAttestation()

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.

.google.cloud.kms.v1.KeyOperationAttestation attestation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
KeyOperationAttestation

The attestation.

getAttestationOrBuilder()

public KeyOperationAttestationOrBuilder getAttestationOrBuilder()

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.

.google.cloud.kms.v1.KeyOperationAttestation attestation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
KeyOperationAttestationOrBuilder

getCreateTime()

public Timestamp getCreateTime()

Output only. The time at which this CryptoKeyVersion was created.

.google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The createTime.

getCreateTimeOrBuilder()

public TimestampOrBuilder getCreateTimeOrBuilder()

Output only. The time at which this CryptoKeyVersion was created.

.google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getDefaultInstanceForType()

public CryptoKeyVersion getDefaultInstanceForType()
Returns
Type Description
CryptoKeyVersion

getDestroyEventTime()

public Timestamp getDestroyEventTime()

Output only. The time this CryptoKeyVersion's key material was destroyed. Only present if state is DESTROYED.

.google.protobuf.Timestamp destroy_event_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The destroyEventTime.

getDestroyEventTimeOrBuilder()

public TimestampOrBuilder getDestroyEventTimeOrBuilder()

Output only. The time this CryptoKeyVersion's key material was destroyed. Only present if state is DESTROYED.

.google.protobuf.Timestamp destroy_event_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getDestroyTime()

public Timestamp getDestroyTime()

Output only. The time this CryptoKeyVersion's key material is scheduled for destruction. Only present if state is DESTROY_SCHEDULED.

.google.protobuf.Timestamp destroy_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The destroyTime.

getDestroyTimeOrBuilder()

public TimestampOrBuilder getDestroyTimeOrBuilder()

Output only. The time this CryptoKeyVersion's key material is scheduled for destruction. Only present if state is DESTROY_SCHEDULED.

.google.protobuf.Timestamp destroy_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getExternalDestructionFailureReason()

public String getExternalDestructionFailureReason()

Output only. The root cause of the most recent external destruction failure. Only present if state is EXTERNAL_DESTRUCTION_FAILED.

string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The externalDestructionFailureReason.

getExternalDestructionFailureReasonBytes()

public ByteString getExternalDestructionFailureReasonBytes()

Output only. The root cause of the most recent external destruction failure. Only present if state is EXTERNAL_DESTRUCTION_FAILED.

string external_destruction_failure_reason = 20 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for externalDestructionFailureReason.

getExternalProtectionLevelOptions()

public ExternalProtectionLevelOptions getExternalProtectionLevelOptions()

ExternalProtectionLevelOptions stores a group of additional fields for configuring a CryptoKeyVersion that are specific to the EXTERNAL protection level and EXTERNAL_VPC protection levels.

.google.cloud.kms.v1.ExternalProtectionLevelOptions external_protection_level_options = 17;

Returns
Type Description
ExternalProtectionLevelOptions

The externalProtectionLevelOptions.

getExternalProtectionLevelOptionsOrBuilder()

public ExternalProtectionLevelOptionsOrBuilder getExternalProtectionLevelOptionsOrBuilder()

ExternalProtectionLevelOptions stores a group of additional fields for configuring a CryptoKeyVersion that are specific to the EXTERNAL protection level and EXTERNAL_VPC protection levels.

.google.cloud.kms.v1.ExternalProtectionLevelOptions external_protection_level_options = 17;

Returns
Type Description
ExternalProtectionLevelOptionsOrBuilder

getGenerateTime()

public Timestamp getGenerateTime()

Output only. The time this CryptoKeyVersion's key material was generated.

.google.protobuf.Timestamp generate_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The generateTime.

getGenerateTimeOrBuilder()

public TimestampOrBuilder getGenerateTimeOrBuilder()

Output only. The time this CryptoKeyVersion's key material was generated.

.google.protobuf.Timestamp generate_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getGenerationFailureReason()

public String getGenerationFailureReason()

Output only. The root cause of the most recent generation failure. Only present if state is GENERATION_FAILED.

string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The generationFailureReason.

getGenerationFailureReasonBytes()

public ByteString getGenerationFailureReasonBytes()

Output only. The root cause of the most recent generation failure. Only present if state is GENERATION_FAILED.

string generation_failure_reason = 19 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for generationFailureReason.

getImportFailureReason()

public String getImportFailureReason()

Output only. The root cause of the most recent import failure. Only present if state is IMPORT_FAILED.

string import_failure_reason = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The importFailureReason.

getImportFailureReasonBytes()

public ByteString getImportFailureReasonBytes()

Output only. The root cause of the most recent import failure. Only present if state is IMPORT_FAILED.

string import_failure_reason = 16 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for importFailureReason.

getImportJob()

public String getImportJob()

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.

string import_job = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The importJob.

getImportJobBytes()

public ByteString getImportJobBytes()

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.

string import_job = 14 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for importJob.

getImportTime()

public Timestamp getImportTime()

Output only. The time at which this CryptoKeyVersion's key material was most recently imported.

.google.protobuf.Timestamp import_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
Timestamp

The importTime.

getImportTimeOrBuilder()

public TimestampOrBuilder getImportTimeOrBuilder()

Output only. The time at which this CryptoKeyVersion's key material was most recently imported.

.google.protobuf.Timestamp import_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
TimestampOrBuilder

getName()

public String getName()

Output only. The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*.

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

Output only. The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*.

string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ByteString

The bytes for name.

getParserForType()

public Parser<CryptoKeyVersion> getParserForType()
Returns
Type Description
Parser<CryptoKeyVersion>
Overrides

getProtectionLevel()

public ProtectionLevel getProtectionLevel()

Output only. The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion.

.google.cloud.kms.v1.ProtectionLevel protection_level = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
ProtectionLevel

The protectionLevel.

getProtectionLevelValue()

public int getProtectionLevelValue()

Output only. The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion.

.google.cloud.kms.v1.ProtectionLevel protection_level = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
int

The enum numeric value on the wire for protectionLevel.

getReimportEligible()

public boolean getReimportEligible()

Output only. Whether or not this key version is eligible for reimport, by being specified as a target in ImportCryptoKeyVersionRequest.crypto_key_version.

bool reimport_eligible = 18 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

The reimportEligible.

getSerializedSize()

public int getSerializedSize()
Returns
Type Description
int
Overrides

getState()

public CryptoKeyVersion.CryptoKeyVersionState getState()

The current state of the CryptoKeyVersion.

.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3;

Returns
Type Description
CryptoKeyVersion.CryptoKeyVersionState

The state.

getStateValue()

public int getStateValue()

The current state of the CryptoKeyVersion.

.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState state = 3;

Returns
Type Description
int

The enum numeric value on the wire for state.

hasAttestation()

public boolean hasAttestation()

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.

.google.cloud.kms.v1.KeyOperationAttestation attestation = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the attestation field is set.

hasCreateTime()

public boolean hasCreateTime()

Output only. The time at which this CryptoKeyVersion was created.

.google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the createTime field is set.

hasDestroyEventTime()

public boolean hasDestroyEventTime()

Output only. The time this CryptoKeyVersion's key material was destroyed. Only present if state is DESTROYED.

.google.protobuf.Timestamp destroy_event_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the destroyEventTime field is set.

hasDestroyTime()

public boolean hasDestroyTime()

Output only. The time this CryptoKeyVersion's key material is scheduled for destruction. Only present if state is DESTROY_SCHEDULED.

.google.protobuf.Timestamp destroy_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the destroyTime field is set.

hasExternalProtectionLevelOptions()

public boolean hasExternalProtectionLevelOptions()

ExternalProtectionLevelOptions stores a group of additional fields for configuring a CryptoKeyVersion that are specific to the EXTERNAL protection level and EXTERNAL_VPC protection levels.

.google.cloud.kms.v1.ExternalProtectionLevelOptions external_protection_level_options = 17;

Returns
Type Description
boolean

Whether the externalProtectionLevelOptions field is set.

hasGenerateTime()

public boolean hasGenerateTime()

Output only. The time this CryptoKeyVersion's key material was generated.

.google.protobuf.Timestamp generate_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the generateTime field is set.

hasImportTime()

public boolean hasImportTime()

Output only. The time at which this CryptoKeyVersion's key material was most recently imported.

.google.protobuf.Timestamp import_time = 15 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the importTime field is set.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

newBuilderForType()

public CryptoKeyVersion.Builder newBuilderForType()
Returns
Type Description
CryptoKeyVersion.Builder

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected CryptoKeyVersion.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Name Description
parent BuilderParent
Returns
Type Description
CryptoKeyVersion.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Name Description
unused UnusedPrivateParameter
Returns
Type Description
Object
Overrides

toBuilder()

public CryptoKeyVersion.Builder toBuilder()
Returns
Type Description
CryptoKeyVersion.Builder

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
Name Description
output CodedOutputStream
Overrides
Exceptions
Type Description
IOException