SHOW Signed

net.rim.device.api.crypto
Class DecryptorFactory

java.lang.Object
  |
  +--net.rim.device.api.crypto.DecryptorFactory

public abstract class DecryptorFactory
extends Object

Provides the user with a high-level means to decrypt data. The factory classes allow you to encrypt (see the EncryptorFactory EncryptorFactory 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 DESDecryptorEngine DESDecryptorEngine.

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.

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:

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


Constructor Summary
 
Method Summary
 Category: Signed static Enumeration getAlgorithms()
          Returns an Enumeration of String representing all of the registered algorithms with this factory.
 Category: Signed static BlockDecryptorEngine getBlockDecryptorEngine(Key key)
          Returns the block decryptor engine using the symmetric key as an argument.
 Category: Signed static BlockDecryptorEngine getBlockDecryptorEngine(Key key, String algorithm)
          Returns the block decryptor engine using the symmetric key as an argument.
 Category: Signed static BlockDecryptorEngine getBlockDecryptorEngine(Key key, String algorithm, InitializationVector iv)
          Returns the block decryptor engine using the symmetric key as an argument.
 Category: Signed static DecryptorInputStream getDecryptorInputStream(Key key, InputStream stream)
          Returns the decrypted input stream using the symmetric key and input stream as arguments.
 Category: Signed static DecryptorInputStream getDecryptorInputStream(Key key, InputStream stream, String algorithm)
          Returns the decrypted input stream using the symmetric key, input stream and algorithm name as arguments.
 Category: Signed static DecryptorInputStream getDecryptorInputStream(Key key, InputStream stream, String algorithm, InitializationVector iv)
          Returns the decrypted input stream using the initialization vector as an additonal argument.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail
Method Detail

getDecryptorInputStream

public static DecryptorInputStream getDecryptorInputStream(Key key,
                                                           InputStream stream)
                                                    throws NoSuchAlgorithmException,
                                                           CryptoTokenException,
                                                           CryptoUnsupportedOperationException,
                                                           CryptoException,
                                                           IOException
Returns the decrypted input stream using the symmetric key and input stream as arguments.

Parameters:
key - The key used to encrypt and decrypt the data.
stream - The input stream.
Returns:
The input stream containing the decrypted text.
Throws:
NoSuchAlgorithmException - Occurs when the specified algorithm is invalid.
CryptoTokenException - Occurs when the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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.

getDecryptorInputStream

public static DecryptorInputStream getDecryptorInputStream(Key key,
                                                           InputStream stream,
                                                           String algorithm)
                                                    throws NoSuchAlgorithmException,
                                                           CryptoTokenException,
                                                           CryptoUnsupportedOperationException,
                                                           CryptoException,
                                                           IOException
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.

Returns:
The input stream containing the decrypted data.
Throws:
NoSuchAlgorithmException - Occurs when the specified algorithm is invalid.
CryptoTokenException - Occurs when the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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.

getDecryptorInputStream

public static DecryptorInputStream getDecryptorInputStream(Key key,
                                                           InputStream stream,
                                                           String algorithm,
                                                           InitializationVector iv)
                                                    throws NoSuchAlgorithmException,
                                                           CryptoTokenException,
                                                           CryptoUnsupportedOperationException,
                                                           CryptoException,
                                                           IOException
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.

iv - The initialization vector used to decrypt the data.
Returns:
The input stream containing the decrypted data.
Throws:
NoSuchAlgorithmException - Occurs when the specified algorithm is invalid.
CryptoTokenException - Occurs when the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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.

getBlockDecryptorEngine

public static BlockDecryptorEngine getBlockDecryptorEngine(Key key)
                                                    throws NoSuchAlgorithmException,
                                                           CryptoTokenException,
                                                           CryptoUnsupportedOperationException,
                                                           CryptoException
Returns the block decryptor engine using the symmetric key as an argument.

Parameters:
key - The key used to encrypt and decrypt the data.
Returns:
The block decryptor engine.
Throws:
NoSuchAlgorithmException - Occurs when the specified algorithm is invalid.
CryptoTokenException - Occurs when the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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.

getBlockDecryptorEngine

public static BlockDecryptorEngine getBlockDecryptorEngine(Key key,
                                                           String algorithm)
                                                    throws NoSuchAlgorithmException,
                                                           CryptoTokenException,
                                                           CryptoUnsupportedOperationException,
                                                           CryptoException
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.

Returns:
The block decryptor engine.
Throws:
NoSuchAlgorithmException - Occurs when the specified algorithm is invalid.
CryptoTokenException - Occurs when the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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.

getBlockDecryptorEngine

public static BlockDecryptorEngine getBlockDecryptorEngine(Key key,
                                                           String algorithm,
                                                           InitializationVector iv)
                                                    throws NoSuchAlgorithmException,
                                                           CryptoTokenException,
                                                           CryptoUnsupportedOperationException,
                                                           CryptoException
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.

iv - The initialization vector used to decrypt the data.
Returns:
The block decryptor engine.
Throws:
NoSuchAlgorithmException - Occurs when the specified algorithm is invalid.
CryptoTokenException - Occurs when the crypto token is invalid.
CryptoUnsupportedOperationException - Thrown if a call is made to an unsupported operation.
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.

getAlgorithms

public static Enumeration 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.
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-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.