SHOW Signed
 

net.rim.device.api.crypto
Class MACOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--net.rim.device.api.crypto.CryptoOutputStream
              |
              +--net.rim.device.api.crypto.MACOutputStream

public class MACOutputStream
extends CryptoOutputStream

The MACOutputStream class provides streaming functionality with a Message Authentication Code MAC by allowing for write calls to an underlying output stream and passing this information through the MAC as it is being written.

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

Field Summary
 Category: Signed protected  MAC _mac
          Stores that MAC for later use.
 Category: Signed protected  boolean _on
          Determines whether or not information that is written to the output stream should be passed through the MAC beforehand.
 
Fields inherited from class net.rim.device.api.crypto.CryptoOutputStream
_out
 
Constructor Summary
 Category: Signed MACOutputStream(MAC mac, OutputStream out)
          Creates a MACOutputStream object using a MAC that the user wants and an output stream that all data will be written to.
 
Method Summary
 Category: Signed  String getAlgorithm()
          Returns the name of this algorithm, eg "HMAC".
 Category: Signed  MAC getMAC()
          Returns a reference to the MAC object 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  void write(byte[] buffer, int offset, int length)
          Writes a specified length of bytes from the given byte array to this output stream.
 
Methods inherited from class net.rim.device.api.crypto.CryptoOutputStream
close, flush, getOutputStream, write, write
 
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
Determines whether or not information that is written to the output stream should be passed through the MAC beforehand. 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

MACOutputStream

public MACOutputStream(MAC mac,
                       OutputStream out)
Creates a MACOutputStream object using a MAC that the user wants and an output stream that all data will be written to.

Parameters:
mac - The MAC object to use with this output stream.
out - The underlying output stream that all data. will be written to. If this is null, no output stream will be used, allowing just the MAC features to be used.
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 CryptoOutputStream
Since:
JDE 3.6.0

Following copied from class: CryptoOutputStream
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.

getMAC

public MAC getMAC()
Returns a reference to the MAC object 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 written will be passed through the MAC before being written to the stream.

Note that _on is set to 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.

write

public void write(byte[] buffer,
                  int offset,
                  int length)
           throws IOException
Description copied from class: CryptoOutputStream
Writes a specified length of bytes from the given byte array to this output stream.

Overrides:
write in class CryptoOutputStream
Since:
JDE 3.6.0

Following copied from class: CryptoOutputStream
Parameters:
buffer - The byte array containing the bytes that are going to be written to the output stream.
offset - The offset in the byte array where the method will start writing from.
length - The number of bytes that will be written to the output stream.

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.