<a id="code-examples-csfle"></a>

# Client-Side Field Level Encryption Examples for Confluent Platform

The following code examples and demos (for Java, Go, C#/.NET, JavaScript, and Python)
can teach you how to use client-side field level encryption on Confluent Platform. You
can find the example code in the [Client-Side Field Level Encryption (CSFLE) Examples](https://github.com/confluentinc/csfle-examples#readme)
GitHub repository.

## Requirements

* A Confluent Enterprise cluster version 8.0 or later.
* For clients supporting CSFLE, see [Requirements](client-side.md#csfle-requirements).

## Examples

### Java

These following producers and consumers examples use the Apache Kafka® Java client.
[Apache Kafka Java Client](https://docs.confluent.io/clients-kafka-java/current/overview.html).

* [CSFLE with AWS KMS](https://github.com/confluentinc/csfle-examples/tree/master/aws#readme)
* [Client-Side Field Level Encryption (CSFLE) with Azure Key Vault](https://github.com/confluentinc/csfle-examples/tree/master/azure#readme)
* [Client-Side Field Level Encryption (CSFLE) with Google Cloud KMS](https://github.com/confluentinc/csfle-examples/tree/master/gcp#readme)
* [Client-Side Field Level Encryption (CSFLE) with HashiCorp Vault](https://github.com/confluentinc/csfle-examples/tree/master/hashicorp#readme)

### Go

These examples use the supported Kafka Go client.
[Confluent’s Golang Client for Apache Kafka](https://github.com/confluentinc/confluent-kafka-go).

#### Avro

* [Producer encryption](https://github.com/confluentinc/confluent-kafka-go/tree/master/examples/avrov2_producer_encryption_example#readme)
* [Consumer decryption example (using Avro)](https://github.com/confluentinc/confluent-kafka-go/tree/master/examples/avrov2_consumer_encryption_example#readme)

#### JSON

* [Producer encryption example (using JSON)](https://github.com/confluentinc/confluent-kafka-go/tree/master/examples/json_producer_encryption_example#readme)
* [Consumer decryption example (using JSON)](https://github.com/confluentinc/confluent-kafka-go/tree/master/examples/json_consumer_encryption_example#readme)

#### Protobuf

* [Producer encryption example (using Protobuf)](https://github.com/confluentinc/confluent-kafka-go/tree/master/examples/protobuf_producer_encryption_example)
* [Consumer decryption example (using Protobuf)](https://github.com/confluentinc/confluent-kafka-go/tree/master/examples/protobuf_consumer_encryption_example)

### C#/.NET

The following examples use Confluent’s .NET client for Apache Kafka®. For details, see
[Confluent’s .NET client for Apache Kafka](https://github.com/confluentinc/confluent-kafka-dotnet).

#### Avro

* [Generic encryption example (using Avro)](https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/examples/AvroGenericEncryption#readme)
* [Specific encryption example (using Avro)](https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/examples/AvroSpecificEncryption#readme)

#### JSON

* [Encryption example (using JSON)](https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/examples/JsonEncryption#readme)

#### Protobuf

* [Encryption example (using Protobuf)](https://github.com/confluentinc/confluent-kafka-dotnet/tree/master/examples/ProtobufEncryption#readme)

### Javascript

The following examples use the Kafka Javascript client. For details, see
[Confluent’s Javascript Client for Apache Kafka](https://github.com/confluentinc/confluent-kafka-javascript).

#### Avro

* [Producer and consumer example (using Avro)](https://github.com/confluentinc/confluent-kafka-javascript/blob/master/schemaregistry-examples/src/csfle-schemaregistry.ts)

### Python

The following examples use the supported Python client for Apache Kafka®. For details, see
[Confluent’s Python Client for Apache Kafka](https://github.com/confluentinc/confluent-kafka-python).

#### Avro

* [Producer encryption example (using Avro)](https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/avro_producer_encryption.py)
* [Consumer decryption example (using Avro)](https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/avro_consumer_encryption.py)

#### JSON

* [Producer encryption example (using JSON)](https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/json_producer_encryption.py)
* [Consumer decryption example (using JSON)](https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/json_consumer_encryption.py)

#### Protobuf

* [Producer encryption example (using Protobuf)](https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/protobuf_producer_encryption.py)
* [Consumer decryption example (using Protobuf)](https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/protobuf_consumer_encryption.py)

## Related content

* [Configure Client-Side Field Level Encryption on Confluent Platform](config-parameters.md#config-parameters-csfle)
* [Protect Sensitive Data Using Client-Side Field Level Encryption on Confluent Platform](overview.md#csfle-overview)
* [Implement a Custom KMS Driver on Confluent Platform](custom-kms-driver.md#csfle-custom-kms-driver)
* [Quick Start - Protect Sensitive Data on Confluent Platform with CSFLE](quick-start.md#csfle-quick-start)
