|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--demo.md.HMac
This class tests HMac implementation using MD5 as hash algorithm as specified in RFC 2104.
Constructor Summary | |
HMac()
Default Constructor. |
Method Summary | |
boolean |
hmac(String algorithm,
byte[] key,
byte[] data,
byte[] correct)
Computes the HMAC on the given data using the given key, and compares the result with the given pre-computed correct value. |
boolean |
hmac(String algorithm,
byte[] data,
int keyLength)
Repeatetly computes a HMAC on the given data and compares if the result is always the same. |
boolean |
hmacAll()
Tests the HMAC algorithm for several hash algorithms. |
boolean |
hmacMd5()
Tests the HMAC algorithm using Md5 for hash computation. |
static void |
main(String[] arg)
Performs some tests for HMAC. |
void |
start()
Tests the HMAC algorithm using Md5 for hash computation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HMac()
Method Detail |
public boolean hmac(String algorithm, byte[] key, byte[] data, byte[] correct) throws Exception
algorithm
- the HMAC algorithm to be used, e.g. "HMAC/MD5"key
- the key data to be used for generating a secret key necessary
for MAC computationdata
- the data on which the MAC shall be computedcorrect
- the pre-computed correct value for verifying the rseult
of the MAC computationtrue
if the MAC computation yields the correct result
false
otherwisepublic boolean hmac(String algorithm, byte[] data, int keyLength) throws Exception
algorithm
- the HMAC algorithm to be used, e.g. "HMAC/MD5"data
- the data on which the MAC shall be computedkeyLength
- the length of the key to be usedtrue
if the test succeeds,
false
otherwisepublic void start()
true
if the test yields the correct result,
false
otherwisepublic boolean hmacMd5() throws Exception
true
if the test yields the correct result,
false
otherwisepublic boolean hmacAll() throws Exception
true
if the test yields the correct result,
false
otherwisepublic static void main(String[] arg) throws IOException
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |