SHOW Signed SHOW CryptoExtensionAPI
 

net.rim.device.api.crypto
Class HMACCryptoToken

java.lang.Object
  |
  +--net.rim.device.api.crypto.HMACCryptoToken
All Implemented Interfaces:
CryptoToken, Persistable, Persistable, SymmetricCryptoToken

public abstract class HMACCryptoToken
extends Object
implements SymmetricCryptoToken, Persistable

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.

Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

Since:
JDE 3.6.0

Constructor Summary
 Category: CryptoExtensionAPI Category: Signed protected HMACCryptoToken()
          Creates a new HMACCryptoToken object.
 
Method Summary
 Category: CryptoExtensionAPI Category: Signed  CryptoTokenMACKeyData createKey(int length)
          Creates a key of a specified length on the crypto token.
 Category: CryptoExtensionAPI Category: Signed  void deleteKey(CryptoTokenMACKeyData data)
          Delete the specified key on the crypto token.
 Category: CryptoExtensionAPI Category: Signed  byte[] extractKeyData(CryptoTokenMACKeyData cryptoTokenData)
          Returns the key data contained in the crypto token.
 Category: CryptoExtensionAPI Category: Signed  int extractKeyLength(CryptoTokenMACKeyData cryptoTokenData)
          Returns the key length of the crypto token.
 Category: CryptoExtensionAPI Category: Signed  String getAlgorithm()
          Returns the algorithm supported by this token, ie "HMAC".
 Category: CryptoExtensionAPI Category: Signed  int getMAC(CryptoTokenMACContext context, byte[] buffer, int offset, boolean reset)
          Returns the Message Authetication Code (MAC) associated with the crypto token.
 Category: CryptoExtensionAPI Category: Signed  CryptoTokenMACContext initialize(CryptoTokenMACKeyData keyData, Digest digest)
          Initializes the crypto token.
 Category: CryptoExtensionAPI Category: Signed  CryptoTokenMACKeyData injectKey(byte[] key, int offset, int length)
          Injects the specified raw key data into the crypto token.
 Category: CryptoExtensionAPI Category: Signed  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.
 Category: CryptoExtensionAPI Category: Signed  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

HMACCryptoToken

protected HMACCryptoToken()
Creates a new HMACCryptoToken object.

This constructor is not used.

Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Method Detail

createKey

public CryptoTokenMACKeyData createKey(int length)
                                throws CryptoUnsupportedOperationException,
                                       CryptoTokenException
Creates a key of a specified length on the crypto token.

Parameters:
length - An integer that represents the length of the key, in bytes.
Returns:
The CryptoTokenMACKeyData object associated with the crypto token.
Throws:
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.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

deleteKey

public void deleteKey(CryptoTokenMACKeyData data)
               throws CryptoTokenException,
                      CryptoUnsupportedOperationException
Delete the specified key on the crypto token.

Parameters:
data - The key data contained within the token.
Throws:
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.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

extractKeyData

public byte[] extractKeyData(CryptoTokenMACKeyData cryptoTokenData)
                      throws CryptoUnsupportedOperationException,
                             CryptoTokenException
Returns the key data contained in the crypto token.

Parameters:
cryptoTokenData - The data associated with the crypto token.
Returns:
An integer that represents the length of the key.
Throws:
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.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

extractKeyLength

public int extractKeyLength(CryptoTokenMACKeyData cryptoTokenData)
                     throws CryptoUnsupportedOperationException,
                            CryptoTokenException
Returns the key length of the crypto token.

Parameters:
cryptoTokenData - The data associated with the crypto token.
Returns:
An integer that represents the length of the key.
Throws:
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.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

getAlgorithm

public final String getAlgorithm()
Returns the algorithm supported by this token, ie "HMAC".

This method will always return the String "HMAC".

Since:
JDE 3.6.0

Following copied from interface: CryptoToken
Returns:
A String that represents the name of the algorithm.
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

getMAC

public int getMAC(CryptoTokenMACContext context,
                  byte[] buffer,
                  int offset,
                  boolean reset)
           throws CryptoTokenException
Returns the Message Authetication Code (MAC) associated with the crypto token.

Parameters:
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.
Returns:
An integer representing the code.
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token or the crypto token is invalid.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

initialize

public CryptoTokenMACContext initialize(CryptoTokenMACKeyData keyData,
                                        Digest digest)
                                 throws CryptoUnsupportedOperationException,
                                        CryptoTokenException
Initializes the crypto token.

Parameters:
keyData - The key data associated with the crypto token.
digest - The digest used to initialize the crypto token.
Returns:
The CryptoTokenMACContext object.
Throws:
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.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

injectKey

public CryptoTokenMACKeyData injectKey(byte[] key,
                                       int offset,
                                       int length)
                                throws CryptoUnsupportedOperationException,
                                       CryptoTokenException
Injects the specified raw key data into the crypto token.

Parameters:
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.
Returns:
The crypto token MAC key data.
Throws:
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.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

providesUserAuthentication

public 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. This default implementation returns false.
Since:
JDE 3.6.0

Following copied from interface: CryptoToken
Returns:
true if the user will be authenticated by the token itself.
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.

reset

public void reset(CryptoTokenMACContext context)
           throws CryptoTokenException
Resets the crypto token.

Parameters:
context - The context of the crypto token.
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token or the crypto token is invalid.
Since:
JDE 3.6.0
Category:
CryptoExtensionAPI: This element is part of the Crypto Extension API. These APIs are intended for parties interested in extending the security provider frameworks, such as integrating a new security medium.
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.