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 clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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 clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

_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 clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
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 clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Method Detail

getAlgorithm

public String getAlgorithm()
Returns the name of this algorithm, eg "HMAC".
Overrides:
getAlgorithm in class CryptoOutputStream
Since:
JDE 3.6.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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 4.0.2
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

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 clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2004 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.