Package net.handle.hdllib
Class SignedInputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- java.io.FilterInputStream
- 
- net.handle.hdllib.SignedInputStream
 
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 
 public class SignedInputStream extends java.io.FilterInputStreamObjects of this class can be used to verify the contents of a stream generated by a SignedOutputStream class. Note: This is not a part of the official handle protocol specification. This was introduced by CNRI solely for replication in the Handle.net software.
- 
- 
Field SummaryFields Modifier and Type Field Description static intSTREAM_TYPE_PKstatic intSTREAM_TYPE_TLSstatic intSTREAM_TYPE_UNSIGNED
 - 
Constructor SummaryConstructors Constructor Description SignedInputStream(java.security.PublicKey sourceKey, java.io.InputStream in, java.net.Socket socket)Create a stream that can verify the data read from the stream in blocks.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisSecure()intread()Read a byte from the stream.intread(byte[] b)intread(byte[] b, int off, int len)booleanverifyBlock()Reads a signature from the stream and verifies the bytes read since the last verification based on that signature.- 
Methods inherited from class java.io.FilterInputStreamavailable, close, mark, markSupported, reset, skip
 
- 
 
- 
- 
- 
Field Detail- 
STREAM_TYPE_PKpublic static final int STREAM_TYPE_PK - See Also:
- Constant Field Values
 
 - 
STREAM_TYPE_UNSIGNEDpublic static final int STREAM_TYPE_UNSIGNED - See Also:
- Constant Field Values
 
 - 
STREAM_TYPE_TLSpublic static final int STREAM_TYPE_TLS - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SignedInputStreampublic SignedInputStream(java.security.PublicKey sourceKey, java.io.InputStream in, java.net.Socket socket) throws java.lang.ExceptionCreate a stream that can verify the data read from the stream in blocks. The caller should call the verifyBlock method at the end of every block of data that needs to be verified. verifyBlock must be called at the same position in the stream that signBlock was called in the parallel SignedOutputStream object that generated the stream.- Throws:
- java.lang.Exception
 
 
- 
 - 
Method Detail- 
isSecurepublic boolean isSecure() 
 - 
readpublic int read() throws java.io.IOExceptionRead a byte from the stream.- Overrides:
- readin class- java.io.FilterInputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] b) throws java.io.IOException- Overrides:
- readin class- java.io.FilterInputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
- readin class- java.io.FilterInputStream
- Throws:
- java.io.IOException
 
 - 
verifyBlockpublic boolean verifyBlock() throws java.io.IOException, java.security.SignatureExceptionReads a signature from the stream and verifies the bytes read since the last verification based on that signature. This should be called at the exact same point in the stream as the signBlock() in the SignedOutpuStream class.- Throws:
- java.io.IOException
- java.security.SignatureException
 
 
- 
 
-