Reference documentation and code samples for the Cloud Key Management Service (KMS) V1 API class Google::Cloud::Kms::V1::KeyManagementService::Client.
Client for the KeyManagementService service.
Google Cloud Key Management Service
Manages cryptographic keys and operations using those keys. Implements a REST model with the following objects:
If you are using manual gRPC libraries, see Using gRPC with Cloud KMS.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the KeyManagementService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all KeyManagementService clients ::Google::Cloud::Kms::V1::KeyManagementService::Client.configure do |config| config.timeout = 10.0 end
#asymmetric_decrypt
def asymmetric_decrypt(request, options = nil) -> ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse
def asymmetric_decrypt(name: nil, ciphertext: nil, ciphertext_crc32c: nil) -> ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse
Decrypts data that was encrypted with a public key retrieved from GetPublicKey corresponding to a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_DECRYPT.
def asymmetric_decrypt(request, options = nil) -> ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse
asymmetric_decrypt
via a request object, either of type
AsymmetricDecryptRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::AsymmetricDecryptRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def asymmetric_decrypt(name: nil, ciphertext: nil, ciphertext_crc32c: nil) -> ::Google::Cloud::Kms::V1::AsymmetricDecryptResponse
asymmetric_decrypt
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKeyVersion to use for decryption.
- ciphertext (::String) — Required. The data encrypted with the named CryptoKeyVersion's public key using OAEP.
- ciphertext_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the AsymmetricDecryptRequest.ciphertext. If specified, KeyManagementService will verify the integrity of the received AsymmetricDecryptRequest.ciphertext using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(AsymmetricDecryptRequest.ciphertext) is equal to AsymmetricDecryptRequest.ciphertext_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::AsymmetricDecryptResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::AsymmetricDecryptRequest.new # Call the asymmetric_decrypt method. result = client.asymmetric_decrypt request # The returned object is of type Google::Cloud::Kms::V1::AsymmetricDecryptResponse. p result
#asymmetric_sign
def asymmetric_sign(request, options = nil) -> ::Google::Cloud::Kms::V1::AsymmetricSignResponse
def asymmetric_sign(name: nil, digest: nil, digest_crc32c: nil, data: nil, data_crc32c: nil) -> ::Google::Cloud::Kms::V1::AsymmetricSignResponse
Signs data using a CryptoKeyVersion with CryptoKey.purpose ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from GetPublicKey.
def asymmetric_sign(request, options = nil) -> ::Google::Cloud::Kms::V1::AsymmetricSignResponse
asymmetric_sign
via a request object, either of type
AsymmetricSignRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::AsymmetricSignRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def asymmetric_sign(name: nil, digest: nil, digest_crc32c: nil, data: nil, data_crc32c: nil) -> ::Google::Cloud::Kms::V1::AsymmetricSignResponse
asymmetric_sign
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKeyVersion to use for signing.
-
digest (::Google::Cloud::Kms::V1::Digest, ::Hash) — Optional. The digest of the data to sign. The digest must be produced with
the same digest algorithm as specified by the key version's
algorithm.
This field may not be supplied if AsymmetricSignRequest.data is supplied.
- digest_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the AsymmetricSignRequest.digest. If specified, KeyManagementService will verify the integrity of the received AsymmetricSignRequest.digest using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(AsymmetricSignRequest.digest) is equal to AsymmetricSignRequest.digest_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- data (::String) — Optional. The data to sign. It can't be supplied if AsymmetricSignRequest.digest is supplied.
- data_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the AsymmetricSignRequest.data. If specified, KeyManagementService will verify the integrity of the received AsymmetricSignRequest.data using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(AsymmetricSignRequest.data) is equal to AsymmetricSignRequest.data_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::AsymmetricSignResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::AsymmetricSignRequest.new # Call the asymmetric_sign method. result = client.asymmetric_sign request # The returned object is of type Google::Cloud::Kms::V1::AsymmetricSignResponse. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the KeyManagementService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_crypto_key
def create_crypto_key(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
def create_crypto_key(parent: nil, crypto_key_id: nil, crypto_key: nil, skip_initial_version_creation: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
Create a new CryptoKey within a KeyRing.
CryptoKey.purpose and CryptoKey.version_template.algorithm are required.
def create_crypto_key(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
create_crypto_key
via a request object, either of type
CreateCryptoKeyRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::CreateCryptoKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_crypto_key(parent: nil, crypto_key_id: nil, crypto_key: nil, skip_initial_version_creation: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
create_crypto_key
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The name of the KeyRing associated with the CryptoKeys.
-
crypto_key_id (::String) — Required. It must be unique within a KeyRing and match the regular
expression
[a-zA-Z0-9_-]{1,63}
- crypto_key (::Google::Cloud::Kms::V1::CryptoKey, ::Hash) — Required. A CryptoKey with initial field values.
- skip_initial_version_creation (::Boolean) — If set to true, the request will create a CryptoKey without any CryptoKeyVersions. You must manually call CreateCryptoKeyVersion or ImportCryptoKeyVersion before you can use this CryptoKey.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKey)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::CreateCryptoKeyRequest.new # Call the create_crypto_key method. result = client.create_crypto_key request # The returned object is of type Google::Cloud::Kms::V1::CryptoKey. p result
#create_crypto_key_version
def create_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
def create_crypto_key_version(parent: nil, crypto_key_version: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
Create a new CryptoKeyVersion in a CryptoKey.
The server will assign the next sequential id. If unset, state will be set to ENABLED.
def create_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
create_crypto_key_version
via a request object, either of type
CreateCryptoKeyVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::CreateCryptoKeyVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_crypto_key_version(parent: nil, crypto_key_version: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
create_crypto_key_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The name of the CryptoKey associated with the CryptoKeyVersions.
- crypto_key_version (::Google::Cloud::Kms::V1::CryptoKeyVersion, ::Hash) — Required. A CryptoKeyVersion with initial field values.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKeyVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::CreateCryptoKeyVersionRequest.new # Call the create_crypto_key_version method. result = client.create_crypto_key_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKeyVersion. p result
#create_import_job
def create_import_job(request, options = nil) -> ::Google::Cloud::Kms::V1::ImportJob
def create_import_job(parent: nil, import_job_id: nil, import_job: nil) -> ::Google::Cloud::Kms::V1::ImportJob
def create_import_job(request, options = nil) -> ::Google::Cloud::Kms::V1::ImportJob
create_import_job
via a request object, either of type
CreateImportJobRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::CreateImportJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_import_job(parent: nil, import_job_id: nil, import_job: nil) -> ::Google::Cloud::Kms::V1::ImportJob
create_import_job
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- parent (::String) — Required. The name of the KeyRing associated with the ImportJobs.
-
import_job_id (::String) — Required. It must be unique within a KeyRing and match the regular
expression
[a-zA-Z0-9_-]{1,63}
- import_job (::Google::Cloud::Kms::V1::ImportJob, ::Hash) — Required. An ImportJob with initial field values.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::ImportJob)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::CreateImportJobRequest.new # Call the create_import_job method. result = client.create_import_job request # The returned object is of type Google::Cloud::Kms::V1::ImportJob. p result
#create_key_ring
def create_key_ring(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyRing
def create_key_ring(parent: nil, key_ring_id: nil, key_ring: nil) -> ::Google::Cloud::Kms::V1::KeyRing
Create a new KeyRing in a given Project and Location.
def create_key_ring(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyRing
create_key_ring
via a request object, either of type
CreateKeyRingRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::CreateKeyRingRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_key_ring(parent: nil, key_ring_id: nil, key_ring: nil) -> ::Google::Cloud::Kms::V1::KeyRing
create_key_ring
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the location associated with the
KeyRings, in the format
projects/*/locations/*
. -
key_ring_id (::String) — Required. It must be unique within a location and match the regular
expression
[a-zA-Z0-9_-]{1,63}
- key_ring (::Google::Cloud::Kms::V1::KeyRing, ::Hash) — Required. A KeyRing with initial field values.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::KeyRing)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::CreateKeyRingRequest.new # Call the create_key_ring method. result = client.create_key_ring request # The returned object is of type Google::Cloud::Kms::V1::KeyRing. p result
#decrypt
def decrypt(request, options = nil) -> ::Google::Cloud::Kms::V1::DecryptResponse
def decrypt(name: nil, ciphertext: nil, additional_authenticated_data: nil, ciphertext_crc32c: nil, additional_authenticated_data_crc32c: nil) -> ::Google::Cloud::Kms::V1::DecryptResponse
Decrypts data that was protected by Encrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT.
def decrypt(request, options = nil) -> ::Google::Cloud::Kms::V1::DecryptResponse
decrypt
via a request object, either of type
DecryptRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::DecryptRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def decrypt(name: nil, ciphertext: nil, additional_authenticated_data: nil, ciphertext_crc32c: nil, additional_authenticated_data_crc32c: nil) -> ::Google::Cloud::Kms::V1::DecryptResponse
decrypt
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKey to use for decryption. The server will choose the appropriate version.
- ciphertext (::String) — Required. The encrypted data originally returned in EncryptResponse.ciphertext.
- additional_authenticated_data (::String) — Optional. Optional data that must match the data originally supplied in EncryptRequest.additional_authenticated_data.
- ciphertext_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the DecryptRequest.ciphertext. If specified, KeyManagementService will verify the integrity of the received DecryptRequest.ciphertext using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(DecryptRequest.ciphertext) is equal to DecryptRequest.ciphertext_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- additional_authenticated_data_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the DecryptRequest.additional_authenticated_data. If specified, KeyManagementService will verify the integrity of the received DecryptRequest.additional_authenticated_data using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(DecryptRequest.additional_authenticated_data) is equal to DecryptRequest.additional_authenticated_data_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::DecryptResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::DecryptRequest.new # Call the decrypt method. result = client.decrypt request # The returned object is of type Google::Cloud::Kms::V1::DecryptResponse. p result
#destroy_crypto_key_version
def destroy_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
def destroy_crypto_key_version(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
Schedule a CryptoKeyVersion for destruction.
Upon calling this method, CryptoKeyVersion.state will be set to DESTROY_SCHEDULED, and destroy_time will be set to the time destroy_scheduled_duration in the future. At that time, the state will automatically change to DESTROYED, and the key material will be irrevocably destroyed.
Before the destroy_time is reached, RestoreCryptoKeyVersion may be called to reverse the process.
def destroy_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
destroy_crypto_key_version
via a request object, either of type
DestroyCryptoKeyVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::DestroyCryptoKeyVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def destroy_crypto_key_version(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
destroy_crypto_key_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKeyVersion to destroy.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKeyVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::DestroyCryptoKeyVersionRequest.new # Call the destroy_crypto_key_version method. result = client.destroy_crypto_key_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKeyVersion. p result
#encrypt
def encrypt(request, options = nil) -> ::Google::Cloud::Kms::V1::EncryptResponse
def encrypt(name: nil, plaintext: nil, additional_authenticated_data: nil, plaintext_crc32c: nil, additional_authenticated_data_crc32c: nil) -> ::Google::Cloud::Kms::V1::EncryptResponse
Encrypts data, so that it can only be recovered by a call to Decrypt. The CryptoKey.purpose must be ENCRYPT_DECRYPT.
def encrypt(request, options = nil) -> ::Google::Cloud::Kms::V1::EncryptResponse
encrypt
via a request object, either of type
EncryptRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::EncryptRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def encrypt(name: nil, plaintext: nil, additional_authenticated_data: nil, plaintext_crc32c: nil, additional_authenticated_data_crc32c: nil) -> ::Google::Cloud::Kms::V1::EncryptResponse
encrypt
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The resource name of the
CryptoKey or
CryptoKeyVersion to use for
encryption.
If a CryptoKey is specified, the server will use its primary version.
-
plaintext (::String) — Required. The data to encrypt. Must be no larger than 64KiB.
The maximum size depends on the key version's protection_level. For SOFTWARE, EXTERNAL, and EXTERNAL_VPC keys, the plaintext must be no larger than 64KiB. For HSM keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.
-
additional_authenticated_data (::String) — Optional. Optional data that, if specified, must also be provided during
decryption through
DecryptRequest.additional_authenticated_data.
The maximum size depends on the key version's protection_level. For SOFTWARE, EXTERNAL, and EXTERNAL_VPC keys the AAD must be no larger than 64KiB. For HSM keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.
- plaintext_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the EncryptRequest.plaintext. If specified, KeyManagementService will verify the integrity of the received EncryptRequest.plaintext using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(EncryptRequest.plaintext) is equal to EncryptRequest.plaintext_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- additional_authenticated_data_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the EncryptRequest.additional_authenticated_data. If specified, KeyManagementService will verify the integrity of the received EncryptRequest.additional_authenticated_data using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(EncryptRequest.additional_authenticated_data) is equal to EncryptRequest.additional_authenticated_data_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::EncryptResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::EncryptRequest.new # Call the encrypt method. result = client.encrypt request # The returned object is of type Google::Cloud::Kms::V1::EncryptResponse. p result
#generate_random_bytes
def generate_random_bytes(request, options = nil) -> ::Google::Cloud::Kms::V1::GenerateRandomBytesResponse
def generate_random_bytes(location: nil, length_bytes: nil, protection_level: nil) -> ::Google::Cloud::Kms::V1::GenerateRandomBytesResponse
Generate random bytes using the Cloud KMS randomness source in the provided location.
def generate_random_bytes(request, options = nil) -> ::Google::Cloud::Kms::V1::GenerateRandomBytesResponse
generate_random_bytes
via a request object, either of type
GenerateRandomBytesRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GenerateRandomBytesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def generate_random_bytes(location: nil, length_bytes: nil, protection_level: nil) -> ::Google::Cloud::Kms::V1::GenerateRandomBytesResponse
generate_random_bytes
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- location (::String) — The project-specific location in which to generate random bytes. For example, "projects/my-project/locations/us-central1".
- length_bytes (::Integer) — The length in bytes of the amount of randomness to retrieve. Minimum 8 bytes, maximum 1024 bytes.
- protection_level (::Google::Cloud::Kms::V1::ProtectionLevel) — The ProtectionLevel to use when generating the random data. Currently, only HSM protection level is supported.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::GenerateRandomBytesResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GenerateRandomBytesRequest.new # Call the generate_random_bytes method. result = client.generate_random_bytes request # The returned object is of type Google::Cloud::Kms::V1::GenerateRandomBytesResponse. p result
#get_crypto_key
def get_crypto_key(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
def get_crypto_key(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
Returns metadata for a given CryptoKey, as well as its primary CryptoKeyVersion.
def get_crypto_key(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
get_crypto_key
via a request object, either of type
GetCryptoKeyRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GetCryptoKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_crypto_key(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
get_crypto_key
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKey)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GetCryptoKeyRequest.new # Call the get_crypto_key method. result = client.get_crypto_key request # The returned object is of type Google::Cloud::Kms::V1::CryptoKey. p result
#get_crypto_key_version
def get_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
def get_crypto_key_version(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
Returns metadata for a given CryptoKeyVersion.
def get_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
get_crypto_key_version
via a request object, either of type
GetCryptoKeyVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GetCryptoKeyVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_crypto_key_version(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
get_crypto_key_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the CryptoKeyVersion to get.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKeyVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GetCryptoKeyVersionRequest.new # Call the get_crypto_key_version method. result = client.get_crypto_key_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKeyVersion. p result
#get_import_job
def get_import_job(request, options = nil) -> ::Google::Cloud::Kms::V1::ImportJob
def get_import_job(name: nil) -> ::Google::Cloud::Kms::V1::ImportJob
Returns metadata for a given ImportJob.
def get_import_job(request, options = nil) -> ::Google::Cloud::Kms::V1::ImportJob
get_import_job
via a request object, either of type
GetImportJobRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GetImportJobRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_import_job(name: nil) -> ::Google::Cloud::Kms::V1::ImportJob
get_import_job
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::ImportJob)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GetImportJobRequest.new # Call the get_import_job method. result = client.get_import_job request # The returned object is of type Google::Cloud::Kms::V1::ImportJob. p result
#get_key_ring
def get_key_ring(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyRing
def get_key_ring(name: nil) -> ::Google::Cloud::Kms::V1::KeyRing
Returns metadata for a given KeyRing.
def get_key_ring(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyRing
get_key_ring
via a request object, either of type
GetKeyRingRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GetKeyRingRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_key_ring(name: nil) -> ::Google::Cloud::Kms::V1::KeyRing
get_key_ring
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::KeyRing)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GetKeyRingRequest.new # Call the get_key_ring method. result = client.get_key_ring request # The returned object is of type Google::Cloud::Kms::V1::KeyRing. p result
#get_public_key
def get_public_key(request, options = nil) -> ::Google::Cloud::Kms::V1::PublicKey
def get_public_key(name: nil) -> ::Google::Cloud::Kms::V1::PublicKey
Returns the public key for the given CryptoKeyVersion. The CryptoKey.purpose must be ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT.
def get_public_key(request, options = nil) -> ::Google::Cloud::Kms::V1::PublicKey
get_public_key
via a request object, either of type
GetPublicKeyRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GetPublicKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_public_key(name: nil) -> ::Google::Cloud::Kms::V1::PublicKey
get_public_key
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The name of the CryptoKeyVersion public key to get.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::PublicKey)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GetPublicKeyRequest.new # Call the get_public_key method. result = client.get_public_key request # The returned object is of type Google::Cloud::Kms::V1::PublicKey. p result
#iam_policy_client
def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client
Get the associated client for mix-in of the IAMPolicy.
- (Google::Iam::V1::IAMPolicy::Client)
#import_crypto_key_version
def import_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
def import_crypto_key_version(parent: nil, crypto_key_version: nil, algorithm: nil, import_job: nil, wrapped_key: nil, rsa_aes_wrapped_key: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
Import wrapped key material into a CryptoKeyVersion.
All requests must specify a CryptoKey. If a CryptoKeyVersion is additionally specified in the request, key material will be reimported into that version. Otherwise, a new version will be created, and will be assigned the next sequential id within the CryptoKey.
def import_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
import_crypto_key_version
via a request object, either of type
ImportCryptoKeyVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def import_crypto_key_version(parent: nil, crypto_key_version: nil, algorithm: nil, import_job: nil, wrapped_key: nil, rsa_aes_wrapped_key: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
import_crypto_key_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The name of the
CryptoKey to be imported into.
The create permission is only required on this key when creating a new CryptoKeyVersion.
-
crypto_key_version (::String) — Optional. The optional name of
an existing CryptoKeyVersion to
target for an import operation. If this field is not present, a new
CryptoKeyVersion containing the
supplied key material is created.
If this field is present, the supplied key material is imported into the existing CryptoKeyVersion. To import into an existing CryptoKeyVersion, the CryptoKeyVersion must be a child of ImportCryptoKeyVersionRequest.parent, have been previously created via [ImportCryptoKeyVersion][], and be in DESTROYED or IMPORT_FAILED state. The key material and algorithm must match the previous CryptoKeyVersion exactly if the CryptoKeyVersion has ever contained key material.
- algorithm (::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionAlgorithm) — Required. The algorithm of the key being imported. This does not need to match the version_template of the CryptoKey this version imports into.
- import_job (::String) — Required. The name of the ImportJob that was used to wrap this key material.
-
wrapped_key (::String) — Optional. The wrapped key material to import.
Before wrapping, key material must be formatted. If importing symmetric key material, the expected key material format is plain bytes. If importing asymmetric key material, the expected key material format is PKCS#8-encoded DER (the PrivateKeyInfo structure from RFC 5208).
When wrapping with import methods (RSA_OAEP_3072_SHA1_AES_256 or RSA_OAEP_4096_SHA1_AES_256 or RSA_OAEP_3072_SHA256_AES_256 or RSA_OAEP_4096_SHA256_AES_256),
this field must contain the concatenation of:
- An ephemeral AES-256 wrapping key wrapped with the public_key using RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty label.
- The formatted key to be imported, wrapped with the ephemeral AES-256 key using AES-KWP (RFC 5649).
This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP.
When wrapping with import methods (RSA_OAEP_3072_SHA256 or RSA_OAEP_4096_SHA256),
this field must contain the formatted key to be imported, wrapped with the public_key using RSAES-OAEP with SHA-256, MGF1 with SHA-256, and an empty label.
- rsa_aes_wrapped_key (::String) — Optional. This field has the same meaning as wrapped_key. Prefer to use that field in new work. Either that field or this field (but not both) must be specified.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKeyVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest.new # Call the import_crypto_key_version method. result = client.import_crypto_key_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKeyVersion. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new KeyManagementService client object.
- (config) — Configure the KeyManagementService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Kms::V1::KeyManagementService::Client.new do |config| config.timeout = 10.0 end
#list_crypto_key_versions
def list_crypto_key_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>
def list_crypto_key_versions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>
Lists CryptoKeyVersions.
def list_crypto_key_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>
list_crypto_key_versions
via a request object, either of type
ListCryptoKeyVersionsRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::ListCryptoKeyVersionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_crypto_key_versions(parent: nil, page_size: nil, page_token: nil, view: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>
list_crypto_key_versions
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the
CryptoKey to list, in the format
projects/*/locations/*/keyRings/*/cryptoKeys/*
. - page_size (::Integer) — Optional. Optional limit on the number of CryptoKeyVersions to include in the response. Further CryptoKeyVersions can subsequently be obtained by including the ListCryptoKeyVersionsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
- page_token (::String) — Optional. Optional pagination token, returned earlier via ListCryptoKeyVersionsResponse.next_page_token.
- view (::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionView) — The fields to include in the response.
- filter (::String) — Optional. Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.
- order_by (::String) — Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKeyVersion>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::ListCryptoKeyVersionsRequest.new # Call the list_crypto_key_versions method. result = client.list_crypto_key_versions request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Kms::V1::CryptoKeyVersion. p item end
#list_crypto_keys
def list_crypto_keys(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>
def list_crypto_keys(parent: nil, page_size: nil, page_token: nil, version_view: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>
Lists CryptoKeys.
def list_crypto_keys(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>
list_crypto_keys
via a request object, either of type
ListCryptoKeysRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::ListCryptoKeysRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_crypto_keys(parent: nil, page_size: nil, page_token: nil, version_view: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>
list_crypto_keys
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the KeyRing
to list, in the format
projects/*/locations/*/keyRings/*
. - page_size (::Integer) — Optional. Optional limit on the number of CryptoKeys to include in the response. Further CryptoKeys can subsequently be obtained by including the ListCryptoKeysResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
- page_token (::String) — Optional. Optional pagination token, returned earlier via ListCryptoKeysResponse.next_page_token.
- version_view (::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionView) — The fields of the primary version to include in the response.
- filter (::String) — Optional. Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.
- order_by (::String) — Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::CryptoKey>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::ListCryptoKeysRequest.new # Call the list_crypto_keys method. result = client.list_crypto_keys request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Kms::V1::CryptoKey. p item end
#list_import_jobs
def list_import_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>
def list_import_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>
Lists ImportJobs.
def list_import_jobs(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>
list_import_jobs
via a request object, either of type
ListImportJobsRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::ListImportJobsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_import_jobs(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>
list_import_jobs
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the KeyRing
to list, in the format
projects/*/locations/*/keyRings/*
. - page_size (::Integer) — Optional. Optional limit on the number of ImportJobs to include in the response. Further ImportJobs can subsequently be obtained by including the ListImportJobsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
- page_token (::String) — Optional. Optional pagination token, returned earlier via ListImportJobsResponse.next_page_token.
- filter (::String) — Optional. Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.
- order_by (::String) — Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::ImportJob>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::ListImportJobsRequest.new # Call the list_import_jobs method. result = client.list_import_jobs request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Kms::V1::ImportJob. p item end
#list_key_rings
def list_key_rings(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>
def list_key_rings(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>
Lists KeyRings.
def list_key_rings(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>
list_key_rings
via a request object, either of type
ListKeyRingsRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::ListKeyRingsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_key_rings(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>
list_key_rings
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the location associated with the
KeyRings, in the format
projects/*/locations/*
. - page_size (::Integer) — Optional. Optional limit on the number of KeyRings to include in the response. Further KeyRings can subsequently be obtained by including the ListKeyRingsResponse.next_page_token in a subsequent request. If unspecified, the server will pick an appropriate default.
- page_token (::String) — Optional. Optional pagination token, returned earlier via ListKeyRingsResponse.next_page_token.
- filter (::String) — Optional. Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.
- order_by (::String) — Optional. Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyRing>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::ListKeyRingsRequest.new # Call the list_key_rings method. result = client.list_key_rings request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Kms::V1::KeyRing. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#mac_sign
def mac_sign(request, options = nil) -> ::Google::Cloud::Kms::V1::MacSignResponse
def mac_sign(name: nil, data: nil, data_crc32c: nil) -> ::Google::Cloud::Kms::V1::MacSignResponse
Signs data using a CryptoKeyVersion with CryptoKey.purpose MAC, producing a tag that can be verified by another source with the same key.
def mac_sign(request, options = nil) -> ::Google::Cloud::Kms::V1::MacSignResponse
mac_sign
via a request object, either of type
MacSignRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::MacSignRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def mac_sign(name: nil, data: nil, data_crc32c: nil) -> ::Google::Cloud::Kms::V1::MacSignResponse
mac_sign
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKeyVersion to use for signing.
- data (::String) — Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.
- data_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the MacSignRequest.data. If specified, KeyManagementService will verify the integrity of the received MacSignRequest.data using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(MacSignRequest.data) is equal to MacSignRequest.data_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::MacSignResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::MacSignRequest.new # Call the mac_sign method. result = client.mac_sign request # The returned object is of type Google::Cloud::Kms::V1::MacSignResponse. p result
#mac_verify
def mac_verify(request, options = nil) -> ::Google::Cloud::Kms::V1::MacVerifyResponse
def mac_verify(name: nil, data: nil, data_crc32c: nil, mac: nil, mac_crc32c: nil) -> ::Google::Cloud::Kms::V1::MacVerifyResponse
Verifies MAC tag using a CryptoKeyVersion with CryptoKey.purpose MAC, and returns a response that indicates whether or not the verification was successful.
def mac_verify(request, options = nil) -> ::Google::Cloud::Kms::V1::MacVerifyResponse
mac_verify
via a request object, either of type
MacVerifyRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::MacVerifyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def mac_verify(name: nil, data: nil, data_crc32c: nil, mac: nil, mac_crc32c: nil) -> ::Google::Cloud::Kms::V1::MacVerifyResponse
mac_verify
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKeyVersion to use for verification.
- data (::String) — Required. The data used previously as a MacSignRequest.data to generate the MAC tag.
- data_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the MacVerifyRequest.data. If specified, KeyManagementService will verify the integrity of the received MacVerifyRequest.data using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C(MacVerifyRequest.data) is equal to MacVerifyRequest.data_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- mac (::String) — Required. The signature to verify.
- mac_crc32c (::Google::Protobuf::Int64Value, ::Hash) — Optional. An optional CRC32C checksum of the MacVerifyRequest.mac. If specified, KeyManagementService will verify the integrity of the received MacVerifyRequest.mac using this checksum. KeyManagementService will report an error if the checksum verification fails. If you receive a checksum error, your client should verify that CRC32C([MacVerifyRequest.tag][]) is equal to MacVerifyRequest.mac_crc32c, and if so, perform a limited number of retries. A persistent mismatch may indicate an issue in your computation of the CRC32C checksum. Note: This field is defined as int64 for reasons of compatibility across different languages. However, it is a non-negative integer, which will never exceed 2^32-1, and can be safely downconverted to uint32 in languages that support this type.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::MacVerifyResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::MacVerifyRequest.new # Call the mac_verify method. result = client.mac_verify request # The returned object is of type Google::Cloud::Kms::V1::MacVerifyResponse. p result
#restore_crypto_key_version
def restore_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
def restore_crypto_key_version(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
Restore a CryptoKeyVersion in the DESTROY_SCHEDULED state.
Upon restoration of the CryptoKeyVersion, state will be set to DISABLED, and destroy_time will be cleared.
def restore_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
restore_crypto_key_version
via a request object, either of type
RestoreCryptoKeyVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::RestoreCryptoKeyVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def restore_crypto_key_version(name: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
restore_crypto_key_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKeyVersion to restore.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKeyVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::RestoreCryptoKeyVersionRequest.new # Call the restore_crypto_key_version method. result = client.restore_crypto_key_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKeyVersion. p result
#update_crypto_key
def update_crypto_key(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
def update_crypto_key(crypto_key: nil, update_mask: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
Update a CryptoKey.
def update_crypto_key(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
update_crypto_key
via a request object, either of type
UpdateCryptoKeyRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::UpdateCryptoKeyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_crypto_key(crypto_key: nil, update_mask: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
update_crypto_key
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- crypto_key (::Google::Cloud::Kms::V1::CryptoKey, ::Hash) — Required. CryptoKey with updated values.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. List of fields to be updated in this request.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKey)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::UpdateCryptoKeyRequest.new # Call the update_crypto_key method. result = client.update_crypto_key request # The returned object is of type Google::Cloud::Kms::V1::CryptoKey. p result
#update_crypto_key_primary_version
def update_crypto_key_primary_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
def update_crypto_key_primary_version(name: nil, crypto_key_version_id: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
Update the version of a CryptoKey that will be used in Encrypt.
Returns an error if called on a key whose purpose is not ENCRYPT_DECRYPT.
def update_crypto_key_primary_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKey
update_crypto_key_primary_version
via a request object, either of type
UpdateCryptoKeyPrimaryVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::UpdateCryptoKeyPrimaryVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_crypto_key_primary_version(name: nil, crypto_key_version_id: nil) -> ::Google::Cloud::Kms::V1::CryptoKey
update_crypto_key_primary_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- name (::String) — Required. The resource name of the CryptoKey to update.
- crypto_key_version_id (::String) — Required. The id of the child CryptoKeyVersion to use as primary.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKey)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::UpdateCryptoKeyPrimaryVersionRequest.new # Call the update_crypto_key_primary_version method. result = client.update_crypto_key_primary_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKey. p result
#update_crypto_key_version
def update_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
def update_crypto_key_version(crypto_key_version: nil, update_mask: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
Update a CryptoKeyVersion's metadata.
state may be changed between ENABLED and DISABLED using this method. See DestroyCryptoKeyVersion and RestoreCryptoKeyVersion to move between other states.
def update_crypto_key_version(request, options = nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
update_crypto_key_version
via a request object, either of type
UpdateCryptoKeyVersionRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::UpdateCryptoKeyVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_crypto_key_version(crypto_key_version: nil, update_mask: nil) -> ::Google::Cloud::Kms::V1::CryptoKeyVersion
update_crypto_key_version
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- crypto_key_version (::Google::Cloud::Kms::V1::CryptoKeyVersion, ::Hash) — Required. CryptoKeyVersion with updated values.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. List of fields to be updated in this request.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::CryptoKeyVersion)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::KeyManagementService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::UpdateCryptoKeyVersionRequest.new # Call the update_crypto_key_version method. result = client.update_crypto_key_version request # The returned object is of type Google::Cloud::Kms::V1::CryptoKeyVersion. p result