org.logi.crypto.io
Class SignStream
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--org.logi.crypto.io.SignStream
- public class SignStream
- extends java.io.FilterOutputStream
This OutputStream signs everything written to it using the
specified HashState and SignatureKey. Alternatively it will embed
unsigned hashes of the data within the stream. In either case the
embedded hashes or signatures should be verified with a
VerifyStream object.
- Author:
- Logi Ragnarsson
(logir@logi.org)
- See Also:
VerifyStream
Method Summary |
void |
close()
Closes this output stream and releases any system resources associated
with this stream. |
void |
flush()
Flushes this output stream and forces any buffered output bytes to
be written out to the stream. |
void |
write(byte[] buf,
int off,
int len)
Writes len bytes from the specified byte array starting
at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
Methods inherited from class java.io.FilterOutputStream |
write |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SignStream
public SignStream(java.io.OutputStream out,
int blockSize,
SignatureKey key,
HashState fs)
- Creates a new SignStream. It passes
everything written to it through
fs
and after each
approximately blockSize
bytes it inserts a signature of the
fingerprint into the underlying stream. It then writes the data to
out
.
If key
is null the fingerprints will be written unsigned
to the underlying stream.
write
public void write(int b)
throws java.io.IOException
- Writes the specified byte to this output stream.
- Overrides:
write
in class java.io.FilterOutputStream
write
public void write(byte[] buf,
int off,
int len)
throws java.io.IOException
- Writes
len
bytes from the specified byte array starting
at offset off
to this output stream.
- Overrides:
write
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
- if there is a problem iwth the underlying stream
or the key fails to sign the fingerprint.
flush
public void flush()
throws java.io.IOException
- Flushes this output stream and forces any buffered output bytes to
be written out to the stream.
- Overrides:
flush
in class java.io.FilterOutputStream
close
public void close()
throws java.io.IOException
- Closes this output stream and releases any system resources associated
with this stream.
- Overrides:
close
in class java.io.FilterOutputStream
- Throws:
java.io.IOException
- if there is a problem with the underlying stream
or the key fails to sign the fingerprint.
Copyright 1997-2000 Logi Ragnarsson