Skip to content

Demonstrates AWS KMS based envelope encryption on Kafka messaging

License

Notifications You must be signed in to change notification settings

ak47/kafka_envelope_encryption_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Demonstration of envelope encryption on Kafka messaging.

This is a proof of concept demonstrating envelope encryption using AWS KMS for key management and simple Kafka message producing/consuming.

The code demonstrates two approaches for passing the Data Encryption Key (DEK) and the Initialization Vector (IV):

  1. Pass by headers
  • The encrypted message is passed as Base64 encoded directly as the payload.
  • The DEK & IV are passed as Base64 encoded values via a headers Python dict.
  1. Pass by message body.
  • Achieved by constructing a Python dict where all encrypted byte type values are Base64 encoded and then transformed into a JSON dumped string.

To reproduce this demo:

  1. export AWS credentials to the working terminal:
  • export AWS_ACCESS_KEY_ID="< your key id >"
  • export AWS_SECRET_ACCESS_KEY="< your access key >"
  • For my fellow Hinge Health Engineers, you can obtain valid DEV keys from HingePowerUser role.
  1. Add an AWS CMK Key ARN to encryption.py KEY_ID
  • Hinge Health Engineers, this can be generated via HingePowerUser role under the Key Management Service interface.
  • Note: this code is set for us-east-1 zone.
  1. Follow the steps in the resource Kafka Producer/Consumer Python Tutorial

  2. Alter the payload examples to demonstrate your use case. Alter the DEK/IV passing mechanism to ensure your understanding.

Resources:

About

Demonstrates AWS KMS based envelope encryption on Kafka messaging

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages