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

Field Summary
 Category: Signed static int BLOCK_LENGTH_DEFAULT
          This is the default block length of a AES key
 
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.
 Category: Signed AESEncryptorEngine(AESKey key, int blockLength, boolean inECMMode)
          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
 

Field Detail

BLOCK_LENGTH_DEFAULT

public static final int BLOCK_LENGTH_DEFAULT
This is the default block length of a AES key
Since:
JDE 4.3.0
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.
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 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.

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

AESEncryptorEngine

public AESEncryptorEngine(AESKey key,
                          int blockLength,
                          boolean inECMMode)
                   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 ).
inECMMode - indicates whether strong AES-Electromagnetic Countermeasures are on
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 4.3.0
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.
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 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 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 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.

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

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