net.rim.device.api.crypto
Class SignatureVerifierInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by net.rim.device.api.crypto.CryptoInputStream
          extended by net.rim.device.api.crypto.SignatureVerifierInputStream

public class SignatureVerifierInputStream
extends CryptoInputStream

Combines the use of a signature verifier with the use of streams. The streams contain the information that needs to be passed through the signature verifier checking for the validity of the signature.

See Also:
SignatureSignerOutputStream
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
Category: Signed protected  boolean _on
          Determines whether or not the data that is read into the class through the underlying input stream will go through the signature verifier before being returned to the user.
Category: Signed protected  SignatureVerifier _verifier
          Contains the SignatureVerifier object that is used to determine if the signature is correct.
 
Fields inherited from class net.rim.device.api.crypto.CryptoInputStream
_inputStream
 
Constructor Summary
Category: Signed SignatureVerifierInputStream(SignatureVerifier verifier, InputStream inputStream)
          Establishes the input stream being used for reading data and the signature verifier that is used to determine the validity of the signature.
 
Method Summary
Category: Signed  String getAlgorithm()
          Returns the name of this algorithm.
Category: Signed  SignatureVerifier getSignatureVerifier()
          Returns a copy of the signature verifier class in use.
Category: Signed  void on(boolean on)
          Determines whether or not the information read from the stream should be passed through the signature before being written to the output byte arrays.
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

_verifier

protected SignatureVerifier _verifier
Contains the SignatureVerifier object that is used to determine if the signature is correct.

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
Determines whether or not the data that is read into the class through the underlying input stream will go through the signature verifier before being returned to the user. If true, then the information is passed through the verifier. Otherwise, it is not.

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


Constructor Detail

SignatureVerifierInputStream

public SignatureVerifierInputStream(SignatureVerifier verifier,
                                    InputStream inputStream)
Establishes the input stream being used for reading data and the signature verifier that is used to determine the validity of the signature.

Parameters:
verifier - The signature verifier that provides the mechanism for determining if the signature is valid or not.
inputStream - The underlying input stream that is used for reading data 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 this algorithm.

This method calls the appropriate SignatureVerifier's getAlgorithm() method.

For example, DSASignatureSigner returns "DSA_" + digest.getAlgorithm(), ECDASignatureSigner returns "ECDSA_" + digest.getAlgorithm(), PSSSignatureSigner returns "RSA_PSS_" + digest.getAlgorithm(), NullSignatureSigner returns "Null".

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)
Determines whether or not the information read from the stream should be passed through the signature before being written to the output byte arrays.

By default, _on is set to true at start up.

Parameters:
on - If on is true, the information will be passed to the signature verifier. If false, it will not be passed to the verifier.
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

getSignatureVerifier

public SignatureVerifier getSignatureVerifier()
Returns a copy of the signature verifier class in use.

Returns:
A copy of the signature verifier.
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