SHOW Signed
 

net.rim.device.api.crypto
Class MACInputStream

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

public class MACInputStream
extends CryptoInputStream

Provides streaming functionality with a MAC by allowing for read calls to an underlying input stream and passing this information through the MAC as it is being 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:
JDE 3.6.0
See Also:
MACOutputStream

Field Summary
 Category: Signed protected  MAC _mac
          Stores that MAC for later use.
 Category: Signed protected  boolean _on
          A boolean that determines if information that is read from the input stream should be passed through the MAC before being returned to the user.
 
Fields inherited from class net.rim.device.api.crypto.CryptoInputStream
_inputStream
 
Constructor Summary
 Category: Signed MACInputStream(MAC mac, InputStream inputStream)
          Creates a MACInputStream object with the specified MAC and an input stream that will contain the data to be read.
 
Method Summary
 Category: Signed  String getAlgorithm()
          Returns the name of this algorithm, eg "HMAC".
 Category: Signed  MAC getMAC()
          Returns a reference to the MAC being used in this instance of the class.
 Category: Signed  void on(boolean on)
          Allows the programmer to turn the MAC functionality of the stream on or off at will.
 Category: Signed  int read(byte[] data, int offset, int length)
          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
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
 

Field Detail

_mac

protected MAC _mac
Stores that MAC for later use.
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.

_on

protected boolean _on
A boolean that determines if information that is read from the input stream should be passed through the MAC before being returned to the user.

Note: By default _on is set to true.

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

MACInputStream

public MACInputStream(MAC mac,
                      InputStream inputStream)
Creates a MACInputStream object with the specified MAC and an input stream that will contain the data to be read.

Parameters:
mac - The MAC object to use with this input stream.
inputStream - The underlying inputStream object that all 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

getAlgorithm

public String getAlgorithm()
Returns the name of this algorithm, eg "HMAC".

Overrides:
getAlgorithm in class CryptoInputStream
Since:
JDE 3.6.0

Following copied from class: CryptoInputStream
Returns:
A String representing 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.

getMAC

public MAC getMAC()
Returns a reference to the MAC being used in this instance of the class.

Returns:
The current MAC object.
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.

on

public void on(boolean on)
Allows the programmer to turn the MAC functionality of the stream on or off at will. The "on" boolean will determine whether information that is read will be passed through the MAC before being returned back to the user.

Note that _on is true by default.

Parameters:
on - A boolean stating whether the MAC is on (true) or off (false).
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[] data,
                int offset,
                int length)
         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.