SHOW Signed
 

net.rim.device.api.crypto
Class BlockDecryptor

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--net.rim.device.api.crypto.CryptoInputStream
              |
              +--net.rim.device.api.crypto.DecryptorInputStream
                    |
                    +--net.rim.device.api.crypto.BlockDecryptor

public class BlockDecryptor
extends DecryptorInputStream

The superclass of all classes that implement block ciphers. The block ciphers sit on the Decryptor input stream and any data that is written to the input stream is acted on by the Block cipher. The class BlockCipherDecryptor itself simply overrides many of the methods defined for the Decryptor class with methods that are specific to block ciphers.

It is important to note that the default mode for all block ciphers is Electronic Code Book mode (ECB) where each block is encrypted/decrypted separately and independently from all other blocks.

Note: For the block cipher algorithm classes, each block is decrypted one block at a time.

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:
BlockEncryptor

Field Summary
 
Fields inherited from class net.rim.device.api.crypto.CryptoInputStream
_inputStream
 
Constructor Summary
 Category: Signed BlockDecryptor(BlockDecryptorEngine decryptorEngine, InputStream in)
          Creates a BlockDecryptor object based on the given block decryptor and input stream.
 Category: Signed BlockDecryptor(BlockUnformatterEngine unformatterEngine, InputStream in)
          Creates a BlockDecryptor object using a given unformatter engine and input stream.
 
Method Summary
 Category: Signed  int available()
          Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
 Category: Signed  void close()
          Closes this input stream and releases any system resources associated with the stream.
 Category: Signed  String getAlgorithm()
          Returns the name of the algorithm or both the algorithm and unformatter engine used, depending what BlockDecryptor constructor was used.
 Category: Signed  int getInputBlockLength()
          Returns the input block length of the cipher in bytes.
 Category: Signed  int getOutputBlockLength()
          Returns the output block length of the cipher in bytes.
 Category: Signed  int read(byte[] buffer, int bufferOffset, int bufferLength)
          Reads up to the specified number of bytes from this input stream into an array of bytes.
 
Methods inherited from class net.rim.device.api.crypto.CryptoInputStream
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

BlockDecryptor

public BlockDecryptor(BlockDecryptorEngine decryptorEngine,
                      InputStream in)
Creates a BlockDecryptor object based on the given block decryptor and input stream.

Parameters:
decryptorEngine - An instance of the decryptor engine to use to decrypt the incoming data.
in - The input stream that the data will be read from.
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.

BlockDecryptor

public BlockDecryptor(BlockUnformatterEngine unformatterEngine,
                      InputStream in)
Creates a BlockDecryptor object using a given unformatter engine and input stream.

Parameters:
unformatterEngine - An instance of the unformatter engine to use to decode the incoming data.
in - The input stream that the data will be read from.
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.
Method Detail

available

public int available()
              throws IOException
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread.

Note that in this case, of a block decryptor, the value returned by available is an underestimate of the data available since there may be padding bytes that could be stripped from the data in a read call. So the amount of data actually available may be a larger than indicated by a call to this available function.

Overrides:
available in class CryptoInputStream
Returns:
The number of bytes that can be read from this input stream without blocking.
Throws:
IOException - If an I/O error occurs.
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.

close

public void close()
           throws IOException
Description copied from class: CryptoInputStream
Closes this input stream and releases any system resources associated with the stream.

Overrides:
close in class CryptoInputStream
Since:
JDE 4.0.0

Following copied from class: CryptoInputStream
Throws:
IOException - Thrown if an I/O error occurs.
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 or both the algorithm and unformatter engine used, depending what BlockDecryptor constructor was used.

Overrides:
getAlgorithm in class CryptoInputStream
Returns:
A string representing the name of the algorithnm.
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.

getInputBlockLength

public int getInputBlockLength()
Returns the input block length of the cipher in bytes.

Returns:
An integer representing the input block length.
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.

getOutputBlockLength

public int getOutputBlockLength()
Returns the output block length of the cipher in bytes.

Returns:
An integer representing the output block length.
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.

read

public int read(byte[] buffer,
                int bufferOffset,
                int bufferLength)
         throws IOException
Description copied from class: CryptoInputStream
Reads up to the specified number of bytes from this input stream into an array of bytes. This method blocks until some input is available.

Overrides:
read in class CryptoInputStream
Since:
JDE 3.6.0

Following copied from class: CryptoInputStream
Parameters:
buffer - The buffer into which the data is read.
offset - The starting offset within the buffer, to store the data.
length - The maximum number of bytes to read.
Returns:
The total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
IOException - Thrown if an I/O error occurs.
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.