|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.deas.hyperenc.HyperMAC
public class HyperMAC
Represents a MAC computed with the Hyper-Encryption Message Authentication Code (HEMAC) algorithm. Also includes methods to compute and verify HEMACs.
HEMAC makes use of HMAC, specified in RFC 2104. HEMAC makes use of a cryptographic hash function h with output length L, and a secret key K of length 2L. The HEMAC of a message x is computed as follows:
HEMAC(K, x) = K[0:L] ^ HMACh(K[L:2L], x)where ^ represents the XOR operation, and K[i:j] represents the ith through jth bits of K (including i, but excluding j).
HEMAC uses a similar naming scheme as HMAC: for example, if the underlying hash function h is SHA1, then the resulting HEMAC is called HEMAC-SHA1.
Constructor Summary | |
---|---|
HyperMAC(List<Integer> blockList,
byte[] mac)
Constructs a new HEMAC blob. |
Method Summary | |
---|---|
static byte[] |
computeMac(Mac hmac,
byte[] key,
byte[] msg)
Computes the HEMAC of msg using the given secret key and HMAC
instance. |
List<Integer> |
getBlockList()
Returns the list of IDs that identify the encryption blocks used for the key to this HEMAC. |
byte[] |
getMac()
Returns the HEMAC value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HyperMAC(List<Integer> blockList, byte[] mac)
blockList
- List of encryption block IDs used as the HEMAC key.mac
- The HEMAC value itself.Method Detail |
---|
public List<Integer> getBlockList()
public byte[] getMac()
public static final byte[] computeMac(Mac hmac, byte[] key, byte[] msg) throws InvalidKeyException
msg
using the given secret key and HMAC
instance.
hmac
- A Mac
instance representing the HMAC to be used by this
HEMAC. This Mac
object will be initialized using
Mac.init(Key)
, so any state it currently holds will be lost.key
- The secret key for this HEMAC. Must be exactly twice the length of
the length of the output of hmac
.msg
- The message for which to compute the HEMAC.
msg
, using the specified HMAC and key.
InvalidKeyException
- if the provided key has incorrect length
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |