Class EncryptionService

java.lang.Object
de.otto.kafka.messaging.e2ee.EncryptionService

public final class EncryptionService extends Object
This class do encrypt a message or payload.
See Also:
  • Constructor Details

    • EncryptionService

      public EncryptionService(EncryptionKeyProvider encryptionKeyProvider)
      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 EncryptionKeyProvider
      initializationVectorFactory - a test InitializationVectorFactory
  • Method Details

    • encryptPayloadWithAes

      public AesEncryptedPayload encryptPayloadWithAes(String kafkaTopicName, byte[] plainPayload)
      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

      public AesEncryptedPayload encryptPayloadWithAes(String kafkaTopicName, String plainText)
      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