Package de.otto.kafka.messaging.e2ee
Class EncryptionService
java.lang.Object
de.otto.kafka.messaging.e2ee.EncryptionService
This class do encrypt a message or payload.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEncryptionService(EncryptionKeyProvider encryptionKeyProvider) This constructor should be used in production.EncryptionService(EncryptionKeyProvider encryptionKeyProvider, InitializationVectorFactory initializationVectorFactory) This constructor should be used in unit tests only. -
Method Summary
Modifier and TypeMethodDescriptionencryptPayloadWithAes(String kafkaTopicName, byte[] plainPayload) encrypts the given payload (depending on the topic related configuration).encryptPayloadWithAes(String kafkaTopicName, String plainText) encrypts the given payload (depending on the topic related configuration).
-
Constructor Details
-
EncryptionService
This constructor should be used in production.- Parameters:
encryptionKeyProvider- a EncryptionKeyProvider
-
EncryptionService
public EncryptionService(EncryptionKeyProvider encryptionKeyProvider, InitializationVectorFactory initializationVectorFactory) This constructor should be used in unit tests only.- Parameters:
encryptionKeyProvider- a EncryptionKeyProviderinitializationVectorFactory- a test InitializationVectorFactory
-
-
Method Details
-
encryptPayloadWithAes
encrypts the given payload (depending on the topic related configuration).- Parameters:
kafkaTopicName- name of the Kafka Topic the message is for.plainPayload- the plain text payload.- Returns:
- The encrypted payload
-
encryptPayloadWithAes
encrypts the given payload (depending on the topic related configuration).- Parameters:
kafkaTopicName- name of the Kafka Topic the message is for.plainText- the plain text payload.- Returns:
- The encrypted payload
-