# Secret Manager v1 API - Class CustomerManagedEncryption (2.7.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.7.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/latest/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.6.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.5.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.4.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.3.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.2.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.1.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/2.0.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.9.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.9.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.8.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.7.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.7.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.6.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.5.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.4.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/1.3.0/Google.Cloud.SecretManager.V1.CustomerManagedEncryption)

    public sealed class CustomerManagedEncryption : IMessage<CustomerManagedEncryption>, IEquatable<CustomerManagedEncryption>, IDeepCloneable<CustomerManagedEncryption>, IBufferMessage, IMessage

Reference documentation and code samples for the Secret Manager v1 API class CustomerManagedEncryption.

Configuration for encrypting secret payloads using customer-managed
encryption keys (CMEK).

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> CustomerManagedEncryption

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CustomerManagedEncryption](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/latest/Google.Cloud.SecretManager.V1.CustomerManagedEncryption), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CustomerManagedEncryption](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/latest/Google.Cloud.SecretManager.V1.CustomerManagedEncryption), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CustomerManagedEncryption](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/latest/Google.Cloud.SecretManager.V1.CustomerManagedEncryption), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.SecretManager.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/latest/Google.Cloud.SecretManager.V1)

## Assembly

Google.Cloud.SecretManager.V1.dll

## Constructors

### CustomerManagedEncryption()

    public CustomerManagedEncryption()

### CustomerManagedEncryption(CustomerManagedEncryption)

    public CustomerManagedEncryption(CustomerManagedEncryption other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.SecretManager.V1/latest/Google.Cloud.SecretManager.V1.CustomerManagedEncryption` |

## Properties

### KmsKeyName

    public string KmsKeyName { get; set; }

Required. The resource name of the Cloud KMS CryptoKey used to encrypt
secret payloads.

For secrets using the
\[UserManaged\]\[google.cloud.secretmanager.v1.Replication.UserManaged\]
replication policy type, Cloud KMS CryptoKeys must reside in the same
location as the \[replica location\]\[Secret.UserManaged.Replica.location\].

For secrets using the
\[Automatic\]\[google.cloud.secretmanager.v1.Replication.Automatic\]
replication policy type, Cloud KMS CryptoKeys must reside in `global`.

The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |