demo.md
Class HMac

java.lang.Object
  |
  +--demo.md.HMac

public class HMac
extends Object

This class tests HMac implementation using MD5 as hash algorithm as specified in RFC 2104.


Constructor Summary
HMac()
           
 
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.
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

HMac

public HMac()
Method Detail

hmac

public boolean hmac(String algorithm,
                    byte[] key,
                    byte[] data,
                    byte[] correct)
             throws Exception
Computes the HMAC on the given data using the given key, and compares the result with the given pre-computed correct value.
Parameters:
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 computation
data - the data on which the MAC shall be computed
correct - the pre-computed correct value for verifying the rseult of the MAC computation
Returns:
true if the MAC computation yields the correct result false otherwise

start

public void start()
Tests the HMAC algorithm using Md5 for hash computation.
Returns:
true if the test yields the correct result, false otherwise

main

public static void main(String[] arg)
                 throws IOException
Performs some tests for HMAC.

This Javadoc may contain text parts from IETF Internet Standard specifications, see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note).

IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC