net.rim.device.api.crypto
Class AESCBCDecryptorEngine

java.lang.Object
  extended by net.rim.device.api.crypto.AESCBCDecryptorEngine
All Implemented Interfaces:
BlockDecryptorEngine, BlockDecryptorEngineExt, SymmetricKeyDecryptorEngine

public final class AESCBCDecryptorEngine
extends Object
implements SymmetricKeyDecryptorEngine, BlockDecryptorEngineExt

Creates an Advanced Encryption Standard (AES) decryption engine. AES is also known as Rijndael. For more information, visit the NIST web page. The implementation of AES used here 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.

This decryptor engine implements the CBC mode of operation as well.

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

Field Summary
Category: Signed static int BLOCK_LENGTH_DEFAULT
          This is the default block length of a AES key.
 
Constructor Summary
Category: Signed AESCBCDecryptorEngine(AESKey key, int blockLength, boolean useCPAProtection, boolean useFIPSMode, InitializationVector iv)
          Creates an instance of the AESCBCDecryptorEngine class given the AES key.
Category: Signed AESCBCDecryptorEngine(AESKey key, int blockLength, boolean useCPAProtection, InitializationVector iv)
          Creates an instance of the AESCBCDecryptorEngine class given the AES key.
Category: Signed AESCBCDecryptorEngine(AESKey key, int blockLength, InitializationVector iv)
          Creates an instance of the AESCBCDecryptorEngine class given the AES key.
Category: Signed AESCBCDecryptorEngine(AESKey key, InitializationVector iv)
          Creates an instance of the AESCBCDecryptorEngine class given the AES key with a default block length of 16 bytes.
 
Method Summary
Category: Signed  void decrypt(byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset)
          Decodes a block of the given ciphertext into a block of plaintext.
Category: Signed  void decrypt(byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int numBlocks)
          Decodes a series of blocks of the given ciphertext into a series of blocks of plaintext.
Category: Signed  String getAlgorithm()
          Returns the name of the algorithm along with key and block lengths, eg "AES_128_128/CBC" ("AES_" + keyBitLength + "_" + blockBitLength + "/CBC").
Category: Signed  int getBlockLength()
          Returns the block length that the engine uses when Decrypting data.
Category: Signed  InitializationVector getIV()
          Returns the initialization vector associated with this decryptor engine.
Category: Signed  int getKeyLength()
          Returns the length of the key in bytes.
Category: Signed  void setIV(InitializationVector iv)
          Sets the initialization vector associated with this decryptor engine.
 
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.

See Also:
Constant Field Values
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 5.0.0


Constructor Detail

AESCBCDecryptorEngine

public AESCBCDecryptorEngine(AESKey key,
                             InitializationVector iv)
                      throws CryptoTokenException,
                             CryptoUnsupportedOperationException
Creates an instance of the AESCBCDecryptorEngine 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 decrypt data.
iv - An initialization vector used for seeding the engine.
Throws:
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - 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 5.0.0

AESCBCDecryptorEngine

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

Parameters:
key - The AESKey that will be used by the cipher to decrypt data.
blockLength - The block length of the cipher in bytes. The valid lengths are 16, 24 and 32.
iv - An initialization vector used for seeding the engine.
Throws:
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - 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 5.0.0

AESCBCDecryptorEngine

public AESCBCDecryptorEngine(AESKey key,
                             int blockLength,
                             boolean useCPAProtection,
                             InitializationVector iv)
                      throws CryptoTokenException,
                             CryptoUnsupportedOperationException
Creates an instance of the AESCBCDecryptorEngine class given the AES key.

Parameters:
key - The AESKey that will be used by the cipher to decrypt data.
blockLength - The block length of the cipher in bytes. The valid lengths are 16, 24 and 32.
useCPAProtection - If true, enable cryptographic power analysis(CPA) protection and use a strong but slow AES implementation; otherwise, use the fastest version available on the device.
iv - An initialization vector used for seeding the engine.
Throws:
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - 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 5.0.0

AESCBCDecryptorEngine

public AESCBCDecryptorEngine(AESKey key,
                             int blockLength,
                             boolean useCPAProtection,
                             boolean useFIPSMode,
                             InitializationVector iv)
                      throws CryptoTokenException,
                             CryptoUnsupportedOperationException
Creates an instance of the AESCBCDecryptorEngine class given the AES key.

Parameters:
key - The AESKey that will be used by the cipher to decrypt data.
blockLength - The block length of the cipher in bytes. The valid lengths are 16, 24 and 32.
useCPAProtection - If true, enable cryptographic power analysis(CPA) protection and use a strong but slow AES implementation; otherwise, use the fastest version available on the device.
useFIPSMode - If true, use a FIPS-validated version of AES implementation; otherwise, use the fastest version available on the device.
iv - An initialization vector used for seeding the engine.
Throws:
CryptoTokenException - If a problem occurs with a crypto token or the crypto token is invalid.
CryptoUnsupportedOperationException - 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 7.0.0


Method Detail

getAlgorithm

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

Specified by:
getAlgorithm in interface BlockDecryptorEngine
Returns:
A string representing the name of the decryption algorithm.
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 5.0.0

setIV

public void setIV(InitializationVector iv)
Sets the initialization vector associated with this decryptor engine.

Parameters:
iv - An initialization vector used for seeding the engine.
See Also:
AESCBCDecryptorEngine.getIV()
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 5.0.0

getIV

public InitializationVector getIV()
Returns the initialization vector associated with this decryptor engine.

Returns:
The initialization vector.
See Also:
AESCBCDecryptorEngine.setIV(net.rim.device.api.crypto.InitializationVector)
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 5.0.0

getKeyLength

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

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

getBlockLength

public int getBlockLength()
Returns the block length that the engine uses when Decrypting data.

Specified by:
getBlockLength in interface BlockDecryptorEngine
Returns:
An integer representing the block length in bytes.
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 5.0.0

decrypt

public void decrypt(byte[] ciphertext,
                    int ciphertextOffset,
                    byte[] plaintext,
                    int plaintextOffset)
             throws CryptoTokenException
Description copied from interface: BlockDecryptorEngine
Decodes a block of the given ciphertext into a block of plaintext.

Specified by:
decrypt in interface BlockDecryptorEngine
Parameters:
ciphertext - A byte array containing the input that is to be decrypted.
ciphertextOffset - The starting offset, or initial byte position, of the data within the input array.
plaintext - A byte array containing the output from the method.
plaintextOffset - The starting offset, or initial byte position, of the data within the output array.
Throws:
CryptoTokenException - Thrown when an error occurs with the crypto token or the crypto token is invalid.
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 5.0.0

decrypt

public void decrypt(byte[] ciphertext,
                    int ciphertextOffset,
                    byte[] plaintext,
                    int plaintextOffset,
                    int numBlocks)
             throws CryptoTokenException
Description copied from interface: BlockDecryptorEngineExt
Decodes a series of blocks of the given ciphertext into a series of blocks of plaintext.

Specified by:
decrypt in interface BlockDecryptorEngineExt
Parameters:
ciphertext - A byte array containing the input that is to be decrypted.
ciphertextOffset - The starting offset, or initial byte position, of the data within the input array.
plaintext - A byte array containing the output from the method.
plaintextOffset - The starting offset, or initial byte position, of the data within the output array.
numBlocks - The number of blocks to decrypt.
Throws:
CryptoTokenException - Thrown when an error occurs with the crypto token or the crypto token is invalid.
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 5.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal