In this example, an encryption key reference is stored in the record payload. The encryption key is generated by (and stored in) the key repository. Two records with the same record’s key embed the same encryption key reference. The key repository in this example is a simple in memory repository but it would be a key vault such as Google Cloud KMS or Hashicorp Vault in a real world example.
cd samples/kafka-encryption-keyrepo-sample
docker-compose up # on windows and OSX, you need to adjust
sh runSamples.sh
link:./src/main/java/io/quicksign/kafka/crypto/samples/keyrepo/SamplesMain.java[role=include]
link:./src/main/java/io/quicksign/kafka/crypto/samples/keyrepo/SampleProducer.java[role=include]