public class SecureOutputStream
extends java.io.FilterOutputStream
| Modifier and Type | Field and Description | 
|---|---|
| static short | MAXIMUM_DATA_BUFFER_SIZE | 
| Constructor and Description | 
|---|
| SecureOutputStream(java.io.OutputStream out,
                  AESSymmetricKey key,
                  HMACSymmetricKey signKey,
                  byte[] iv)Creates a new AESOutputStream that encrypts the given OutputStream with the given key and additionally signs it with the signature key. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Closes the stream, first does a  flush(). | 
| void | flush()Flushes the stream, creates a signature, if necessary. | 
| void | write(byte[] b)Write a byte array completely. | 
| void | write(byte[] b,
     int off,
     int len)Writes b bytes to the stream. | 
| void | write(int b)Writes a single byte. | 
public static final short MAXIMUM_DATA_BUFFER_SIZE
public SecureOutputStream(java.io.OutputStream out,
                  AESSymmetricKey key,
                  HMACSymmetricKey signKey,
                  byte[] iv)
out - The OutputStream that should be encrypted (and signed)key - The AES key that should be used for encryptionsignKey - The symmetric key that is used to create the HMAC (signature)iv - The initialization vector that is used to initialize the encryptionpublic void write(byte[] b)
           throws java.io.IOException
write in class java.io.FilterOutputStreamb - The byte array to write.java.io.IOException - Thrown by the underlying stream.public void write(int b)
           throws java.io.IOException
write in class java.io.FilterOutputStreamb - The byte to write.java.io.IOException - Thrown by the underlying stream.public void write(byte[] b,
         int off,
         int len)
           throws java.io.IOException
write in class java.io.FilterOutputStreamb - The buffer of data to writeoff - The offset in bufferlen - The length of the data in the bufferjava.io.IOException - Thrown by the underlying stream.public void flush()
           throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.FilterOutputStreamjava.io.IOException - Thrown by the underlying stream.public void close()
           throws java.io.IOException
flush().close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterOutputStreamjava.io.IOException - Thrown by the underlying stream.