public class HmacSHA1 extends Object
| Constructor and Description |
|---|
HmacSHA1() |
| Modifier and Type | Method and Description |
|---|---|
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
|
public void init(Key key, int length) throws InvalidKeyException
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)InvalidKeyException - if key is nullpublic void update(byte[] data)
data - information to be signed or verifiedpublic void update(byte data)
public void update(byte[] data,
int offset,
int len)
public byte[] sign()
throws SignatureException
SignatureExceptionpublic boolean verify(byte[] signature)
throws SignatureException
signature - the signature to be verifiedSignatureExceptionCopyright © 2005–2018 Oracle Corporation. All rights reserved.