Package com.google.crypto.tink.mac
Interface ChunkedMacComputation
-
public interface ChunkedMacComputationAn 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.voidupdate(java.nio.ByteBuffer data)Processes the next chunk of input, represented byByteBuffer data.
-
-
-
Method Detail
-
update
void update(java.nio.ByteBuffer data) throws java.security.GeneralSecurityExceptionProcesses the next chunk of input, represented byByteBuffer data. In particular, reads thedata.remaining()number of bytes from the provided buffer, starting at the byte with positiondata.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.GeneralSecurityExceptionComputes 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 oncejava.security.GeneralSecurityException- when something went wrong with the computation
-
-