Class DecryptingReader

Direct Known Subclasses:
AsymmetricDecryptingReader, SymmetricDecryptingReader

public abstract class DecryptingReader extends IntegrationProxyReader
Base class for proxy readers that decrypt the selected fields of each record in place, or every field when none are selected.
  • Field Details

    • fields

      protected final FieldList fields
    • deserializer

      protected BinaryDeserializer deserializer
    • cipher

      protected Cipher cipher
  • Constructor Details

    • DecryptingReader

      public DecryptingReader(DataReader nestedDataReader)
  • Method Details

    • getFields

      public FieldList getFields()
      Returns the fields to decrypt; when empty, every top-level field of each record is decrypted.
    • addFields

      public DecryptingReader addFields(Collection<String> fieldNames)
      Adds fields to decrypt; only allowed before the reader is opened.
    • addFields

      public DecryptingReader addFields(String... fieldNames)
      Adds fields to decrypt; only allowed before the reader is opened.
    • open

      public void open() throws DataException
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class IntegrationProxyReader
      Throws:
      DataException
    • initCipher

      protected abstract void initCipher()
      Initializes or resets cipher for decryption; called when the reader opens and again after a field fails to decrypt.
    • interceptRecord

      protected final Record interceptRecord(Record record) throws Throwable
      Description copied from class: ProxyReader
      Overridden by subclasses to transform, drop, or observe a record on its way through this proxy.

      Contract for subclasses (see also docs/authoring/ProxyReader.md):

      • Return the record (possibly modified) to pass it downstream.
      • Return null to drop the record; the framework reads the next one.
      • Throw to fail the pipeline; the framework wraps the throwable in a DataException with .setRecord(record).
      • The nested DataReader is opened and closed for you; do not read from it here.
      • Do not call DataEndpoint.incrementRecordCount() here.
      Overrides:
      interceptRecord in class ProxyReader
      Throws:
      Throwable
    • decryptField

      protected final void decryptField(Field field) throws Throwable
      Decrypts the field with decryptFieldImpl(Field), re-initializing the cipher if that fails.
      Throws:
      Throwable
    • decryptFieldImpl

      protected abstract void decryptFieldImpl(Field field) throws Throwable
      Replaces the field's encrypted value in place with the original type and value.
      Throws:
      Throwable
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class ProxyReader