com.sun.xml.ws.security.opt.crypto.dsig.internal
Class HmacSHA1

java.lang.Object
  extended by com.sun.xml.ws.security.opt.crypto.dsig.internal.HmacSHA1

public class HmacSHA1
extends Object

An implementation of the HMAC-SHA1 (RFC 2104)

Author:
Joyce Leung

Constructor Summary
HmacSHA1()
           
 
Method Summary
 void init(Key key, int length)
          Initialize with the key
 byte[] sign()
          Signs the data
 void update(byte data)
           
 void update(byte[] data)
          update the engine with data
 void update(byte[] data, int offset, int len)
           
 boolean verify(byte[] signature)
          Verifies the signature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HmacSHA1

public HmacSHA1()
Method Detail

init

public void init(Key key,
                 int length)
          throws InvalidKeyException
Initialize with the key

Parameters:
key - a Hmac key
length - output length in byte. length should be > 0 for a specified length or -1 for unspecified length (length of the signed output)
Throws:
InvalidKeyException - if key is null

update

public void update(byte[] data)
update the engine with data

Parameters:
data - information to be signed or verified

update

public void update(byte data)

update

public void update(byte[] data,
                   int offset,
                   int len)

sign

public byte[] sign()
            throws SignatureException
Signs the data

Throws:
SignatureException

verify

public boolean verify(byte[] signature)
               throws SignatureException
Verifies the signature

Parameters:
siganture - the signature to be verified
Throws:
SignatureException


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.