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.
- See Also:
MACOutputStream
- 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 |
|
protected MAC |
_mac
Stores that MAC for later use. |
|
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. |
Constructor Summary |
|
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 |
|
String |
getAlgorithm()
Returns the name of this algorithm, eg "HMAC". |
|
MAC |
getMAC()
Returns a reference to the MAC being used in this instance of the
class. |
|
void |
on(boolean on)
Allows the programmer to turn the MAC functionality
of the stream on or off at will. |
|
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. |
_mac
protected MAC _mac
- Stores that MAC for later use.
- 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
_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.
- 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
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.- 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
getAlgorithm
public String getAlgorithm()
- Returns the name of this algorithm, eg "HMAC".
- Specified by:
getAlgorithm
in 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.
- Since:
- BlackBerry API 3.6.0
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).- 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[] 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.
- Specified by:
read
in class CryptoInputStream
- Parameters:
data
- 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.- 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
getMAC
public MAC getMAC()
- Returns a reference to the
MAC
being used in this instance of the
class.
- Returns:
- The current
MAC
object. - 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
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