-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encrypted and decrypt data in the Kafka buffer (#3468)
Encrypt and decrypt data in the Kafka buffer when the user configures. Use a KMS key to decrypt the data encryption key, if one is provided. Resolves #3422 Signed-off-by: David Venable <[email protected]>
- Loading branch information
Showing
39 changed files
with
1,233 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...src/main/java/org/opensearch/dataprepper/plugins/kafka/common/KafkaDataConfigAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.opensearch.dataprepper.plugins.kafka.common; | ||
|
||
import org.opensearch.dataprepper.plugins.kafka.common.key.KeyFactory; | ||
import org.opensearch.dataprepper.plugins.kafka.configuration.TopicConfig; | ||
import org.opensearch.dataprepper.plugins.kafka.util.MessageFormat; | ||
|
||
import java.util.function.Supplier; | ||
|
||
/** | ||
* Adapts a {@link TopicConfig} to a {@link KafkaDataConfig}. | ||
*/ | ||
public class KafkaDataConfigAdapter implements KafkaDataConfig { | ||
private final KeyFactory keyFactory; | ||
private final TopicConfig topicConfig; | ||
|
||
public KafkaDataConfigAdapter(KeyFactory keyFactory, TopicConfig topicConfig) { | ||
this.keyFactory = keyFactory; | ||
this.topicConfig = topicConfig; | ||
} | ||
|
||
@Override | ||
public MessageFormat getSerdeFormat() { | ||
return topicConfig.getSerdeFormat(); | ||
} | ||
|
||
@Override | ||
public Supplier<byte[]> getEncryptionKeySupplier() { | ||
if(topicConfig.getEncryptionKey() == null) | ||
return null; | ||
return keyFactory.getKeySupplier(topicConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.