Interface ChunkedMacVerification


  • public interface ChunkedMacVerification
    An interface representing a verification of the Streaming MAC.

    WARNING: Implementations of this interface are not thread-safe, so the caller must ensure thread-safety if accessing objects implementing this interface concurrently.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void update​(java.nio.ByteBuffer data)
      Processes the next chunk of input, represented by ByteBuffer data.
      void verifyMac()
      Verifies that the provided data matches the tag.
    • 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 verifyMac()
        java.security.GeneralSecurityException - when something went wrong with the update
      • verifyMac

        void verifyMac()
                throws java.security.GeneralSecurityException
        Verifies that the provided data matches the tag. 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 the tag does not match the data