Interface ChunkedMacComputation


  • public interface ChunkedMacComputation
    An interface representing a computation of the Streaming MAC.

    WARNING: Implementations of this interface are not thread-safe, so the caller must ensure correctness in case of concurrent use of an instance of this class.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] computeMac()
      Computes a tag for the provided data.
      void update​(java.nio.ByteBuffer data)
      Processes the next chunk of input, represented by ByteBuffer data.
    • Method Detail

      • update

        void update​(java.nio.ByteBuffer data)
             throws java.security.GeneralSecurityException
        Processes the next chunk of input, represented by ByteBuffer data. In particular, reads the data.remaining() number of bytes from the provided buffer, starting at the byte with position data.position().

        Updates the inner state of the computation. Requires exclusive access.

        NOTE: arbitrary slicing of data is permitted, i.e. a series of update()'s with inputs "ab", "cd", and "ef" produces the same result as a series of inputs "abc", "def".

        Throws:
        java.lang.IllegalStateException - if called after computeMac()
        java.security.GeneralSecurityException - when something went wrong with the update
      • computeMac

        byte[] computeMac()
                   throws java.security.GeneralSecurityException
        Computes a tag for the provided data. After this method has been called, the object can no longer be used.

        Requires exclusive access.

        Throws:
        java.lang.IllegalStateException - when called more than once
        java.security.GeneralSecurityException - when something went wrong with the computation