public class MacOutputStream
extends java.io.FilterOutputStream
MacInputStream,
DigestOutputStream| Modifier and Type | Field and Description |
|---|---|
protected javax.crypto.Mac |
macEngine_
The MAC engine to use for MACing the data.
|
protected boolean |
macingActive_
Indicates, if this objects sends data written to this stream to the Mac
engine.
|
| Constructor and Description |
|---|
MacOutputStream(java.io.OutputStream stream,
javax.crypto.Mac macEngine)
Creates a MAC output stream, using the specified output stream
and MAC engine.
|
| Modifier and Type | Method and Description |
|---|---|
javax.crypto.Mac |
getMac()
Get the MAC engine used for MACing the data.
|
void |
on(boolean macingActive)
Turns the MACing on or off.
|
void |
setMac(javax.crypto.Mac macEngine)
Set the MAC engine to use for MACing the data.
|
java.lang.String |
toString()
Returns a string representation of this MAC output stream.
|
void |
write(byte[] dataByteArray,
int offset,
int length)
This methods updates the MAC, if the MACing is active.
|
void |
write(int dataByte)
This methods updates the MAC, if the MACing is active.
|
protected boolean macingActive_
protected javax.crypto.Mac macEngine_
public MacOutputStream(java.io.OutputStream stream,
javax.crypto.Mac macEngine)
stream - The output stream to write the data though.macEngine - The MAC engine to use for MACing the data.public javax.crypto.Mac getMac()
public void setMac(javax.crypto.Mac macEngine)
macEngine - The MAC engine to use for MACing the data.public void write(int dataByte)
throws java.io.IOException
write in class java.io.FilterOutputStreamdataByte - A single data byte.java.io.IOException - If writing to the underlaying stream fails.public void write(byte[] dataByteArray,
int offset,
int length)
throws java.io.IOException
write in class java.io.FilterOutputStreamdataByteArray - The array containing the data bytes.offset - The offset in the data byte array to start reading the data
bytes.length - The number of bytes to read the array starting from offset.java.io.IOException - If writing to the underlaying stream fails.public void on(boolean macingActive)
macingActive - True, to MAC all data before writing to the underlying
stream.public java.lang.String toString()
toString in class java.lang.Object