Class Overview
This is an implementation of the HMAC-SHA1 algorithm.
Summary
Public Constructors |
|
HmacSHA1()
Standard constructor, creates a new HmacSHA1 instance.
|
Public Methods |
Object
|
clone()
Returns a clone if the implementation is cloneable.
|
Protected Methods |
byte[]
|
engineDoFinal()
Completes the HMAC computation and resets the HMAC for further use,
maintaining the secret key that the HMAC was initialized with.
|
int
|
engineGetMacLength()
Returns the length of the HMAC in bytes.
|
void
|
engineInit(Key key, AlgorithmParameterSpec params)
Initializes the HMAC with the given secret key and algorithm parameters.
|
void
|
engineReset()
Resets the HMAC for further use, maintaining the secret key that the
HMAC was initialized with.
|
void
|
engineUpdate(byte[] input, int offset, int len)
Processes the first len bytes in input ,
starting at offset .
|
void
|
engineUpdate(byte input)
Processes the given byte.
|
void
|
engineUpdate(ByteBuffer input)
Processes input.remaining() bytes in the ByteBuffer
input , starting at input.position() .
|
[Expand]
Inherited Methods |
From class
javax.crypto.MacSpi
Object
|
clone()
Returns a clone if the implementation is cloneable.
|
abstract
byte[]
|
engineDoFinal()
Completes the MAC computation and resets the MAC for further use,
maintaining the secret key that the MAC was initialized with.
|
abstract
int
|
engineGetMacLength()
Returns the length of the MAC in bytes.
|
abstract
void
|
engineInit(Key key, AlgorithmParameterSpec params)
Initializes the MAC with the given (secret) key and algorithm
parameters.
|
abstract
void
|
engineReset()
Resets the MAC for further use, maintaining the secret key that the
MAC was initialized with.
|
abstract
void
|
engineUpdate(byte[] input, int offset, int len)
Processes the first len bytes in input ,
starting at offset inclusive.
|
abstract
void
|
engineUpdate(byte input)
Processes the given byte.
|
void
|
engineUpdate(ByteBuffer input)
Processes input.remaining() bytes in the ByteBuffer
input , starting at input.position() .
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
Public Constructors
public
HmacSHA1
()
Standard constructor, creates a new HmacSHA1 instance.
Verify the SunJCE provider in the constructor.
Public Methods
public
Object
clone
()
Returns a clone if the implementation is cloneable.
Returns
- a clone if the implementation is cloneable.
Protected Methods
protected
byte[]
engineDoFinal
()
Completes the HMAC computation and resets the HMAC for further use,
maintaining the secret key that the HMAC was initialized with.
protected
int
engineGetMacLength
()
Returns the length of the HMAC in bytes.
Returns
- the HMAC length in bytes.
Initializes the HMAC with the given secret key and algorithm parameters.
Parameters
key
| the secret key. |
params
| the algorithm parameters. |
protected
void
engineReset
()
Resets the HMAC for further use, maintaining the secret key that the
HMAC was initialized with.
protected
void
engineUpdate
(byte[] input, int offset, int len)
Processes the first len
bytes in input
,
starting at offset
.
Parameters
input
| the input buffer. |
offset
| the offset in input where the input starts. |
len
| the number of bytes to process.
|
protected
void
engineUpdate
(byte input)
Processes the given byte.
Parameters
input
| the input byte to be processed.
|
protected
void
engineUpdate
(ByteBuffer input)
Processes input.remaining()
bytes in the ByteBuffer
input
, starting at input.position()
.
Upon return, the buffer's position will be equal to its limit;
its limit will not have changed.
Subclasses should consider overriding this method if they can
process ByteBuffers more efficiently than byte arrays.