net.rim.device.api.crypto
Class BlockDecryptor

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

See Also:
BlockEncryptor
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 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(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.
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

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.
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 algorithm or both the algorithm and unformatter engine used, depending what BlockDecryptor constructor was used.

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

getInputBlockLength

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

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

getOutputBlockLength

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

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

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.

Specified by:
read in class CryptoInputStream
Parameters:
buffer - The buffer into which the data is read.
bufferOffset - The starting offset within the buffer, to store the data.
bufferLength - 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.
See Also:
InputStream.read()
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

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

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
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.
Since:
BlackBerry API 4.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