Package com.microej.crypto.test
Class MacTest
- java.lang.Object
-
- com.microej.crypto.test.MacTest
-
public class MacTest extends java.lang.ObjectTo generate hmac with an hex key : - Use this site : https://cryptii.com/pipes/hmac - Or following openssl command : echo -n "Hi There" | openssl dgst -sha256 -mac HMAC -macopt hexkey:0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
-
-
Constructor Summary
Constructors Constructor Description MacTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestHmacMD5()Test HmacMD5 algorithm with various messages and key sizesvoidtestHmacSHA1()Test HmacSHA1 algorithm with various messages and key sizesvoidtestHmacSHA256()Test HmacSHA256algorithm with various messages and key sizesvoidtestMacAtNonZeroOffsets()A MAC computed from a sub-range and written at an offset lands where it was asked to, is the published value, and leaves the rest of the output alone, for each algorithm.
-
-
-
Method Detail
-
testHmacSHA256
public void testHmacSHA256() throws java.lang.ExceptionTest HmacSHA256algorithm with various messages and key sizes- Throws:
java.lang.Exception
-
testHmacSHA1
public void testHmacSHA1() throws java.lang.ExceptionTest HmacSHA1 algorithm with various messages and key sizes- Throws:
java.lang.Exception
-
testHmacMD5
public void testHmacMD5() throws java.lang.ExceptionTest HmacMD5 algorithm with various messages and key sizes- Throws:
java.lang.Exception
-
testMacAtNonZeroOffsets
public void testMacAtNonZeroOffsets() throws java.lang.ExceptionA MAC computed from a sub-range and written at an offset lands where it was asked to, is the published value, and leaves the rest of the output alone, for each algorithm.The input offset reaches the backend. The output offset does not:
Mac.doFinal(byte[], int)copies the MAC into place itself, so that half of the case checks the library.- Throws:
java.lang.Exception
-
-