ccs.crypt
Class AbstractBlockCipherOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
ccs.crypt.CipherOutputStream
ccs.crypt.AbstractBlockCipherOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
- Direct Known Subclasses:
- BCCHOutputStream
public abstract class AbstractBlockCipherOutputStream
- extends CipherOutputStream
A Block-cipher output stream. This handles the housekeeping, and delegates
all actual crypto to subclasses.
Fields inherited from class java.io.FilterOutputStream |
out |
Method Summary |
void |
finish()
Completes the encryption but does not close the underlying stream. |
void |
write(byte[] text,
int off,
int len)
|
protected abstract void |
writeHeader(java.io.OutputStream os)
Write the first part of the "header", not including any required
stream length information. |
Methods inherited from class java.io.FilterOutputStream |
write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractBlockCipherOutputStream
protected AbstractBlockCipherOutputStream(DammedOutputStream os,
long plainlen,
AbstractBlockCipher cipher)
write
public void write(byte[] text,
int off,
int len)
throws java.io.IOException
- Specified by:
write
in class CipherOutputStream
- Throws:
java.io.IOException
finish
public void finish()
throws java.io.IOException
- Completes the encryption but does not close the underlying stream.
- Specified by:
finish
in class CipherOutputStream
- Throws:
java.io.IOException
- if the finish failed for some reason.
writeHeader
protected abstract void writeHeader(java.io.OutputStream os)
throws java.io.IOException
- Write the first part of the "header", not including any required
stream length information. For CBC ciphers, this is usually just the IV.
NB. You should wash the header through your MAC. The CCSBlockCipher's buffer
is available as scratch space.
- Parameters:
os
- The stream to write to.
- Throws:
java.io.IOException