|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.AbstractMAC
net.rim.device.api.crypto.HMAC
public final class HMAC
HMAC
is a Message Authentication Code algorithm based on a
Digest
function. HMAC is defined in RFC 2104.
For information on cryptographic algorithms, see Crypto Algorithms.
Constructor Summary | ||
---|---|---|
|
HMAC(HMACKey key,
Digest digest)
Creates an instance of the HMAC object with a given key as the MAC key,
using a specified digest as the hash function. |
Method Summary | ||
---|---|---|
|
String |
getAlgorithm()
Returns the name of this digest, ie "HMAC/" + Digest.getAlgorithm() . |
|
int |
getLength()
Returns the length of the HMAC in bytes. |
|
int |
getMAC(byte[] buffer,
int offset,
boolean reset)
Puts the MAC of all the input data since the last reset into the given buffer starting at the specified offset. |
|
void |
reset()
Resets the hashing of the HMAC. |
|
void |
update(byte[] data,
int offset,
int length)
Feeds more data into the MAC algorithm. |
|
void |
update(int data)
Feeds more data into the MAC algorithm. |
Methods inherited from class net.rim.device.api.crypto.AbstractMAC |
---|
checkMAC, checkMAC, checkMAC, checkMAC, getMAC, getMAC, getMAC, update |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.rim.device.api.crypto.MAC |
---|
checkMAC, checkMAC, checkMAC, checkMAC, getMAC, getMAC, getMAC, update |
Constructor Detail |
---|
public HMAC(HMACKey key, Digest digest) throws CryptoTokenException, CryptoUnsupportedOperationException
HMAC
object with a given key as the MAC key,
using a specified digest as the hash function.
key
- The HMAC key to use with this instance.digest
- The hash function to use with this instance.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.Method Detail |
---|
public String getAlgorithm()
"HMAC/" + Digest.getAlgorithm()
.
getAlgorithm
in interface MAC
getAlgorithm
in class AbstractMAC
public void reset() throws CryptoTokenException
This method resets the underlying digest and then updates that digest with the inner pad.
reset
in interface MAC
reset
in class AbstractMAC
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public int getLength()
getLength
in interface MAC
getLength
in class AbstractMAC
public void update(int data)
AbstractMAC
update
in interface MAC
update
in class AbstractMAC
data
- A byte of input data.public void update(byte[] data, int offset, int length)
AbstractMAC
update
in interface MAC
update
in class AbstractMAC
data
- The array containing the input data.offset
- The offset, or initial position, of the data within the array.length
- The length of the input data, in bytes.public int getMAC(byte[] buffer, int offset, boolean reset) throws CryptoTokenException
AbstractMAC
getMAC
in interface MAC
getMAC
in class AbstractMAC
buffer
- The array to contain the MAC.offset
- The offset, or initial position, of teh MAC data within the buffer.reset
- If true then the MAC is reset.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal