Next: , Previous: Message Authentication Codes, Up: Message Authentication Codes


7.1 IMac Interface

diagrams/mac_class_diag.png

Figure 9: Message Authentication Code (MAC) class diagram

— Variable: java.lang.String MAC_KEY_MATERIAL

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.

— Variable: java.lang.String TRUNCATED_SIZE

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.

— Function: void init (java.util.Map attributes) throws java.security.InvalidKeyException, java.lang.IllegalStateException

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.

— Function: void update (byte b)

Continues the computation of the MAC with a single input byte, b.

— Function: void update (byte[] in, int offset, int length)

Continues the computation of the MAC with a portion of the byte array in, starting at offset and considering length bytes.

— Function: byte [] digest ( )

Finishes the computation of the MAC and returns it in a new byte array. The instance is reset after this method returns.

— Function: void reset ( )

Resets the internal state of this instance, which may then be re-initialized.

— Function: int macSize ( )

Returns the size of the final MAC, in bytes.

— Function: java.lang.String name ( )

Returns the canonical name of this algorithm.

— Function: java.lang.Object clone ( )

Returns a copy of this instance, which may be used the same way as the original.

— Function: boolean selfTest ( )

Performs a simple conformance test on this implementation; returns true if the test is successful, false if not.