public class SignatureOutputStream
extends java.io.FilterOutputStream
java.security.DigestOutputStream.Signature,
DigestOutputStream| Modifier and Type | Field and Description |
|---|---|
protected int |
bytesProcessed_
The number of bytes that have been processed by this stream.
|
protected boolean |
isClosed_
True, if this stream has been closed.
|
protected boolean |
on_
Indicates if passed through data is signed or just passed through.
|
protected boolean |
passThroughClose_
True, if we should pass through a call to close.
|
protected java.security.Signature |
signatureEngine_
The signature engine that is used for signature creation and verification.
|
| Constructor and Description |
|---|
SignatureOutputStream(java.io.OutputStream data,
java.security.Signature signatureEngine,
boolean passThroughClose)
Creates a streaming signature engine that reads its data from the provided stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
clearBytesProcessed()
Set the number of bytes that have been read so far to zero.
|
void |
close()
Close this stream and also the underlying stream if this has been specified at stream
construction.
|
int |
getBytesProcessed()
Return the number of bytes that have been signed so far.
|
java.security.Signature |
getSignature()
Get the signature engine used by this stream.
|
boolean |
isOn()
Check if the signing/verification functionality is on or off.
|
boolean |
isStreamClosed()
Check, if this stream has been closed; i.e.
|
boolean |
setOn(boolean on)
Switch the signing/verification functionality on or off.
|
void |
setSignature(java.security.Signature signatureEngine)
Set the signature engine used by this stream.
|
java.lang.String |
toString()
Get a string representation of this object for debugging.
|
void |
write(byte[] buffer)
Write some bytes from the given buffer to the underlying output stream and updates the
signature engine, if the signing function is on.
|
void |
write(byte[] buffer,
int offset,
int length)
Write some bytes from the given buffer to the underlying output stream and updates the
signature engine, if the signing function is on.
|
void |
write(int dataByte)
Writes a byte to the underlying input stream and updates the signature engine, if the signing
function is on.
|
protected boolean on_
protected java.security.Signature signatureEngine_
protected boolean isClosed_
protected int bytesProcessed_
protected boolean passThroughClose_
public SignatureOutputStream(java.io.OutputStream data,
java.security.Signature signatureEngine,
boolean passThroughClose)
data - The input stream proving the data.signatureEngine - The signature object used to create and verify signatures.passThroughClose - If true, a call to close will ba passed through.public java.security.Signature getSignature()
setSignature(java.security.Signature)public void setSignature(java.security.Signature signatureEngine)
signatureEngine - The signature engine used by this stream.getSignature()public void write(int dataByte)
throws java.io.IOException
write in class java.io.FilterOutputStreamdataByte - The byte to be written.java.io.IOException - if writing to the underlying stream fails or if updating the signature fails.Signature.update(byte)public void write(byte[] buffer,
int offset,
int length)
throws java.io.IOException
write in class java.io.FilterOutputStreambuffer - The buffer holding the data to write.offset - The offset where to start getting bytes from the buffer.length - The maximum number of bytes to read from the buffer and write to the stream.java.io.IOException - if reading from the underlying stream fails or if updating the signature fails.Signature.update(byte[], int, int)public void write(byte[] buffer)
throws java.io.IOException
write in class java.io.FilterOutputStreambuffer - The buffer holding the data to write.java.io.IOException - if reading from the underlying stream fails or if updating the signature fails.Signature.update(byte[], int, int)public boolean isOn()
public boolean setOn(boolean on)
on - True, to switch the signing/verification functionality on, false, to switch it off.public int getBytesProcessed()
public int clearBytesProcessed()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterOutputStreamjava.io.IOException - If closing the underlying stream fails.SignatureOutputStream(OutputStream, Signature, boolean),
OutputStream.close()public boolean isStreamClosed()
public java.lang.String toString()
toString in class java.lang.ObjectIAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4