org.littleshoot.util
Class EncryptingOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.littleshoot.util.EncryptingOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class EncryptingOutputStream
extends OutputStream

An output stream that write encrypted records whose integrity is verified with a SHA-256 MAC.


Constructor Summary
EncryptingOutputStream(byte[] key, OutputStream os)
          Creates a new encrypting output stream that uses the specified key.
 
Method Summary
 void close()
           
 void write(byte[] data, int off, int len)
          Write the data out, NOW.
 void write(int i)
          Write one byte now.
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptingOutputStream

public EncryptingOutputStream(byte[] key,
                              OutputStream os)
Creates a new encrypting output stream that uses the specified key.

Parameters:
key - The key to encrypt with.
os - The OutputStream to wrap.
Method Detail

write

public void write(byte[] data,
                  int off,
                  int len)
           throws IOException
Write the data out, NOW.

Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(int i)
           throws IOException
Write one byte now.

Specified by:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException


Copyright © 2011-2013 LittleShoot. All Rights Reserved.