net.rim.device.api.crypto
Class PRNGDecryptor

java.lang.Object
  extended by java.io.InputStream
      extended by net.rim.device.api.crypto.CryptoInputStream
          extended by net.rim.device.api.crypto.DecryptorInputStream
              extended by net.rim.device.api.crypto.StreamDecryptor
                  extended by net.rim.device.api.crypto.PRNGDecryptor

public final class PRNGDecryptor
extends StreamDecryptor

The PRNGDecryptor is used in conjunction with a PseudoRandomSource to decrypt data provided to this class in a stream interface to the calling class.

A PRNG represents a Pseudo Random Number Generator.

It provides a similar relationship or functionality that the BlockDecryptor uses for BlockDecryptorEngines. That is, it allows you to use a PseudoRandomSource as an input stream instead of relying on the decryption mechanisms exposed in the PseudoRandomSource class.

See Also:
PRNGEncryptor
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 3.6.0

Field Summary
 
Fields inherited from class net.rim.device.api.crypto.CryptoInputStream
_inputStream
 
Constructor Summary
Category: Signed PRNGDecryptor(PseudoRandomSource keystream, InputStream input)
          Creates a PRNGDecryptor object based on an input stream and a keystream that will create random numbers and decrypt the ciphertext with them.
 
Method Summary
Category: Signed protected  void decrypt(byte[] data, int offset, int length)
          Decrypts data according to the specific implementation of the chosen stream cipher.
Category: Signed  String getAlgorithm()
          Returns the name of the encryption algorithm used, eg "ARC4".
 
Methods inherited from class net.rim.device.api.crypto.StreamDecryptor
read
 
Methods inherited from class net.rim.device.api.crypto.CryptoInputStream
available, close, getInputStream, markSupported, read, read
 
Methods inherited from class java.io.InputStream
mark, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

PRNGDecryptor

public PRNGDecryptor(PseudoRandomSource keystream,
                     InputStream input)
Creates a PRNGDecryptor object based on an input stream and a keystream that will create random numbers and decrypt the ciphertext with them.

Parameters:
keystream - A PseudoRandomSource object to recreate the original random numbers in order to decrypt the input stream.
input - An inputstream object containing the plaintext.
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 3.6.0


Method Detail

getAlgorithm

public String getAlgorithm()
Returns the name of the encryption algorithm used, eg "ARC4".

Specified by:
getAlgorithm in class CryptoInputStream
Returns:
A String that represents the name of the 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 3.6.0

decrypt

protected void decrypt(byte[] data,
                       int offset,
                       int length)
                throws CryptoTokenException
Description copied from class: StreamDecryptor
Decrypts data according to the specific implementation of the chosen stream cipher. The data should be decrypted in place.

Specified by:
decrypt in class StreamDecryptor
Parameters:
data - A byte array containing the input to the stream cipher.
offset - The offset, or initial position within the array, of the information to decrypt.
length - The length, in bytes, of the information 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 3.6.0





Copyright 1999-2010 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. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.