Interface ByteSourceBroker

All Known Implementing Classes:
SimpleByteSourceBroker

public interface ByteSourceBroker
ByteSourceBroker holds an encrypted value to decrypt it on demand.
useBytes(ByteSourceUser) method is designed for dictating developers to use the byte source in a special way, to prevent its prevalence and difficulty of managing invalid input: '&' zeroing that critical information at end of use.
For exceptional cases we allow developers to use the other method, getClonedBytes(), but it's not advised.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    As the name implies, this returns a cloned byte array and caller has a responsibility to wipe it out at end of use.
    void
    This method accepts an implementation of ByteSourceUser functional interface.
  • Method Details

    • useBytes

      void useBytes(ByteSourceUser user)
      This method accepts an implementation of ByteSourceUser functional interface.
      To limit the decrypted value's existence, developers should maintain the implementation part as short as possible.
      Parameters:
      user - Implements a use-case for the decrypted value.
    • getClonedBytes

      byte[] getClonedBytes()
      As the name implies, this returns a cloned byte array and caller has a responsibility to wipe it out at end of use.