SHOW Signed

net.rim.device.api.crypto
Class AESEncryptorEngine

java.lang.Object
  |
  +--net.rim.device.api.crypto.AESEncryptorEngine
All Implemented Interfaces:
BlockEncryptorEngine, SymmetricKeyEncryptorEngine

public final class AESEncryptorEngine
extends Object
implements SymmetricKeyEncryptorEngine

Creates an Advanced Encryption Standard (AES) encryption engine. AES is also known as Rijndael. For more information visit the NIST web page. The implementation of AES we give is defined in FIPS 197.

The AES cipher has a variable key length of 128, 192 or 256 bits. The block length is also variable but defaults to 128 bits. The other valid block lengths are 192 and 256 bits.

For a code sample using the AES encryptor engine, click here.

For information on cryptographic algorithms, see Crypto Algorithms.

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
See Also:
AESDecryptorEngine, AESKey

Constructor Summary
 Category: Signed AESEncryptorEngine(AESKey key)
          Creates an instance of the AESEncryptorEngine class given the AES key with a default block length of 16 bytes.
 Category: Signed AESEncryptorEngine(AESKey key, int blockLength)
          Creates an instance of the AESEncryptorEngine class given the AES key.
 
Method Summary
 Category: Signed  void encrypt(byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset)
          Encrypts the data given a byte array containing the plaintext, a byte array to hold the ciphertext, and their associated offsets.
 Category: Signed  String getAlgorithm()
          Returns the name of the algorithm with with key and block lengths, ie "AES_128_128" ("AES_" + keyBitLength + "_" + blockBitLength).
 Category: Signed  int getBlockLength()
          Returns the block length of the encrypted data.
 Category: Signed  int getKeyLength()
          Returns the length of the key in bytes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AESEncryptorEngine

public AESEncryptorEngine(AESKey key)
                   throws CryptoTokenException,
                          CryptoUnsupportedOperationException
Creates an instance of the AESEncryptorEngine class given the AES key with a default block length of 16 bytes.

Parameters:
key - The AESKey that will be used by the cipher to encrypt 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.

AESEncryptorEngine

public AESEncryptorEngine(AESKey key,
                          int blockLength)
                   throws CryptoTokenException,
                          CryptoUnsupportedOperationException
Creates an instance of the AESEncryptorEngine class given the AES key.

Parameters:
key - The AESKey that will be used by the cipher to encrpyt data.
blockLength - The block length of the cipher in bytes ( the valid lengths are 16, 24 and 32 ).
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.
Method Detail

encrypt

public void encrypt(byte[] plaintext,
                    int plaintextOffset,
                    byte[] ciphertext,
                    int ciphertextOffset)
             throws CryptoTokenException
Encrypts the data given a byte array containing the plaintext, a byte array to hold the ciphertext, and their associated offsets.

Parameters:
plaintext - A byte array containing the plaintext.
plaintextOffset - The offset, or position of the first bit, of the plaintext.
ciphertext - A byte array containing the ciphertext.
ciphertextOffset - The offset, or position of the first bit, of the ciphertext.
Throws:
CryptoTokenException - Thrown when a problem occurs with a crypto token or the crypto token is invalid.
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.

getAlgorithm

public String getAlgorithm()
Returns the name of the algorithm with with key and block lengths, ie "AES_128_128" ("AES_" + keyBitLength + "_" + blockBitLength).

Returns:
A string representing the algorithm used to encrypt 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.

getBlockLength

public int getBlockLength()
Returns the block length of the encrypted data.

Returns:
An integer representing the block length in bytes.
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.

getKeyLength

public int getKeyLength()
Returns the length of the key in bytes.

Returns:
An integer representing the length of the key in bytes.
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.


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