|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.HMACCryptoToken
public abstract class HMACCryptoToken
Implements the HMAC crypto token.
Note: This class must be extended in order to override the default implementation.
Note: It is considered good practice to implement the equals and hashCode methods when extending this class. Otherwise, odd behaviour can occur.
Constructor Summary | ||
---|---|---|
|
protected |
HMACCryptoToken()
Creates a new HMACCryptoToken object. |
Method Summary | ||
---|---|---|
|
CryptoTokenMACKeyData |
createKey(int length)
Creates a key of a specified length on the crypto token. |
|
void |
deleteKey(CryptoTokenMACKeyData data)
Delete the specified key on the crypto token. |
|
byte[] |
extractKeyData(CryptoTokenMACKeyData cryptoTokenData)
Returns the key data contained in the crypto token. |
|
int |
extractKeyLength(CryptoTokenMACKeyData cryptoTokenData)
Returns the key length of the crypto token. |
|
String |
getAlgorithm()
Returns the algorithm supported by this token, ie "HMAC". |
|
int |
getMAC(CryptoTokenMACContext context,
byte[] buffer,
int offset,
boolean reset)
Returns the Message Authetication Code (MAC) associated with the crypto token. |
|
CryptoTokenMACContext |
initialize(CryptoTokenMACKeyData keyData,
Digest digest)
Initializes the crypto token. |
|
CryptoTokenMACKeyData |
injectKey(byte[] key,
int offset,
int length)
Injects the specified raw key data into the crypto token. |
|
boolean |
providesUserAuthentication()
Returns true if the token provides its own user authentication checks, eg a smartcard will prompt for a password before allowing access to the keys. |
|
void |
reset(CryptoTokenMACContext context)
Resets the crypto token. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected HMACCryptoToken()
HMACCryptoToken
object.
This constructor is not used.
Method Detail |
---|
public final String getAlgorithm()
This method will always return the String "HMAC".
getAlgorithm
in interface CryptoToken
public boolean providesUserAuthentication()
providesUserAuthentication
in interface CryptoToken
public int extractKeyLength(CryptoTokenMACKeyData cryptoTokenData) throws CryptoUnsupportedOperationException, CryptoTokenException
cryptoTokenData
- The data associated with the crypto token.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public byte[] extractKeyData(CryptoTokenMACKeyData cryptoTokenData) throws CryptoUnsupportedOperationException, CryptoTokenException
cryptoTokenData
- The data associated with the crypto token.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public CryptoTokenMACContext initialize(CryptoTokenMACKeyData keyData, Digest digest) throws CryptoUnsupportedOperationException, CryptoTokenException
keyData
- The key data associated with the crypto token.digest
- The digest used to initialize the crypto token.
CryptoTokenMACContext
object.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public void reset(CryptoTokenMACContext context) throws CryptoTokenException
context
- The context of the crypto token.
CryptoTokenException
- Thrown if an error occurs with the crypto
token or the crypto token is invalid.public int getMAC(CryptoTokenMACContext context, byte[] buffer, int offset, boolean reset) throws CryptoTokenException
context
- The context of the crypto token.buffer
- The byte array to contain the MAC.offset
- The offset, or start position, of the MAC data within the
array.
CryptoTokenException
- Thrown if an error occurs with the crypto
token or the crypto token is invalid.public CryptoTokenMACKeyData createKey(int length) throws CryptoUnsupportedOperationException, CryptoTokenException
length
- An integer that represents the length of the key, in bytes.
CryptoTokenMACKeyData
object associated with the
crypto token.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.
CryptoTokenException
- Thrown if an error occurs with a crypto token
or the crypto token is invalid.public CryptoTokenMACKeyData injectKey(byte[] key, int offset, int length) throws CryptoUnsupportedOperationException, CryptoTokenException
key
- A byte array containing the key.offset
- The offset, or start position, of the key within the array.length
- The length of the key, in bytes.
CryptoUnsupportedOperationException
- Thrown if a call is made to
an unsupported operation.
CryptoTokenException
- Thrown if an error occurs with a crypto
token or the crypto token is invalid.public void deleteKey(CryptoTokenMACKeyData data) throws CryptoTokenException, CryptoUnsupportedOperationException
data
- The key data contained within the token.
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.
|
|||||||||
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