Class AsymmetricDecryptingReader


public class AsymmetricDecryptingReader extends DecryptingReader
A DecryptingReader for fields written by an AsymmetricEncryptingReader; it recovers the symmetric key from the first value it decrypts, using the private key, and uses it for all values.
  • Constructor Details

    • AsymmetricDecryptingReader

      public AsymmetricDecryptingReader(DataReader nestedDataReader)
    • AsymmetricDecryptingReader

      public AsymmetricDecryptingReader(DataReader nestedDataReader, String asymmetricAlgorithm, PrivateKey asymmetricKey)
  • Method Details

    • getAsymmetricAlgorithm

      public String getAsymmetricAlgorithm()
      Returns the algorithm used with the private key to decrypt the symmetric key, such as RSA; required to open the reader.
    • setAsymmetricAlgorithm

      public AsymmetricDecryptingReader setAsymmetricAlgorithm(String asymmetricAlgorithm)
      Sets the algorithm used with the private key to decrypt the symmetric key, such as RSA; required to open the reader.
    • getAsymmetricKey

      public PrivateKey getAsymmetricKey()
      Returns the private key used to decrypt the symmetric key; required to open the reader.
    • setAsymmetricKey

      public AsymmetricDecryptingReader setAsymmetricKey(PrivateKey asymmetricKey)
      Sets the private key used to decrypt the symmetric key; required to open the reader.
    • getSymmetricAlgorithm

      public String getSymmetricAlgorithm()
      Returns the algorithm of the symmetric key that encrypted the fields (default is AES).
    • setSymmetricAlgorithm

      public AsymmetricDecryptingReader setSymmetricAlgorithm(String symmetricAlgorithm)
      Sets the algorithm of the symmetric key that encrypted the fields (default is AES).
    • addFields

      public AsymmetricDecryptingReader addFields(Collection<String> fieldNames)
      Description copied from class: DecryptingReader
      Adds fields to decrypt; only allowed before the reader is opened.
      Overrides:
      addFields in class DecryptingReader
    • addFields

      public AsymmetricDecryptingReader addFields(String... fieldNames)
      Description copied from class: DecryptingReader
      Adds fields to decrypt; only allowed before the reader is opened.
      Overrides:
      addFields in class DecryptingReader
    • initCipher

      protected void initCipher()
      Description copied from class: DecryptingReader
      Initializes or resets DecryptingReader.cipher for decryption; called when the reader opens and again after a field fails to decrypt.
      Specified by:
      initCipher in class DecryptingReader
    • decryptFieldImpl

      protected void decryptFieldImpl(Field field) throws Throwable
      Description copied from class: DecryptingReader
      Replaces the field's encrypted value in place with the original type and value.
      Specified by:
      decryptFieldImpl in class DecryptingReader
      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 DecryptingReader