IMac Interface
diagrams/mac_class_diag.png
Figure 9: Message Authentication Code (MAC) class diagram
java.lang.String MAC_KEY_MATERIAL
Variable
A key in the attributes map passed to the init method. The value
is taken to be a byte array, which contains the key as raw bytes. The
length of the key must be at least the length of the computed hash in
the case of hash-based MACs.
java.lang.String TRUNCATED_SIZE
Variable
The actual size of the returned hash, taken from the first bytes of the
raw result. The value must be a java.lang.Integer containing the
desired length, which should not be smaller than 80 bits or one half the
MAC's usual output length, whichever is larger.
void init(java.util.Map attributes) throws java.security.InvalidKeyException, java.lang.IllegalStateException
Function
Initializes this MAC instance with a specified attributes map, which
maps keys (such as MAC_KEY_MATERIAL) to parameters (such as the
key bytes). Throws a java.security.InvalidKeyException if the key
is unacceptable or omitted, and trows a
java.lang.IllegalStateException if this instance has already been
initialized.
void update(byte b)
Function
Continues the computation of the MAC with a single input byte, b.
void update(byte[]in, int offset, int length)
Function
Continues the computation of the MAC with a portion of the byte array
in, starting at offset and considering length bytes.
byte [] digest ()
Function
Finishes the computation of the MAC and returns it in a new byte array.
The instance is reset after this method returns.
void reset()
Function
Resets the internal state of this instance, which may then be
re-initialized.
int macSize()
Function
Returns the size of the final MAC, in bytes.
java.lang.String name()
Function
Returns the canonical name of this algorithm.
java.lang.Object clone()
Function
Returns a copy of this instance, which may be used the same way as the
original.
boolean selfTest()
Function
Performs a simple conformance test on this implementation; returns
true if the test is successful, false if not.