# Class ClientEncryptionService | EchoHub Documentation
Client-side encryption service. Uses the same AES-256-GCM format as the server so messages are encrypted end-to-end between client and server.

# Class ClientEncryptionService

Namespace
  EchoHub.Client.Services

Assembly
  EchoHub.Client.dll

Client-side encryption service. Uses the same AES-256-GCM format as the server so messages are encrypted end-to-end between client and server.

    public sealed class ClientEncryptionService : IMessageEncryptionService

Inheritance
  object
  ClientEncryptionService

Implements
  IMessageEncryptionService

Inherited Members
  object.GetType()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### ClientEncryptionService()

    public ClientEncryptionService()

## Properties

### EncryptDatabaseEnabled

Whether database content should be encrypted at rest (server setting).

    public bool EncryptDatabaseEnabled { get; }

#### Property Value

bool

### IsInitialized

    public bool IsInitialized { get; }

#### Property Value

bool

## Methods

### Decrypt(string)

    public string Decrypt(string content)

#### Parameters

`content` string

#### Returns

string

### DecryptNullable(string?)

    public string? DecryptNullable(string? value)

#### Parameters

`value` string

#### Returns

string

### Encrypt(string)

    public string Encrypt(string plaintext)

#### Parameters

`plaintext` string

#### Returns

string

### EncryptNullable(string?)

    public string? EncryptNullable(string? value)

#### Parameters

`value` string

#### Returns

string

### SetKey(string)

Initialize with the server's encryption key (fetched after login).

    public void SetKey(string base64Key)

#### Parameters

`base64Key` string