Head of Developer Education, Developer Relations
In this video, Peter Moskovits (Confluent | Developer Education) explains the principles of envelope encryption and how it’s used to protect field-level data in Kafka workflows. Learn how data encryption keys (DEK) and key encryption keys (KEKs) work together to provide scalable, secure encryption.
Introduction to Envelope Encryption Hello, I'm Peter Moskowitz with Confluent, and we are going to talk about envelope encryption. Many of us feel that security can be intimidating at times, but in this short video, we'll break down envelope encryption, a widely used encryption technique, into simple terms. Why Envelope Encryption Matters for Key Management If you are on a journey to understand how bring your own key and client-side field-level encryption work, you're at the right place. Symmetric Key Encryption Explained Envelope encryption is a scalable encryption technique that combines the performance of symmetric key encryption with the security of public key cryptography, balancing efficiency and strong data protection. Let's start with symmetric key encryption. In symmetric key cryptography, we use a single key for both encrypting and decrypting data. Think of it like a key to a safe. Whoever has the key can both lock and unlock. This method is incredibly fast, making it ideal for encrypting large amounts of data quickly. Imagine a busy server processing tons of data each second. Symmetric encryption keeps it running smoothly. But here's the catch. Since you're using one key, everyone who needs access to the data must have that same key. If you share it with multiple people or systems, the security risks multiply. Limitations of Symmetric Encryption Now, let's take a look at public key encryption. Introduction to Public Key Encryption Unlike symmetric key encryption, public key encryption uses two separate keys, a public key and a private key. The public key is published for anybody to access, allowing them to encrypt messages intended for a specific other party. The private one is kept secret. Anyone can use the public key to encrypt data, but only the private key holder can decrypt it. Think of it like a mail slot on a door. Anyone can drop in a letter, but only the owner with the key to the door has access to all the mail delivered. This eliminates the need to share a single key between the party doing the encryption and the one doing the decryption, which simplifies key management and adds security. But the downside? Public key encryption is slower, making it less suitable for handling massive data volumes. What makes envelope encryption shine How Envelope Encryption Combines Both Methods is that it combines the best of both worlds, the speed of symmetric key cryptography and the security of public key encryption. This makes it ideal when you have both high security and high performance requirements. Envelope encryption uses a two-phase encryption and decryption method. First things first, encryption. The data is encrypted with a data encryption key, or D-E-K, DEC, using symmetric key encryption. This data encryption key is just a randomly generated key used only for this data, keeping the encryption fast and efficient. Next, the data encryption key itself needs protection, so we encrypt the data encryption key with the public half of the key encryption key, or K-E-K, KEK, using public key encryption. This keeps the data encryption key safe and makes it accessible only to authorized users The Two-Phase Encryption Process (DEK and KEK) who have the key encryption key. Once the data encryption key is securely encrypted, it's often stored along with the encrypted data. This will streamline our decryption process. With this two-step approach, we get the speed benefits of symmetric encryption and the added security of using public private keys. Decryption is similar, but takes place in reverse order. First, we must get a hold of our encrypted data and encrypted data encryption key. After retrieving our private key encryption key from the key management store, often sitting in a cloud vendor's KMS, in step one, we decrypt the data encryption key. Our data encryption key was encrypted using public key cryptography, and the key encryption key is our private key that allows us to decrypt it. This is a relatively slower operation, but we only need to perform it once. Decryption Steps and Performance Benefits Step two is decrypting the encrypted data itself. To do this, we will need our decrypted data encryption key. As you probably guessed, here we are using symmetric key cryptography, which is a performant operation. We keep using our data encryption key for decryption as long as we have data to decrypt. Another important benefit of envelope encryption Key Rotation and Security Maintenance is how it simplifies security maintenance. By focusing on rotating the key encryption key rather than the data encryption key, we maintain security access without re-encrypting all the data. This approach lets administrators periodically refresh encryption, protecting data encryption keys, and keeping the data secure without a large processing burden. Managing key encryption keys securely is essential, and leading cloud providers offer key management systems, KMSs to handle this. Cloud Key Management Systems (KMS) Overview Key management systems like AWS KMS, Google Cloud KMS, Azure Key Vault, HashiCorp Vault provide secure environments for creating, storing, and rotating key encryption keys. They streamline the process so you don't have to manually manage key security. Envelope encryption combines Final Summary and Use Cases symmetric key cryptography for speed and public key cryptography for security. By encrypting the data encryption key with the key encryption key, it enables efficient data protection with simplified key management. Envelope encryption is gaining popularity, especially for scenarios where security, scalability, and performance are critical. Typical use cases include bring your own key and client-side field-level encryption. If you haven't done so already, check out my video on client-side field-level encryption. Thanks for joining me.
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.