Package net.handle.hdllib
Class SignedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
net.handle.hdllib.SignedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Objects 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsConstructorDescriptionSignedInputStream
(PublicKey sourceKey, InputStream in, Socket socket) Create a stream that can verify the data read from the stream in blocks. -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
STREAM_TYPE_PK
public static final int STREAM_TYPE_PK- See Also:
-
STREAM_TYPE_UNSIGNED
public static final int STREAM_TYPE_UNSIGNED- See Also:
-
STREAM_TYPE_TLS
public static final int STREAM_TYPE_TLS- See Also:
-
-
Constructor Details
-
SignedInputStream
Create 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:
Exception
-
-
Method Details
-
isSecure
public boolean isSecure() -
read
Read a byte from the stream.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
verifyBlock
Reads 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:
IOException
SignatureException
-