Class DecryptionService

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

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

  • Method Details

    • decryptToByteArray

      public byte[] decryptToByteArray(String kafkaTopicName, AesEncryptedPayload encryptedPayload)
      decrypts the given payload (depending on the content).
      Parameters:
      kafkaTopicName - name of the Kafka Topic the field value is from.
      encryptedPayload - the (potentially) encrypted payload.
      Returns:
      The plain text payload
    • decryptToString

      public String decryptToString(String kafkaTopicName, AesEncryptedPayload encryptedPayload)
      decrypts the given payload (depending on the content).
      Parameters:
      kafkaTopicName - name of the Kafka Topic the field value is from.
      encryptedPayload - the (potentially) encrypted payload.
      Returns:
      The plain text
    • hasSameEncryptionFlag

      public boolean hasSameEncryptionFlag(String kafkaTopicName, AesEncryptedPayload encryptedPayload)
      This method checks if the encryption "flag" of the kafka topic matches the payload. This method can be used by a kafka topic consumer the control the kafka producer.
      Parameters:
      kafkaTopicName - name of the Kafka Topic the payload is from.
      encryptedPayload - the (potentially) encrypted payload.
      Returns:
      true when the topic is marked as encrypted and the payload is encrypted or when the topic is not encrypted as well as the payload.