Frame-at-a-time encryption.

This commit is contained in:
akwizgran
2012-01-11 17:50:24 +00:00
parent 99caec9448
commit f55f98f506
5 changed files with 76 additions and 154 deletions

View File

@@ -1,16 +1,15 @@
package net.sf.briar.transport;
import java.io.IOException;
import java.io.OutputStream;
/** Encrypts authenticated data to be sent over a connection. */
interface ConnectionEncrypter {
/** Returns an output stream to which unencrypted data can be written. */
OutputStream getOutputStream();
/** Encrypts and writes the given frame. */
void writeFrame(byte[] b, int off, int len) throws IOException;
/** Encrypts and writes the remainder of the current frame. */
void writeFinal(byte[] b) throws IOException;
/** Flushes the output stream. */
void flush() throws IOException;
/** Returns the maximum number of bytes that can be written. */
long getRemainingCapacity();