SHOW Signed

net.rim.device.api.crypto
Class AESKey

java.lang.Object
  |
  +--net.rim.device.api.crypto.AESKey
All Implemented Interfaces:
Key, Persistable, net.rim.vm.Persistable, SymmetricKey

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.

Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

Since:
JDE 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.
 
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  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  byte[] getData()
          Returns the key data.
 Category: Signed  int getLength()
          Returns the length of the 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.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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).
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Method Detail

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".

Returns:
A string representing the name of the algorithm used to encrypt and decrypt the data.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getLength

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

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.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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 ).

Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getData

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

Returns an array containing the numerical representation of the key.

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.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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.
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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.
Since:
JDE 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2004 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.