net.rim.device.api.crypto
Class AESKey

java.lang.Object
  extended by net.rim.device.api.crypto.AESKey
All Implemented Interfaces:
Key, SymmetricKey, Persistable

public final class AESKey
extends Object
implements SymmetricKey, Persistable

Creates an Advanced Encryption Standard (AES) key. AES is also known as Rijndael. For more information visit the NIST web page.

The AES cipher has a variable block length of 128, 192, or 256 bits. It also has a variable key length of 128, 192 or 256 bits. The lengths can be varied independently, resulting in nine possible combinations.

For information on cryptographic algorithms, see Crypto Algorithms.

Category:
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:
BlackBerry API 3.6.0

Constructor Summary
Category: Signed AESKey()
          Creates a new random 128-bit key.
Category: Signed AESKey(byte[] data)
          Creates the longest key possible from existing data.
Category: Signed AESKey(byte[] data, int offset)
          Creates the longest key possible from existing data.
Category: Signed AESKey(byte[] data, int offset, int bitLength)
          Creates a key using existing data.
Category: Signed AESKey(int bitLength)
          Creates a new random key of 128, 192, or 256 bits.
Category: Signed AESKey(AESCryptoToken cryptoToken, byte[] data, int offset, int bitLength)
          Creates a key using existing data.
Category: Signed AESKey(AESCryptoToken cryptoToken, CryptoTokenSymmetricKeyData cryptoTokenData)
          Creates a key using existing data.
 
Method Summary
Category: Signed  boolean equals(Object obj)
          Returns a boolean that indicates if the specified key and the current key are equal.
Category: Signed  AESCryptoToken getAESCryptoToken()
          Returns the crypto token.
Category: Signed  String getAlgorithm()
          Returns a string containing the name of the algorithm associated with this key ("AES").
Category: Signed  int getBitLength()
          Returns the number of bits that make up the actual keying material ( for example parity bits are not counted ).
Category: Signed  CryptoTokenSymmetricKeyData getCryptoTokenData()
          Returns the symmetric crypto token data.
Category: Signed  byte[] getData()
          Returns the key data.
Category: Signed  int getLength()
          Returns the length of the key.
Category: Signed  SymmetricCryptoToken getSymmetricCryptoToken()
          Returns the crypto token associated with this key.
Category: Signed  int hashCode()
          Returns the hash code of the crypto token.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

AESKey

public AESKey()
Creates a new random 128-bit key.

Category:
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:
BlackBerry API 3.6.0

AESKey

public AESKey(int bitLength)
Creates a new random key of 128, 192, or 256 bits.

Parameters:
bitLength - The length of the key in bits (must be 128, 192, or 256).
Category:
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:
BlackBerry API 3.6.0

AESKey

public AESKey(byte[] data)
Creates the longest key possible from existing data.

Parameters:
data - The bytes used to create the key (the first 128 bits of the array are used).
Category:
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:
BlackBerry API 3.6.0

AESKey

public AESKey(byte[] data,
              int offset)
Creates the longest key possible from existing data.

Parameters:
data - The bytes used to create the key.
offset - The offset, or position of the first bit, of the key data.
Category:
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:
BlackBerry API 3.6.0

AESKey

public AESKey(byte[] data,
              int offset,
              int bitLength)
Creates a key using existing data.

Parameters:
data - The bytes used to create the key.
offset - The offset, or position of the first bit, of the key data.
bitLength - The length of the key, in bits (128, 192, or 256).
Category:
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:
BlackBerry API 3.6.0

AESKey

public AESKey(AESCryptoToken cryptoToken,
              byte[] data,
              int offset,
              int bitLength)
       throws CryptoTokenException,
              CryptoUnsupportedOperationException
Creates a key using existing data.

Parameters:
cryptoToken - The crypto token.
data - The bytes used to create the key.
offset - The offset, or position of the first bit, of the key data.
bitLength - The length of the key, in bits (128, 192, or 256).
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
Category:
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:
BlackBerry API 3.6.0

AESKey

public AESKey(AESCryptoToken cryptoToken,
              CryptoTokenSymmetricKeyData cryptoTokenData)
       throws CryptoTokenException,
              CryptoUnsupportedOperationException
Creates a key using existing data.

Parameters:
cryptoToken - The crypto token.
cryptoTokenData - The data contained on the crypto token.
Throws:
CryptoTokenException - Thrown if an error occurs with the crypto token.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
Category:
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:
BlackBerry API 3.6.0


Method Detail

getSymmetricCryptoToken

public SymmetricCryptoToken getSymmetricCryptoToken()
Returns the crypto token associated with this key.

Specified by:
getSymmetricCryptoToken in interface SymmetricKey
Category:
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:
BlackBerry API 3.6.0

getAESCryptoToken

public AESCryptoToken getAESCryptoToken()
Returns the crypto token.

Returns:
An AESCryptoToken object representing the crypto token.
Category:
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:
BlackBerry API 3.6.0

getCryptoTokenData

public CryptoTokenSymmetricKeyData getCryptoTokenData()
Returns the symmetric crypto token data.

Returns:
The crypto token data.
Category:
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:
BlackBerry API 3.6.0

getAlgorithm

public String getAlgorithm()
Returns a string containing the name of the algorithm associated with this key ("AES"). This method will always return the string "AES".

Specified by:
getAlgorithm in interface Key
Returns:
A string representing the name of the algorithm used to encrypt and decrypt the data.
Category:
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:
BlackBerry API 3.6.0

getLength

public int getLength()
              throws CryptoTokenException,
                     CryptoUnsupportedOperationException
Returns the length of the key.

Specified by:
getLength in interface SymmetricKey
Returns:
An integer representing the length of the key in bytes.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
Category:
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:
BlackBerry API 3.6.0

getBitLength

public int getBitLength()
                 throws CryptoTokenException,
                        CryptoUnsupportedOperationException
Description copied from interface: SymmetricKey
Returns the number of bits that make up the actual keying material ( for example parity bits are not counted ).

Specified by:
getBitLength in interface SymmetricKey
Returns:
An integer that represents the number of bits in the key.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown when a call is made to an unsupported operation.
Category:
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:
BlackBerry API 3.6.0

getData

public byte[] getData()
               throws CryptoTokenException,
                      CryptoUnsupportedOperationException
Returns the key data.

Returns an array containing the numerical representation of the key.

Specified by:
getData in interface SymmetricKey
Returns:
A byte array containing the key data.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
Category:
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:
BlackBerry API 3.6.0

hashCode

public int hashCode()
Returns the hash code of the crypto token.

Overrides:
hashCode in class Object
Returns:
An integer representing the hashcode of the crypto token.
See Also:
Object.equals(java.lang.Object), Hashtable
Category:
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:
BlackBerry API 3.6.0

equals

public boolean equals(Object obj)
Returns a boolean that indicates if the specified key and the current key are equal.

Overrides:
equals in class Object
Parameters:
obj - The AES key.
Returns:
True if the keys are egual, False otherwise.
See Also:
Boolean.hashCode(), Hashtable
Category:
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:
BlackBerry API 3.6.0





Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.