org.logi.crypto.io
Class VerifyStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byorg.logi.crypto.io.VerifyStream

public class VerifyStream
extends java.io.FilterInputStream

This InputStream reads the stream generated by a SignStream and verifies the embedded signatures or hashes. It will not pass any data through until that data has been verified.

See Also:
SignStream

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
VerifyStream(java.io.InputStream in, int blockSize, SignatureKey key, HashState fs)
          Create a new VerifyStream object.
 
Method Summary
 int available()
          Returns the number of bytes that can be read from this input stream without blocking.
 int drain()
          Drain the underlying stream if it is a DecryptStream.
 boolean markSupported()
          Returns false.
 int read()
          Reads the next byte of data from this input stream.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this input stream into an array of bytes.
 long skip(long n)
          Does nothing and returns 0.
 
Methods inherited from class java.io.FilterInputStream
close, mark, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerifyStream

public VerifyStream(java.io.InputStream in,
                    int blockSize,
                    SignatureKey key,
                    HashState fs)
Create a new VerifyStream object. It matches the SignStream object with the same blockSize and fs and with the key that matches key

See Also:
SignStream
Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available.

The actual number of bytes read is returned or -1 if the end of the stream is reached.

Throws:
java.io.IOException

drain

public int drain()
Drain the underlying stream if it is a DecryptStream.

See Also:
DecryptStream.drain()

available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read from this input stream without blocking.

Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Does nothing and returns 0.

Throws:
java.io.IOException

markSupported

public boolean markSupported()
Returns false. (This could be implemented, but I've never seen it used. Mail me if you want it!)