Class HmacSHA1
- java.lang.Object
-
- 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
Constructors Constructor Description HmacSHA1()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(Key key, int length)Initialize with the keybyte[]sign()Signs the datavoidupdate(byte data)voidupdate(byte[] data)update the engine with datavoidupdate(byte[] data, int offset, int len)booleanverify(byte[] signature)Verifies the signature
-
-
-
Method Detail
-
init
public void init(Key key, int length) throws InvalidKeyException
Initialize with the key- Parameters:
key- a Hmac keylength- 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 SignatureExceptionSigns the data- Throws:
SignatureException
-
verify
public boolean verify(byte[] signature) throws SignatureExceptionVerifies the signature- Parameters:
signature- the signature to be verified- Throws:
SignatureException
-
-