net.rim.device.api.crypto
Class DecryptorFactory

Provides the user with a high-level means to decrypt data.
The factory classes allow you to encrypt (see the class)
and decrypt data without worrying about most of the minute details of the implementation.
This class is suitable for developers with little cryptographic experience
or, for decrypting data where the details of the implementation are not as
important as the result.

The low-level alternative to using the DecryptorFactory class is the
decryptor engine, such as the .

Note: When requesting a a block cipher in CFB mode you can specify the number of bits to be processed at a time.
In our API there are two options allowed for CFB mode. You can either have 8bit mode (denoted by "CFB8") or full CFB mode (denoted simply
by "CFB") which will process the full block length.

Note: When calling the getDecryptorInputStream functions, if you specify the algorithm as just "RSA", or just pass
in an RSAPrivateKey, then what will be created is "RSA/PKCS1". This is because there are alot of problems with
using RSA, by itself, with block encryption/decryption. To use the basic RSA function by itself, use the engine
directly.

Note: When using the ElGamal Decryption algorithm it will expect the ephemeral public key from the encryption to have been prepended to the beginning
of the ciphertext in the MPI format described in PGP. If this is not the case, it will be unable to properly decrypt your message. For other variations
of using ElGamal please use the engine directly.

For more information on the cryptographic algorithms supported by this factory, see Crypto Algorithms.

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.

DecryptorFactory

protected DecryptorFactory()

Creates a new DecryptorFactory object.

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.

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.

Returns the decrypted input stream using the symmetric key, input stream
and algorithm name as arguments.

Parameters:

key - The key used to encrypt and decrypt the data.

stream - The input stream.

algorithm - A string that represents the algorithm along with the
details of the decryption. eg, "RC5_64_64" ("RC5_" + keyBitLength + "_" +
blockBitLength).
The string, consisting of one or more substrings, is read from right to
left with the left-most sub-string representing the name of the
algorithm. The two substrings to the right of the algorithm specify the
length of the key in bits and the block length of the data in bits.

If a substring is not defined, the default value is substituted instead.

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.

Returns the decrypted input stream using the initialization vector as an
additonal argument.

Parameters:

key - The key used to encrypt and decrypt the data.

stream - The input stream.

algorithm - A string that represents the algorithm along with the
details of the decryption. eg, "RC5_64_64" ("RC5_" + keyBitLength + "_" +
blockBitLength).
The string, consisting of one or more substrings, is read from right to
left with the left-most sub-string representing the name of the
algorithm. The two substrings to the right of the algorithm specify the
length of the key in bits and the block length of the data in bits.

If a substring is not defined, the default value is substituted instead.

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.

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.

getBlockDecryptorEngine

Returns the block decryptor engine using the symmetric key as an argument.

Parameters:

key - The key used to encrypt and decrypt the data.

algorithm - A string that represents the algorithm along with the
details of the decryption. eg, "RC5_64_64" ("RC5_" + keyBitLength + "_" +
blockBitLength).
The string, consisting of one or more substrings, is read from right to
left with the left-most sub-string representing the name of the
algorithm. The two substrings to the right of the algorithm specify the
length of the key in bits and the block length of the data in bits.

If a substring is not defined, the default value is substituted instead.

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.

Returns the block decryptor engine using the symmetric key as an argument.

Parameters:

key - The key used to encrypt and decrypt the data.

algorithm - A string that represents the algorithm along with the
details of the decryption. eg, "RC5_64_64" ("RC5_" + keyBitLength + "_" +
blockBitLength).
The string, consisting of one or more substrings, is read from right to
left with the left-most sub-string representing the name of the
algorithm. The two substrings to the right of the algorithm specify the
length of the key in bits and the block length of the data in bits.

If a substring is not defined, the default value is substituted instead.

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.

register

Registers the specified factory.
If a factory with the same name already exists, this factory is not added.

Parameters:

factory - The decryptor factory to be registered.

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.

getAlgorithms

Returns an Enumeration of String representing all of the
registered algorithms with this factory.

Returns:

An Enumeration of Strings representing all of the registered
algorithms with this factory.

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.

getFactoryAlgorithms

Returns a string representing the name of the decryptor algorithm, for
example "DES", used to decrypt the data.

Returns:

A string representing the name of the decryption algorithm that
will be used to 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.

Creates an instance of the DecryptorFactory class given the
specified parameters.

Parameters:

algorithm - String that specifies the details of the encryption
scheme. The string is composed of three separate strings concatenated
together and delimited by forward slashes. For example
DES/CBC/OAEP represents a valid string that specifies the
cipher, the mode and the unformatterengine that will be used to decrypt
the data. The algorithm parameter corresponds to the
rightmost substring. The null value is passed if an element
is not specified. The null value specifies that the default value be used.

nextAlgorithm - String that represents the next substring to the
left of the initial algorithm parameter specified above.

key - The key used to decrypt the data.

stream - The InputStream that contains the ciphertext
of the initial message.

iv - The initialization vector initially used by the encryptor
engine to randomize the data.

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.