liveBook · Manning

End-to-end encryption

As explained in Apache Kafka in Action

End-to-end encryption is encryption in which data is encrypted by the originating endpoint and decrypted only by the intended receiving endpoint, without readable intermediaries.

End-to-end encryption protects highly sensitive Kafka data when transport encryption, authentication, authorization, and disk encryption do not protect against administrators with server or Kafka administrator rights. The producer encrypts the data, and only the intended consumer decrypts it; Kafka handles the message without readable contents. section 13.2 section 13.2.5

Figure 13.3 Securing a Kafka cluster involves transport encryption for communication, user authentication and authorization, and encryption of data at rest.
A screenshot of a computer screen

AI-generated content may be incorrect.

Use the security-layer diagram to distinguish end-to-end encryption from transport encryption, authentication, authorization, and encryption at rest. section 13.2

A practical Kafka implementation follows these principles:

  • Implement encryption in producers and consumers because Kafka has no native end-to-end encryption support. section 13.2.5
  • Wrap the regular serializer: serialize the message first, then encrypt the resulting byte array; reverse the order in the deserializer. section 13.2.5
  • Manage encryption keys through a dedicated process, potentially using Vault. section 13.2.5 section 13.4
  • Treat proxy-based encryption cautiously: a proxy can read messages when producer-to-proxy and proxy-to-consumer paths remain unencrypted. section 13.2.5
  • Expect encrypted data to compress poorly because encryption makes it appear random. section 13.2.5

Encrypting a Kafka message

An application serializes a sensitive event as JSON, encrypts the serialized bytes in its producer, and publishes the ciphertext. Kafka stores and forwards the ciphertext. The consumer receives it, decrypts it, and then deserializes the original event. A serializer/deserializer wrapper supports whole-message encryption; encrypting individual fields requires a different approach. section 13.2.5

How Apache Kafka in Action covers it

How deep it goes
Explains client-side placement, serializer flow, proxy limitations, key management, field-encryption limits, and compression effects.
Examples
Uses JSON serialization, encrypted byte arrays, Kafka Connect Kryptonite, Conduktor Proxy, Kroxylicious, and Vault as implementation references.
What it assumes
Assumes Kafka producer and consumer concepts while distinguishing end-to-end protection from transport and disk encryption.
What you can do after
Build client-side message protection by wrapping Kafka serialization and deserialization with encryption and a managed key process.
How it connects
Connects Kafka producers and consumers with serializers, deserializers, encryption at rest, network encryption, proxies, and key management.

Also explained in

Compare how 3 books explain end-to-end encryption →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Apache Kafka in Action. The section links point to the parts of the book it draws on.