Google Cloud Key Management Service v1 API - Class KeyManagementServiceClient (3.15.0)

public abstract class KeyManagementServiceClient

Reference documentation and code samples for the Google Cloud Key Management Service v1 API class KeyManagementServiceClient.

KeyManagementService client wrapper, for convenient use.

Inheritance

object > KeyManagementServiceClient

Namespace

Google.Cloud.Kms.V1

Assembly

Google.Cloud.Kms.V1.dll

Remarks

Google Cloud Key Management Service

Manages cryptographic keys and operations using those keys. Implements a REST model with the following objects:

  • [KeyRing][google.cloud.kms.v1.KeyRing]
  • [CryptoKey][google.cloud.kms.v1.CryptoKey]
  • [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
  • [ImportJob][google.cloud.kms.v1.ImportJob]

If you are using manual gRPC libraries, see Using gRPC with Cloud KMS.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the KeyManagementService service, which is a host of "cloudkms.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default KeyManagementService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual KeyManagementService.KeyManagementServiceClient GrpcClient { get; }

The underlying gRPC KeyManagementService client

Property Value
Type Description
KeyManagementServiceKeyManagementServiceClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

AsymmetricDecrypt(AsymmetricDecryptRequest, CallSettings)

public virtual AsymmetricDecryptResponse AsymmetricDecrypt(AsymmetricDecryptRequest request, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
request AsymmetricDecryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AsymmetricDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
AsymmetricDecryptRequest request = new AsymmetricDecryptRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Ciphertext = ByteString.Empty,
    CiphertextCrc32C = 0L,
};
// Make the request
AsymmetricDecryptResponse response = keyManagementServiceClient.AsymmetricDecrypt(request);

AsymmetricDecrypt(CryptoKeyVersionName, ByteString, CallSettings)

public virtual AsymmetricDecryptResponse AsymmetricDecrypt(CryptoKeyVersionName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertext ByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AsymmetricDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = keyManagementServiceClient.AsymmetricDecrypt(name, ciphertext);

AsymmetricDecrypt(string, ByteString, CallSettings)

public virtual AsymmetricDecryptResponse AsymmetricDecrypt(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertext ByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AsymmetricDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = keyManagementServiceClient.AsymmetricDecrypt(name, ciphertext);

AsymmetricDecryptAsync(AsymmetricDecryptRequest, CallSettings)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(AsymmetricDecryptRequest request, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
request AsymmetricDecryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAsymmetricDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricDecryptRequest request = new AsymmetricDecryptRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Ciphertext = ByteString.Empty,
    CiphertextCrc32C = 0L,
};
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(request);

AsymmetricDecryptAsync(AsymmetricDecryptRequest, CancellationToken)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(AsymmetricDecryptRequest request, CancellationToken cancellationToken)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
request AsymmetricDecryptRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAsymmetricDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricDecryptRequest request = new AsymmetricDecryptRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Ciphertext = ByteString.Empty,
    CiphertextCrc32C = 0L,
};
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(request);

AsymmetricDecryptAsync(CryptoKeyVersionName, ByteString, CallSettings)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(CryptoKeyVersionName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertext ByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAsymmetricDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricDecryptAsync(CryptoKeyVersionName, ByteString, CancellationToken)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(CryptoKeyVersionName name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertext ByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAsymmetricDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricDecryptAsync(string, ByteString, CallSettings)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertext ByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAsymmetricDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricDecryptAsync(string, ByteString, CancellationToken)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(string name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertext ByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAsymmetricDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricSign(AsymmetricSignRequest, CallSettings)

public virtual AsymmetricSignResponse AsymmetricSign(AsymmetricSignRequest request, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
request AsymmetricSignRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AsymmetricSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
AsymmetricSignRequest request = new AsymmetricSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Digest = new Digest(),
    DigestCrc32C = 0L,
    Data = ByteString.Empty,
    DataCrc32C = 0L,
};
// Make the request
AsymmetricSignResponse response = keyManagementServiceClient.AsymmetricSign(request);

AsymmetricSign(CryptoKeyVersionName, Digest, CallSettings)

public virtual AsymmetricSignResponse AsymmetricSign(CryptoKeyVersionName name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digest Digest

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][google.cloud.kms.v1.CryptoKeyVersion.algorithm].

This field may not be supplied if [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AsymmetricSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = keyManagementServiceClient.AsymmetricSign(name, digest);

AsymmetricSign(string, Digest, CallSettings)

public virtual AsymmetricSignResponse AsymmetricSign(string name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digest Digest

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][google.cloud.kms.v1.CryptoKeyVersion.algorithm].

This field may not be supplied if [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AsymmetricSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = keyManagementServiceClient.AsymmetricSign(name, digest);

AsymmetricSignAsync(AsymmetricSignRequest, CallSettings)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(AsymmetricSignRequest request, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
request AsymmetricSignRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAsymmetricSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricSignRequest request = new AsymmetricSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Digest = new Digest(),
    DigestCrc32C = 0L,
    Data = ByteString.Empty,
    DataCrc32C = 0L,
};
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(request);

AsymmetricSignAsync(AsymmetricSignRequest, CancellationToken)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(AsymmetricSignRequest request, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
request AsymmetricSignRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAsymmetricSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricSignRequest request = new AsymmetricSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Digest = new Digest(),
    DigestCrc32C = 0L,
    Data = ByteString.Empty,
    DataCrc32C = 0L,
};
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(request);

AsymmetricSignAsync(CryptoKeyVersionName, Digest, CallSettings)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(CryptoKeyVersionName name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digest Digest

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][google.cloud.kms.v1.CryptoKeyVersion.algorithm].

This field may not be supplied if [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAsymmetricSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

AsymmetricSignAsync(CryptoKeyVersionName, Digest, CancellationToken)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(CryptoKeyVersionName name, Digest digest, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digest Digest

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][google.cloud.kms.v1.CryptoKeyVersion.algorithm].

This field may not be supplied if [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAsymmetricSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

AsymmetricSignAsync(string, Digest, CallSettings)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(string name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digest Digest

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][google.cloud.kms.v1.CryptoKeyVersion.algorithm].

This field may not be supplied if [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAsymmetricSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

AsymmetricSignAsync(string, Digest, CancellationToken)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(string name, Digest digest, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digest Digest

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][google.cloud.kms.v1.CryptoKeyVersion.algorithm].

This field may not be supplied if [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data] is supplied.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAsymmetricSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

Create()

public static KeyManagementServiceClient Create()

Synchronously creates a KeyManagementServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use KeyManagementServiceClientBuilder.

Returns
Type Description
KeyManagementServiceClient

The created KeyManagementServiceClient.

CreateAsync(CancellationToken)

public static Task<KeyManagementServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a KeyManagementServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use KeyManagementServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskKeyManagementServiceClient

The task representing the created KeyManagementServiceClient.

CreateCryptoKey(CreateCryptoKeyRequest, CallSettings)

public virtual CryptoKey CreateCryptoKey(CreateCryptoKeyRequest request, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
request CreateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateCryptoKeyRequest request = new CreateCryptoKeyRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    CryptoKeyId = "",
    CryptoKey = new CryptoKey(),
    SkipInitialVersionCreation = false,
};
// Make the request
CryptoKey response = keyManagementServiceClient.CreateCryptoKey(request);

CreateCryptoKey(KeyRingName, string, CryptoKey, CallSettings)

public virtual CryptoKey CreateCryptoKey(KeyRingName parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
parent KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKey CryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = keyManagementServiceClient.CreateCryptoKey(parent, cryptoKeyId, cryptoKey);

CreateCryptoKey(string, string, CryptoKey, CallSettings)

public virtual CryptoKey CreateCryptoKey(string parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKey CryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = keyManagementServiceClient.CreateCryptoKey(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(CreateCryptoKeyRequest, CallSettings)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(CreateCryptoKeyRequest request, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
request CreateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyRequest request = new CreateCryptoKeyRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    CryptoKeyId = "",
    CryptoKey = new CryptoKey(),
    SkipInitialVersionCreation = false,
};
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(request);

CreateCryptoKeyAsync(CreateCryptoKeyRequest, CancellationToken)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(CreateCryptoKeyRequest request, CancellationToken cancellationToken)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
request CreateCryptoKeyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyRequest request = new CreateCryptoKeyRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    CryptoKeyId = "",
    CryptoKey = new CryptoKey(),
    SkipInitialVersionCreation = false,
};
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(request);

CreateCryptoKeyAsync(KeyRingName, string, CryptoKey, CallSettings)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(KeyRingName parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
parent KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKey CryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(KeyRingName, string, CryptoKey, CancellationToken)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(KeyRingName parent, string cryptoKeyId, CryptoKey cryptoKey, CancellationToken cancellationToken)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
parent KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKey CryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(string, string, CryptoKey, CallSettings)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(string parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKey CryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(string, string, CryptoKey, CancellationToken)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(string parent, string cryptoKeyId, CryptoKey cryptoKey, CancellationToken cancellationToken)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKey CryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
request CreateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateCryptoKeyVersionRequest request = new CreateCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersion = new CryptoKeyVersion(),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.CreateCryptoKeyVersion(request);

CreateCryptoKeyVersion(CryptoKeyName, CryptoKeyVersion, CallSettings)

public virtual CryptoKeyVersion CreateCryptoKeyVersion(CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
parent CryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

cryptoKeyVersion CryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.CreateCryptoKeyVersion(parent, cryptoKeyVersion);

CreateCryptoKeyVersion(string, CryptoKeyVersion, CallSettings)

public virtual CryptoKeyVersion CreateCryptoKeyVersion(string parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

cryptoKeyVersion CryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.CreateCryptoKeyVersion(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
request CreateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyVersionRequest request = new CreateCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersion = new CryptoKeyVersion(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(request);

CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
request CreateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyVersionRequest request = new CreateCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersion = new CryptoKeyVersion(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(request);

CreateCryptoKeyVersionAsync(CryptoKeyName, CryptoKeyVersion, CallSettings)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
parent CryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

cryptoKeyVersion CryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(CryptoKeyName, CryptoKeyVersion, CancellationToken)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion, CancellationToken cancellationToken)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
parent CryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

cryptoKeyVersion CryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(string, CryptoKeyVersion, CallSettings)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(string parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

cryptoKeyVersion CryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(string, CryptoKeyVersion, CancellationToken)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(string parent, CryptoKeyVersion cryptoKeyVersion, CancellationToken cancellationToken)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

cryptoKeyVersion CryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateImportJob(CreateImportJobRequest, CallSettings)

public virtual ImportJob CreateImportJob(CreateImportJobRequest request, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
request CreateImportJobRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateImportJobRequest request = new CreateImportJobRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    ImportJobId = "",
    ImportJob = new ImportJob(),
};
// Make the request
ImportJob response = keyManagementServiceClient.CreateImportJob(request);

CreateImportJob(KeyRingName, string, ImportJob, CallSettings)

public virtual ImportJob CreateImportJob(KeyRingName parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
parent KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the [ImportJobs][google.cloud.kms.v1.ImportJob].

importJobId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJob ImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = keyManagementServiceClient.CreateImportJob(parent, importJobId, importJob);

CreateImportJob(string, string, ImportJob, CallSettings)

public virtual ImportJob CreateImportJob(string parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the [ImportJobs][google.cloud.kms.v1.ImportJob].

importJobId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJob ImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = keyManagementServiceClient.CreateImportJob(parent, importJobId, importJob);

CreateImportJobAsync(CreateImportJobRequest, CallSettings)

public virtual Task<ImportJob> CreateImportJobAsync(CreateImportJobRequest request, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
request CreateImportJobRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateImportJobRequest request = new CreateImportJobRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    ImportJobId = "",
    ImportJob = new ImportJob(),
};
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(request);

CreateImportJobAsync(CreateImportJobRequest, CancellationToken)

public virtual Task<ImportJob> CreateImportJobAsync(CreateImportJobRequest request, CancellationToken cancellationToken)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
request CreateImportJobRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateImportJobRequest request = new CreateImportJobRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    ImportJobId = "",
    ImportJob = new ImportJob(),
};
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(request);

CreateImportJobAsync(KeyRingName, string, ImportJob, CallSettings)

public virtual Task<ImportJob> CreateImportJobAsync(KeyRingName parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
parent KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the [ImportJobs][google.cloud.kms.v1.ImportJob].

importJobId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJob ImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateImportJobAsync(KeyRingName, string, ImportJob, CancellationToken)

public virtual Task<ImportJob> CreateImportJobAsync(KeyRingName parent, string importJobId, ImportJob importJob, CancellationToken cancellationToken)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
parent KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the [ImportJobs][google.cloud.kms.v1.ImportJob].

importJobId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJob ImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateImportJobAsync(string, string, ImportJob, CallSettings)

public virtual Task<ImportJob> CreateImportJobAsync(string parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the [ImportJobs][google.cloud.kms.v1.ImportJob].

importJobId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJob ImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateImportJobAsync(string, string, ImportJob, CancellationToken)

public virtual Task<ImportJob> CreateImportJobAsync(string parent, string importJobId, ImportJob importJob, CancellationToken cancellationToken)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
Name Description
parent string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the [ImportJobs][google.cloud.kms.v1.ImportJob].

importJobId string

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJob ImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateKeyRing(LocationName, string, KeyRing, CallSettings)

public virtual KeyRing CreateKeyRing(LocationName parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingId string

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRing KeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = keyManagementServiceClient.CreateKeyRing(parent, keyRingId, keyRing);

CreateKeyRing(CreateKeyRingRequest, CallSettings)

public virtual KeyRing CreateKeyRing(CreateKeyRingRequest request, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
request CreateKeyRingRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateKeyRingRequest request = new CreateKeyRingRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyRingId = "",
    KeyRing = new KeyRing(),
};
// Make the request
KeyRing response = keyManagementServiceClient.CreateKeyRing(request);

CreateKeyRing(string, string, KeyRing, CallSettings)

public virtual KeyRing CreateKeyRing(string parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingId string

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRing KeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = keyManagementServiceClient.CreateKeyRing(parent, keyRingId, keyRing);

CreateKeyRingAsync(LocationName, string, KeyRing, CallSettings)

public virtual Task<KeyRing> CreateKeyRingAsync(LocationName parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingId string

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRing KeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

CreateKeyRingAsync(LocationName, string, KeyRing, CancellationToken)

public virtual Task<KeyRing> CreateKeyRingAsync(LocationName parent, string keyRingId, KeyRing keyRing, CancellationToken cancellationToken)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingId string

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRing KeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

CreateKeyRingAsync(CreateKeyRingRequest, CallSettings)

public virtual Task<KeyRing> CreateKeyRingAsync(CreateKeyRingRequest request, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
request CreateKeyRingRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateKeyRingRequest request = new CreateKeyRingRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyRingId = "",
    KeyRing = new KeyRing(),
};
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(request);

CreateKeyRingAsync(CreateKeyRingRequest, CancellationToken)

public virtual Task<KeyRing> CreateKeyRingAsync(CreateKeyRingRequest request, CancellationToken cancellationToken)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
request CreateKeyRingRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateKeyRingRequest request = new CreateKeyRingRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyRingId = "",
    KeyRing = new KeyRing(),
};
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(request);

CreateKeyRingAsync(string, string, KeyRing, CallSettings)

public virtual Task<KeyRing> CreateKeyRingAsync(string parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingId string

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRing KeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

CreateKeyRingAsync(string, string, KeyRing, CancellationToken)

public virtual Task<KeyRing> CreateKeyRingAsync(string parent, string keyRingId, KeyRing keyRing, CancellationToken cancellationToken)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingId string

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRing KeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

Decrypt(CryptoKeyName, ByteString, CallSettings)

public virtual DecryptResponse Decrypt(CryptoKeyName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertext ByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
DecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = keyManagementServiceClient.Decrypt(name, ciphertext);

Decrypt(DecryptRequest, CallSettings)

public virtual DecryptResponse Decrypt(DecryptRequest request, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request DecryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
DecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
DecryptRequest request = new DecryptRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
DecryptResponse response = keyManagementServiceClient.Decrypt(request);

Decrypt(string, ByteString, CallSettings)

public virtual DecryptResponse Decrypt(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertext ByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
DecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = keyManagementServiceClient.Decrypt(name, ciphertext);

DecryptAsync(CryptoKeyName, ByteString, CallSettings)

public virtual Task<DecryptResponse> DecryptAsync(CryptoKeyName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertext ByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DecryptAsync(CryptoKeyName, ByteString, CancellationToken)

public virtual Task<DecryptResponse> DecryptAsync(CryptoKeyName name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertext ByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DecryptAsync(DecryptRequest, CallSettings)

public virtual Task<DecryptResponse> DecryptAsync(DecryptRequest request, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request DecryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DecryptRequest request = new DecryptRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(request);

DecryptAsync(DecryptRequest, CancellationToken)

public virtual Task<DecryptResponse> DecryptAsync(DecryptRequest request, CancellationToken cancellationToken)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request DecryptRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DecryptRequest request = new DecryptRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(request);

DecryptAsync(string, ByteString, CallSettings)

public virtual Task<DecryptResponse> DecryptAsync(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertext ByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DecryptAsync(string, ByteString, CancellationToken)

public virtual Task<DecryptResponse> DecryptAsync(string name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertext ByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DestroyCryptoKeyVersion(CryptoKeyVersionName, CallSettings)

public virtual CryptoKeyVersion DestroyCryptoKeyVersion(CryptoKeyVersionName name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.DestroyCryptoKeyVersion(name);

DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest request, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
request DestroyCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
DestroyCryptoKeyVersionRequest request = new DestroyCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.DestroyCryptoKeyVersion(request);

DestroyCryptoKeyVersion(string, CallSettings)

public virtual CryptoKeyVersion DestroyCryptoKeyVersion(string name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.DestroyCryptoKeyVersion(name);

DestroyCryptoKeyVersionAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

DestroyCryptoKeyVersionAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest request, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
request DestroyCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DestroyCryptoKeyVersionRequest request = new DestroyCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(request);

DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
request DestroyCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DestroyCryptoKeyVersionRequest request = new DestroyCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(request);

DestroyCryptoKeyVersionAsync(string, CallSettings)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(string name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

DestroyCryptoKeyVersionAsync(string, CancellationToken)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(string name, CancellationToken cancellationToken)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to the time [destroy_scheduled_duration][google.cloud.kms.v1.CryptoKey.destroy_scheduled_duration] in the future. At that time, the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will automatically change to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

Encrypt(IResourceName, ByteString, CallSettings)

public virtual EncryptResponse Encrypt(IResourceName name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name IResourceName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].

plaintext ByteString

Required. The data to encrypt. Must be no larger than 64KiB.

The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
EncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = keyManagementServiceClient.Encrypt(name, plaintext);

Encrypt(EncryptRequest, CallSettings)

public virtual EncryptResponse Encrypt(EncryptRequest request, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request EncryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
EncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
EncryptRequest request = new EncryptRequest
{
    ResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
EncryptResponse response = keyManagementServiceClient.Encrypt(request);

Encrypt(string, ByteString, CallSettings)

public virtual EncryptResponse Encrypt(string name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].

plaintext ByteString

Required. The data to encrypt. Must be no larger than 64KiB.

The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
EncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "a/wildcard/resource";
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = keyManagementServiceClient.Encrypt(name, plaintext);

EncryptAsync(IResourceName, ByteString, CallSettings)

public virtual Task<EncryptResponse> EncryptAsync(IResourceName name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name IResourceName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].

plaintext ByteString

Required. The data to encrypt. Must be no larger than 64KiB.

The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

EncryptAsync(IResourceName, ByteString, CancellationToken)

public virtual Task<EncryptResponse> EncryptAsync(IResourceName name, ByteString plaintext, CancellationToken cancellationToken)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name IResourceName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].

plaintext ByteString

Required. The data to encrypt. Must be no larger than 64KiB.

The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

EncryptAsync(EncryptRequest, CallSettings)

public virtual Task<EncryptResponse> EncryptAsync(EncryptRequest request, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request EncryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
EncryptRequest request = new EncryptRequest
{
    ResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(request);

EncryptAsync(EncryptRequest, CancellationToken)

public virtual Task<EncryptResponse> EncryptAsync(EncryptRequest request, CancellationToken cancellationToken)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request EncryptRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
EncryptRequest request = new EncryptRequest
{
    ResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(request);

EncryptAsync(string, ByteString, CallSettings)

public virtual Task<EncryptResponse> EncryptAsync(string name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].

plaintext ByteString

Required. The data to encrypt. Must be no larger than 64KiB.

The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "a/wildcard/resource";
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

EncryptAsync(string, ByteString, CancellationToken)

public virtual Task<EncryptResponse> EncryptAsync(string name, ByteString plaintext, CancellationToken cancellationToken)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.

If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].

plaintext ByteString

Required. The data to encrypt. Must be no larger than 64KiB.

The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than 8KiB.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "a/wildcard/resource";
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

GenerateRandomBytes(GenerateRandomBytesRequest, CallSettings)

public virtual GenerateRandomBytesResponse GenerateRandomBytes(GenerateRandomBytesRequest request, CallSettings callSettings = null)

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
request GenerateRandomBytesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerateRandomBytesResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GenerateRandomBytesRequest request = new GenerateRandomBytesRequest
{
    Location = "",
    LengthBytes = 0,
    ProtectionLevel = ProtectionLevel.Unspecified,
};
// Make the request
GenerateRandomBytesResponse response = keyManagementServiceClient.GenerateRandomBytes(request);

GenerateRandomBytes(string, int, ProtectionLevel, CallSettings)

public virtual GenerateRandomBytesResponse GenerateRandomBytes(string location, int lengthBytes, ProtectionLevel protectionLevel, CallSettings callSettings = null)

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
location string

The project-specific location in which to generate random bytes. For example, "projects/my-project/locations/us-central1".

lengthBytes int

The length in bytes of the amount of randomness to retrieve. Minimum 8 bytes, maximum 1024 bytes.

protectionLevel ProtectionLevel

The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when generating the random data. Currently, only [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is supported.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
GenerateRandomBytesResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string location = "";
int lengthBytes = 0;
ProtectionLevel protectionLevel = ProtectionLevel.Unspecified;
// Make the request
GenerateRandomBytesResponse response = keyManagementServiceClient.GenerateRandomBytes(location, lengthBytes, protectionLevel);

GenerateRandomBytesAsync(GenerateRandomBytesRequest, CallSettings)

public virtual Task<GenerateRandomBytesResponse> GenerateRandomBytesAsync(GenerateRandomBytesRequest request, CallSettings callSettings = null)

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
request GenerateRandomBytesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerateRandomBytesResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateRandomBytesRequest request = new GenerateRandomBytesRequest
{
    Location = "",
    LengthBytes = 0,
    ProtectionLevel = ProtectionLevel.Unspecified,
};
// Make the request
GenerateRandomBytesResponse response = await keyManagementServiceClient.GenerateRandomBytesAsync(request);

GenerateRandomBytesAsync(GenerateRandomBytesRequest, CancellationToken)

public virtual Task<GenerateRandomBytesResponse> GenerateRandomBytesAsync(GenerateRandomBytesRequest request, CancellationToken cancellationToken)

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
request GenerateRandomBytesRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerateRandomBytesResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GenerateRandomBytesRequest request = new GenerateRandomBytesRequest
{
    Location = "",
    LengthBytes = 0,
    ProtectionLevel = ProtectionLevel.Unspecified,
};
// Make the request
GenerateRandomBytesResponse response = await keyManagementServiceClient.GenerateRandomBytesAsync(request);

GenerateRandomBytesAsync(string, int, ProtectionLevel, CallSettings)

public virtual Task<GenerateRandomBytesResponse> GenerateRandomBytesAsync(string location, int lengthBytes, ProtectionLevel protectionLevel, CallSettings callSettings = null)

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
location string

The project-specific location in which to generate random bytes. For example, "projects/my-project/locations/us-central1".

lengthBytes int

The length in bytes of the amount of randomness to retrieve. Minimum 8 bytes, maximum 1024 bytes.

protectionLevel ProtectionLevel

The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when generating the random data. Currently, only [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is supported.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGenerateRandomBytesResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string location = "";
int lengthBytes = 0;
ProtectionLevel protectionLevel = ProtectionLevel.Unspecified;
// Make the request
GenerateRandomBytesResponse response = await keyManagementServiceClient.GenerateRandomBytesAsync(location, lengthBytes, protectionLevel);

GenerateRandomBytesAsync(string, int, ProtectionLevel, CancellationToken)

public virtual Task<GenerateRandomBytesResponse> GenerateRandomBytesAsync(string location, int lengthBytes, ProtectionLevel protectionLevel, CancellationToken cancellationToken)

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
location string

The project-specific location in which to generate random bytes. For example, "projects/my-project/locations/us-central1".

lengthBytes int

The length in bytes of the amount of randomness to retrieve. Minimum 8 bytes, maximum 1024 bytes.

protectionLevel ProtectionLevel

The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when generating the random data. Currently, only [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is supported.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGenerateRandomBytesResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string location = "";
int lengthBytes = 0;
ProtectionLevel protectionLevel = ProtectionLevel.Unspecified;
// Make the request
GenerateRandomBytesResponse response = await keyManagementServiceClient.GenerateRandomBytesAsync(location, lengthBytes, protectionLevel);

GetCryptoKey(CryptoKeyName, CallSettings)

public virtual CryptoKey GetCryptoKey(CryptoKeyName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name CryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
CryptoKey response = keyManagementServiceClient.GetCryptoKey(name);

GetCryptoKey(GetCryptoKeyRequest, CallSettings)

public virtual CryptoKey GetCryptoKey(GetCryptoKeyRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request GetCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetCryptoKeyRequest request = new GetCryptoKeyRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
CryptoKey response = keyManagementServiceClient.GetCryptoKey(request);

GetCryptoKey(string, CallSettings)

public virtual CryptoKey GetCryptoKey(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
CryptoKey response = keyManagementServiceClient.GetCryptoKey(name);

GetCryptoKeyAsync(CryptoKeyName, CallSettings)

public virtual Task<CryptoKey> GetCryptoKeyAsync(CryptoKeyName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name CryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyAsync(CryptoKeyName, CancellationToken)

public virtual Task<CryptoKey> GetCryptoKeyAsync(CryptoKeyName name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name CryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyAsync(GetCryptoKeyRequest, CallSettings)

public virtual Task<CryptoKey> GetCryptoKeyAsync(GetCryptoKeyRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request GetCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyRequest request = new GetCryptoKeyRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(request);

GetCryptoKeyAsync(GetCryptoKeyRequest, CancellationToken)

public virtual Task<CryptoKey> GetCryptoKeyAsync(GetCryptoKeyRequest request, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request GetCryptoKeyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyRequest request = new GetCryptoKeyRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(request);

GetCryptoKeyAsync(string, CallSettings)

public virtual Task<CryptoKey> GetCryptoKeyAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyAsync(string, CancellationToken)

public virtual Task<CryptoKey> GetCryptoKeyAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyVersion(CryptoKeyVersionName, CallSettings)

public virtual CryptoKeyVersion GetCryptoKeyVersion(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name CryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.GetCryptoKeyVersion(name);

GetCryptoKeyVersion(GetCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion GetCryptoKeyVersion(GetCryptoKeyVersionRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request GetCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetCryptoKeyVersionRequest request = new GetCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.GetCryptoKeyVersion(request);

GetCryptoKeyVersion(string, CallSettings)

public virtual CryptoKeyVersion GetCryptoKeyVersion(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.GetCryptoKeyVersion(name);

GetCryptoKeyVersionAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name CryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetCryptoKeyVersionAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name CryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request GetCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyVersionRequest request = new GetCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(request);

GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request GetCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyVersionRequest request = new GetCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(request);

GetCryptoKeyVersionAsync(string, CallSettings)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetCryptoKeyVersionAsync(string, CancellationToken)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetImportJob(GetImportJobRequest, CallSettings)

public virtual ImportJob GetImportJob(GetImportJobRequest request, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
request GetImportJobRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetImportJobRequest request = new GetImportJobRequest
{
    ImportJobName = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]"),
};
// Make the request
ImportJob response = keyManagementServiceClient.GetImportJob(request);

GetImportJob(ImportJobName, CallSettings)

public virtual ImportJob GetImportJob(ImportJobName name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
name ImportJobName

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ImportJobName name = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
// Make the request
ImportJob response = keyManagementServiceClient.GetImportJob(name);

GetImportJob(string, CallSettings)

public virtual ImportJob GetImportJob(string name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/importJobs/[IMPORT_JOB]";
// Make the request
ImportJob response = keyManagementServiceClient.GetImportJob(name);

GetImportJobAsync(GetImportJobRequest, CallSettings)

public virtual Task<ImportJob> GetImportJobAsync(GetImportJobRequest request, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
request GetImportJobRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetImportJobRequest request = new GetImportJobRequest
{
    ImportJobName = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]"),
};
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(request);

GetImportJobAsync(GetImportJobRequest, CancellationToken)

public virtual Task<ImportJob> GetImportJobAsync(GetImportJobRequest request, CancellationToken cancellationToken)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
request GetImportJobRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetImportJobRequest request = new GetImportJobRequest
{
    ImportJobName = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]"),
};
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(request);

GetImportJobAsync(ImportJobName, CallSettings)

public virtual Task<ImportJob> GetImportJobAsync(ImportJobName name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
name ImportJobName

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportJobName name = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetImportJobAsync(ImportJobName, CancellationToken)

public virtual Task<ImportJob> GetImportJobAsync(ImportJobName name, CancellationToken cancellationToken)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
name ImportJobName

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportJobName name = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetImportJobAsync(string, CallSettings)

public virtual Task<ImportJob> GetImportJobAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/importJobs/[IMPORT_JOB]";
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetImportJobAsync(string, CancellationToken)

public virtual Task<ImportJob> GetImportJobAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskImportJob

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/importJobs/[IMPORT_JOB]";
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetKeyRing(GetKeyRingRequest, CallSettings)

public virtual KeyRing GetKeyRing(GetKeyRingRequest request, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
request GetKeyRingRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetKeyRingRequest request = new GetKeyRingRequest
{
    KeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
};
// Make the request
KeyRing response = keyManagementServiceClient.GetKeyRing(request);

GetKeyRing(KeyRingName, CallSettings)

public virtual KeyRing GetKeyRing(KeyRingName name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
name KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName name = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
KeyRing response = keyManagementServiceClient.GetKeyRing(name);

GetKeyRing(string, CallSettings)

public virtual KeyRing GetKeyRing(string name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
KeyRing response = keyManagementServiceClient.GetKeyRing(name);

GetKeyRingAsync(GetKeyRingRequest, CallSettings)

public virtual Task<KeyRing> GetKeyRingAsync(GetKeyRingRequest request, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
request GetKeyRingRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetKeyRingRequest request = new GetKeyRingRequest
{
    KeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
};
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(request);

GetKeyRingAsync(GetKeyRingRequest, CancellationToken)

public virtual Task<KeyRing> GetKeyRingAsync(GetKeyRingRequest request, CancellationToken cancellationToken)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
request GetKeyRingRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetKeyRingRequest request = new GetKeyRingRequest
{
    KeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
};
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(request);

GetKeyRingAsync(KeyRingName, CallSettings)

public virtual Task<KeyRing> GetKeyRingAsync(KeyRingName name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
name KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName name = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetKeyRingAsync(KeyRingName, CancellationToken)

public virtual Task<KeyRing> GetKeyRingAsync(KeyRingName name, CancellationToken cancellationToken)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
name KeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName name = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetKeyRingAsync(string, CallSettings)

public virtual Task<KeyRing> GetKeyRingAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetKeyRingAsync(string, CancellationToken)

public virtual Task<KeyRing> GetKeyRingAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyRing

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetPublicKey(CryptoKeyVersionName, CallSettings)

public virtual PublicKey GetPublicKey(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
name CryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PublicKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
PublicKey response = keyManagementServiceClient.GetPublicKey(name);

GetPublicKey(GetPublicKeyRequest, CallSettings)

public virtual PublicKey GetPublicKey(GetPublicKeyRequest request, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
request GetPublicKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PublicKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetPublicKeyRequest request = new GetPublicKeyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
PublicKey response = keyManagementServiceClient.GetPublicKey(request);

GetPublicKey(string, CallSettings)

public virtual PublicKey GetPublicKey(string name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PublicKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
PublicKey response = keyManagementServiceClient.GetPublicKey(name);

GetPublicKeyAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<PublicKey> GetPublicKeyAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
name CryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPublicKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

GetPublicKeyAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<PublicKey> GetPublicKeyAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
name CryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPublicKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

GetPublicKeyAsync(GetPublicKeyRequest, CallSettings)

public virtual Task<PublicKey> GetPublicKeyAsync(GetPublicKeyRequest request, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
request GetPublicKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPublicKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetPublicKeyRequest request = new GetPublicKeyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(request);

GetPublicKeyAsync(GetPublicKeyRequest, CancellationToken)

public virtual Task<PublicKey> GetPublicKeyAsync(GetPublicKeyRequest request, CancellationToken cancellationToken)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
request GetPublicKeyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPublicKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetPublicKeyRequest request = new GetPublicKeyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(request);

GetPublicKeyAsync(string, CallSettings)

public virtual Task<PublicKey> GetPublicKeyAsync(string name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPublicKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

GetPublicKeyAsync(string, CancellationToken)

public virtual Task<PublicKey> GetPublicKeyAsync(string name, CancellationToken cancellationToken)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
Name Description
name string

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPublicKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest request, CallSettings callSettings = null)

Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.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][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request ImportCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ImportCryptoKeyVersionRequest request = new ImportCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
    ImportJob = "",
    RsaAesWrappedKey = ByteString.Empty,
    CryptoKeyVersionAsCryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    WrappedKey = ByteString.Empty,
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.ImportCryptoKeyVersion(request);

ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest request, CallSettings callSettings = null)

Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.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][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request ImportCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportCryptoKeyVersionRequest request = new ImportCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
    ImportJob = "",
    RsaAesWrappedKey = ByteString.Empty,
    CryptoKeyVersionAsCryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    WrappedKey = ByteString.Empty,
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.ImportCryptoKeyVersionAsync(request);

ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Import wrapped key material into a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

All requests must specify a [CryptoKey][google.cloud.kms.v1.CryptoKey]. If a [CryptoKeyVersion][google.cloud.kms.v1.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][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request ImportCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportCryptoKeyVersionRequest request = new ImportCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
    ImportJob = "",
    RsaAesWrappedKey = ByteString.Empty,
    CryptoKeyVersionAsCryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    WrappedKey = ByteString.Empty,
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.ImportCryptoKeyVersionAsync(request);

ListCryptoKeyVersions(CryptoKeyName, string, int?, CallSettings)

public virtual PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersions(CryptoKeyName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
parent CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCryptoKeyVersionsResponseCryptoKeyVersion

A pageable sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKeyVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeyVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersions(ListCryptoKeyVersionsRequest, CallSettings)

public virtual PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersions(ListCryptoKeyVersionsRequest request, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request ListCryptoKeyVersionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCryptoKeyVersionsResponseCryptoKeyVersion

A pageable sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListCryptoKeyVersionsRequest request = new ListCryptoKeyVersionsRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    View = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersions(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKeyVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeyVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersions(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersions(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
parent string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCryptoKeyVersionsResponseCryptoKeyVersion

A pageable sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKeyVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeyVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersionsAsync(CryptoKeyName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersionsAsync(CryptoKeyName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
parent CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCryptoKeyVersionsResponseCryptoKeyVersion

A pageable asynchronous sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKeyVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeyVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersionsAsync(ListCryptoKeyVersionsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersionsAsync(ListCryptoKeyVersionsRequest request, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
request ListCryptoKeyVersionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCryptoKeyVersionsResponseCryptoKeyVersion

A pageable asynchronous sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListCryptoKeyVersionsRequest request = new ListCryptoKeyVersionsRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    View = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersionsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKeyVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeyVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersionsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersionsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
Name Description
parent string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCryptoKeyVersionsResponseCryptoKeyVersion

A pageable asynchronous sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKeyVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeyVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(KeyRingName, string, int?, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(KeyRingName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent KeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCryptoKeysResponseCryptoKey

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(ListCryptoKeysRequest, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(ListCryptoKeysRequest request, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request ListCryptoKeysRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCryptoKeysResponseCryptoKey

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListCryptoKeysRequest request = new ListCryptoKeysRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    VersionView = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeys(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent string

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCryptoKeysResponseCryptoKey

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(KeyRingName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(KeyRingName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent KeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCryptoKeysResponseCryptoKey

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(ListCryptoKeysRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(ListCryptoKeysRequest request, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request ListCryptoKeysRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCryptoKeysResponseCryptoKey

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListCryptoKeysRequest request = new ListCryptoKeysRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    VersionView = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeysAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent string

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCryptoKeysResponseCryptoKey

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobs(KeyRingName, string, int?, CallSettings)

public virtual PagedEnumerable<ListImportJobsResponse, ImportJob> ListImportJobs(KeyRingName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
parent KeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListImportJobsResponseImportJob

A pageable sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (ImportJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListImportJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobs(ListImportJobsRequest, CallSettings)

public virtual PagedEnumerable<ListImportJobsResponse, ImportJob> ListImportJobs(ListImportJobsRequest request, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
request ListImportJobsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListImportJobsResponseImportJob

A pageable sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListImportJobsRequest request = new ListImportJobsRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobs(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (ImportJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListImportJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobs(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListImportJobsResponse, ImportJob> ListImportJobs(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
parent string

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListImportJobsResponseImportJob

A pageable sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (ImportJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListImportJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobsAsync(KeyRingName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> ListImportJobsAsync(KeyRingName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
parent KeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListImportJobsResponseImportJob

A pageable asynchronous sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ImportJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListImportJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobsAsync(ListImportJobsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> ListImportJobsAsync(ListImportJobsRequest request, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
request ListImportJobsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListImportJobsResponseImportJob

A pageable asynchronous sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListImportJobsRequest request = new ListImportJobsRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ImportJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListImportJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> ListImportJobsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
Name Description
parent string

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListImportJobsResponseImportJob

A pageable asynchronous sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ImportJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListImportJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRings(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRings(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListKeyRingsResponseKeyRing

A pageable sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRings(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (KeyRing item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListKeyRingsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRings(ListKeyRingsRequest, CallSettings)

public virtual PagedEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRings(ListKeyRingsRequest request, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
request ListKeyRingsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListKeyRingsResponseKeyRing

A pageable sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListKeyRingsRequest request = new ListKeyRingsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRings(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (KeyRing item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListKeyRingsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRings(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRings(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListKeyRingsResponseKeyRing

A pageable sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRings(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (KeyRing item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListKeyRingsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRingsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRingsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
parent LocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListKeyRingsResponseKeyRing

A pageable asynchronous sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRingsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyRing item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListKeyRingsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRingsAsync(ListKeyRingsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRingsAsync(ListKeyRingsRequest request, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
request ListKeyRingsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListKeyRingsResponseKeyRing

A pageable asynchronous sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListKeyRingsRequest request = new ListKeyRingsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRingsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyRing item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListKeyRingsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRingsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRingsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
Name Description
parent string

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListKeyRingsResponseKeyRing

A pageable asynchronous sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRingsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyRing item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListKeyRingsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

MacSign(CryptoKeyVersionName, ByteString, CallSettings)

public virtual MacSignResponse MacSign(CryptoKeyVersionName name, ByteString data, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

data ByteString

Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
MacSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString data = ByteString.Empty;
// Make the request
MacSignResponse response = keyManagementServiceClient.MacSign(name, data);

MacSign(MacSignRequest, CallSettings)

public virtual MacSignResponse MacSign(MacSignRequest request, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
request MacSignRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
MacSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
MacSignRequest request = new MacSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Data = ByteString.Empty,
    DataCrc32C = 0L,
};
// Make the request
MacSignResponse response = keyManagementServiceClient.MacSign(request);

MacSign(string, ByteString, CallSettings)

public virtual MacSignResponse MacSign(string name, ByteString data, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

data ByteString

Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
MacSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString data = ByteString.Empty;
// Make the request
MacSignResponse response = keyManagementServiceClient.MacSign(name, data);

MacSignAsync(CryptoKeyVersionName, ByteString, CallSettings)

public virtual Task<MacSignResponse> MacSignAsync(CryptoKeyVersionName name, ByteString data, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

data ByteString

Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskMacSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString data = ByteString.Empty;
// Make the request
MacSignResponse response = await keyManagementServiceClient.MacSignAsync(name, data);

MacSignAsync(CryptoKeyVersionName, ByteString, CancellationToken)

public virtual Task<MacSignResponse> MacSignAsync(CryptoKeyVersionName name, ByteString data, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

data ByteString

Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskMacSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString data = ByteString.Empty;
// Make the request
MacSignResponse response = await keyManagementServiceClient.MacSignAsync(name, data);

MacSignAsync(MacSignRequest, CallSettings)

public virtual Task<MacSignResponse> MacSignAsync(MacSignRequest request, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
request MacSignRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskMacSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
MacSignRequest request = new MacSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Data = ByteString.Empty,
    DataCrc32C = 0L,
};
// Make the request
MacSignResponse response = await keyManagementServiceClient.MacSignAsync(request);

MacSignAsync(MacSignRequest, CancellationToken)

public virtual Task<MacSignResponse> MacSignAsync(MacSignRequest request, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
request MacSignRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskMacSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
MacSignRequest request = new MacSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Data = ByteString.Empty,
    DataCrc32C = 0L,
};
// Make the request
MacSignResponse response = await keyManagementServiceClient.MacSignAsync(request);

MacSignAsync(string, ByteString, CallSettings)

public virtual Task<MacSignResponse> MacSignAsync(string name, ByteString data, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

data ByteString

Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskMacSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString data = ByteString.Empty;
// Make the request
MacSignResponse response = await keyManagementServiceClient.MacSignAsync(name, data);

MacSignAsync(string, ByteString, CancellationToken)

public virtual Task<MacSignResponse> MacSignAsync(string name, ByteString data, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

data ByteString

Required. The data to sign. The MAC tag is computed over this data field based on the specific algorithm.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskMacSignResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString data = ByteString.Empty;
// Make the request
MacSignResponse response = await keyManagementServiceClient.MacSignAsync(name, data);

MacVerify(CryptoKeyVersionName, ByteString, ByteString, CallSettings)

public virtual MacVerifyResponse MacVerify(CryptoKeyVersionName name, ByteString data, ByteString mac, CallSettings callSettings = null)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for verification.

data ByteString

Required. The data used previously as a [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate the MAC tag.

mac ByteString

Required. The signature to verify.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
MacVerifyResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString data = ByteString.Empty;
ByteString mac = ByteString.Empty;
// Make the request
MacVerifyResponse response = keyManagementServiceClient.MacVerify(name, data, mac);

MacVerify(MacVerifyRequest, CallSettings)

public virtual MacVerifyResponse MacVerify(MacVerifyRequest request, CallSettings callSettings = null)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
request MacVerifyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
MacVerifyResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
MacVerifyRequest request = new MacVerifyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Data = ByteString.Empty,
    DataCrc32C = 0L,
    Mac = ByteString.Empty,
    MacCrc32C = 0L,
};
// Make the request
MacVerifyResponse response = keyManagementServiceClient.MacVerify(request);

MacVerify(string, ByteString, ByteString, CallSettings)

public virtual MacVerifyResponse MacVerify(string name, ByteString data, ByteString mac, CallSettings callSettings = null)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for verification.

data ByteString

Required. The data used previously as a [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate the MAC tag.

mac ByteString

Required. The signature to verify.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
MacVerifyResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString data = ByteString.Empty;
ByteString mac = ByteString.Empty;
// Make the request
MacVerifyResponse response = keyManagementServiceClient.MacVerify(name, data, mac);

MacVerifyAsync(CryptoKeyVersionName, ByteString, ByteString, CallSettings)

public virtual Task<MacVerifyResponse> MacVerifyAsync(CryptoKeyVersionName name, ByteString data, ByteString mac, CallSettings callSettings = null)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for verification.

data ByteString

Required. The data used previously as a [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate the MAC tag.

mac ByteString

Required. The signature to verify.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskMacVerifyResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString data = ByteString.Empty;
ByteString mac = ByteString.Empty;
// Make the request
MacVerifyResponse response = await keyManagementServiceClient.MacVerifyAsync(name, data, mac);

MacVerifyAsync(CryptoKeyVersionName, ByteString, ByteString, CancellationToken)

public virtual Task<MacVerifyResponse> MacVerifyAsync(CryptoKeyVersionName name, ByteString data, ByteString mac, CancellationToken cancellationToken)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for verification.

data ByteString

Required. The data used previously as a [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate the MAC tag.

mac ByteString

Required. The signature to verify.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskMacVerifyResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString data = ByteString.Empty;
ByteString mac = ByteString.Empty;
// Make the request
MacVerifyResponse response = await keyManagementServiceClient.MacVerifyAsync(name, data, mac);

MacVerifyAsync(MacVerifyRequest, CallSettings)

public virtual Task<MacVerifyResponse> MacVerifyAsync(MacVerifyRequest request, CallSettings callSettings = null)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
request MacVerifyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskMacVerifyResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
MacVerifyRequest request = new MacVerifyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Data = ByteString.Empty,
    DataCrc32C = 0L,
    Mac = ByteString.Empty,
    MacCrc32C = 0L,
};
// Make the request
MacVerifyResponse response = await keyManagementServiceClient.MacVerifyAsync(request);

MacVerifyAsync(MacVerifyRequest, CancellationToken)

public virtual Task<MacVerifyResponse> MacVerifyAsync(MacVerifyRequest request, CancellationToken cancellationToken)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
request MacVerifyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskMacVerifyResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
MacVerifyRequest request = new MacVerifyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Data = ByteString.Empty,
    DataCrc32C = 0L,
    Mac = ByteString.Empty,
    MacCrc32C = 0L,
};
// Make the request
MacVerifyResponse response = await keyManagementServiceClient.MacVerifyAsync(request);

MacVerifyAsync(string, ByteString, ByteString, CallSettings)

public virtual Task<MacVerifyResponse> MacVerifyAsync(string name, ByteString data, ByteString mac, CallSettings callSettings = null)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for verification.

data ByteString

Required. The data used previously as a [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate the MAC tag.

mac ByteString

Required. The signature to verify.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskMacVerifyResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString data = ByteString.Empty;
ByteString mac = ByteString.Empty;
// Make the request
MacVerifyResponse response = await keyManagementServiceClient.MacVerifyAsync(name, data, mac);

MacVerifyAsync(string, ByteString, ByteString, CancellationToken)

public virtual Task<MacVerifyResponse> MacVerifyAsync(string name, ByteString data, ByteString mac, CancellationToken cancellationToken)

Verifies MAC tag using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for verification.

data ByteString

Required. The data used previously as a [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate the MAC tag.

mac ByteString

Required. The signature to verify.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskMacVerifyResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString data = ByteString.Empty;
ByteString mac = ByteString.Empty;
// Make the request
MacVerifyResponse response = await keyManagementServiceClient.MacVerifyAsync(name, data, mac);

RawDecrypt(RawDecryptRequest, CallSettings)

public virtual RawDecryptResponse RawDecrypt(RawDecryptRequest request, CallSettings callSettings = null)

Decrypts data that was originally encrypted using a raw cryptographic mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].

Parameters
Name Description
request RawDecryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RawDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
RawDecryptRequest request = new RawDecryptRequest
{
    Name = "",
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    InitializationVector = ByteString.Empty,
    TagLength = 0,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
    InitializationVectorCrc32C = 0L,
};
// Make the request
RawDecryptResponse response = keyManagementServiceClient.RawDecrypt(request);

RawDecryptAsync(RawDecryptRequest, CallSettings)

public virtual Task<RawDecryptResponse> RawDecryptAsync(RawDecryptRequest request, CallSettings callSettings = null)

Decrypts data that was originally encrypted using a raw cryptographic mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].

Parameters
Name Description
request RawDecryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRawDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RawDecryptRequest request = new RawDecryptRequest
{
    Name = "",
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    InitializationVector = ByteString.Empty,
    TagLength = 0,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
    InitializationVectorCrc32C = 0L,
};
// Make the request
RawDecryptResponse response = await keyManagementServiceClient.RawDecryptAsync(request);

RawDecryptAsync(RawDecryptRequest, CancellationToken)

public virtual Task<RawDecryptResponse> RawDecryptAsync(RawDecryptRequest request, CancellationToken cancellationToken)

Decrypts data that was originally encrypted using a raw cryptographic mechanism. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].

Parameters
Name Description
request RawDecryptRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRawDecryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RawDecryptRequest request = new RawDecryptRequest
{
    Name = "",
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    InitializationVector = ByteString.Empty,
    TagLength = 0,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
    InitializationVectorCrc32C = 0L,
};
// Make the request
RawDecryptResponse response = await keyManagementServiceClient.RawDecryptAsync(request);

RawEncrypt(RawEncryptRequest, CallSettings)

public virtual RawEncryptResponse RawEncrypt(RawEncryptRequest request, CallSettings callSettings = null)

Encrypts data using portable cryptographic primitives. Most users should choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than their raw counterparts. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].

Parameters
Name Description
request RawEncryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RawEncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
RawEncryptRequest request = new RawEncryptRequest
{
    Name = "",
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
    InitializationVector = ByteString.Empty,
    InitializationVectorCrc32C = 0L,
};
// Make the request
RawEncryptResponse response = keyManagementServiceClient.RawEncrypt(request);

RawEncryptAsync(RawEncryptRequest, CallSettings)

public virtual Task<RawEncryptResponse> RawEncryptAsync(RawEncryptRequest request, CallSettings callSettings = null)

Encrypts data using portable cryptographic primitives. Most users should choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than their raw counterparts. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].

Parameters
Name Description
request RawEncryptRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRawEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RawEncryptRequest request = new RawEncryptRequest
{
    Name = "",
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
    InitializationVector = ByteString.Empty,
    InitializationVectorCrc32C = 0L,
};
// Make the request
RawEncryptResponse response = await keyManagementServiceClient.RawEncryptAsync(request);

RawEncryptAsync(RawEncryptRequest, CancellationToken)

public virtual Task<RawEncryptResponse> RawEncryptAsync(RawEncryptRequest request, CancellationToken cancellationToken)

Encrypts data using portable cryptographic primitives. Most users should choose [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] rather than their raw counterparts. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].

Parameters
Name Description
request RawEncryptRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRawEncryptResponse

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RawEncryptRequest request = new RawEncryptRequest
{
    Name = "",
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
    InitializationVector = ByteString.Empty,
    InitializationVectorCrc32C = 0L,
};
// Make the request
RawEncryptResponse response = await keyManagementServiceClient.RawEncryptAsync(request);

RestoreCryptoKeyVersion(CryptoKeyVersionName, CallSettings)

public virtual CryptoKeyVersion RestoreCryptoKeyVersion(CryptoKeyVersionName name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.RestoreCryptoKeyVersion(name);

RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest request, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
request RestoreCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
RestoreCryptoKeyVersionRequest request = new RestoreCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.RestoreCryptoKeyVersion(request);

RestoreCryptoKeyVersion(string, CallSettings)

public virtual CryptoKeyVersion RestoreCryptoKeyVersion(string name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.RestoreCryptoKeyVersion(name);

RestoreCryptoKeyVersionAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

RestoreCryptoKeyVersionAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
name CryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest request, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
request RestoreCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RestoreCryptoKeyVersionRequest request = new RestoreCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(request);

RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
request RestoreCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RestoreCryptoKeyVersionRequest request = new RestoreCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(request);

RestoreCryptoKeyVersionAsync(string, CallSettings)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(string name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

RestoreCryptoKeyVersionAsync(string, CancellationToken)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(string name, CancellationToken cancellationToken)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
Name Description
name string

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateCryptoKey(CryptoKey, FieldMask, CallSettings)

public virtual CryptoKey UpdateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
cryptoKey CryptoKey

Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.

updateMask FieldMask

Required. List of fields to be updated in this request.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKey cryptoKey = new CryptoKey();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKey(cryptoKey, updateMask);

UpdateCryptoKey(UpdateCryptoKeyRequest, CallSettings)

public virtual CryptoKey UpdateCryptoKey(UpdateCryptoKeyRequest request, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request UpdateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
UpdateCryptoKeyRequest request = new UpdateCryptoKeyRequest
{
    CryptoKey = new CryptoKey(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKey(request);

UpdateCryptoKeyAsync(CryptoKey, FieldMask, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(CryptoKey cryptoKey, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
cryptoKey CryptoKey

Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.

updateMask FieldMask

Required. List of fields to be updated in this request.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKey cryptoKey = new CryptoKey();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(cryptoKey, updateMask);

UpdateCryptoKeyAsync(CryptoKey, FieldMask, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(CryptoKey cryptoKey, FieldMask updateMask, CancellationToken cancellationToken)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
cryptoKey CryptoKey

Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.

updateMask FieldMask

Required. List of fields to be updated in this request.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKey cryptoKey = new CryptoKey();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(cryptoKey, updateMask);

UpdateCryptoKeyAsync(UpdateCryptoKeyRequest, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(UpdateCryptoKeyRequest request, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request UpdateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyRequest request = new UpdateCryptoKeyRequest
{
    CryptoKey = new CryptoKey(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(request);

UpdateCryptoKeyAsync(UpdateCryptoKeyRequest, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(UpdateCryptoKeyRequest request, CancellationToken cancellationToken)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request UpdateCryptoKeyRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyRequest request = new UpdateCryptoKeyRequest
{
    CryptoKey = new CryptoKey(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(request);

UpdateCryptoKeyPrimaryVersion(CryptoKeyName, string, CallSettings)

public virtual CryptoKey UpdateCryptoKeyPrimaryVersion(CryptoKeyName name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionId string

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest, CallSettings)

public virtual CryptoKey UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest request, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request UpdateCryptoKeyPrimaryVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
UpdateCryptoKeyPrimaryVersionRequest request = new UpdateCryptoKeyPrimaryVersionRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersionId = "",
};
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKeyPrimaryVersion(request);

UpdateCryptoKeyPrimaryVersion(string, string, CallSettings)

public virtual CryptoKey UpdateCryptoKeyPrimaryVersion(string name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionId string

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName, string, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionId string

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName, string, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName name, string cryptoKeyVersionId, CancellationToken cancellationToken)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name CryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionId string

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest request, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request UpdateCryptoKeyPrimaryVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyPrimaryVersionRequest request = new UpdateCryptoKeyPrimaryVersionRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersionId = "",
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(request);

UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest request, CancellationToken cancellationToken)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
request UpdateCryptoKeyPrimaryVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyPrimaryVersionRequest request = new UpdateCryptoKeyPrimaryVersionRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersionId = "",
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(request);

UpdateCryptoKeyPrimaryVersionAsync(string, string, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(string name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionId string

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(string, string, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(string name, string cryptoKeyVersionId, CancellationToken cancellationToken)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
Name Description
name string

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionId string

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKey

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyVersion(CryptoKeyVersion, FieldMask, CallSettings)

public virtual CryptoKeyVersion UpdateCryptoKeyVersion(CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
Name Description
cryptoKeyVersion CryptoKeyVersion

Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.

updateMask FieldMask

Required. List of fields to be updated in this request.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.UpdateCryptoKeyVersion(cryptoKeyVersion, updateMask);

UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
Name Description
request UpdateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
UpdateCryptoKeyVersionRequest request = new UpdateCryptoKeyVersionRequest
{
    CryptoKeyVersion = new CryptoKeyVersion(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.UpdateCryptoKeyVersion(request);

UpdateCryptoKeyVersionAsync(CryptoKeyVersion, FieldMask, CallSettings)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
Name Description
cryptoKeyVersion CryptoKeyVersion

Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.

updateMask FieldMask

Required. List of fields to be updated in this request.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(cryptoKeyVersion, updateMask);

UpdateCryptoKeyVersionAsync(CryptoKeyVersion, FieldMask, CancellationToken)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask, CancellationToken cancellationToken)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
Name Description
cryptoKeyVersion CryptoKeyVersion

Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.

updateMask FieldMask

Required. List of fields to be updated in this request.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(cryptoKeyVersion, updateMask);

UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
Name Description
request UpdateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyVersionRequest request = new UpdateCryptoKeyVersionRequest
{
    CryptoKeyVersion = new CryptoKeyVersion(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(request);

UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
Name Description
request UpdateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCryptoKeyVersion

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyVersionRequest request = new UpdateCryptoKeyVersionRequest
{
    CryptoKeyVersion = new CryptoKeyVersion(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(request);