mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Renamed some classes.
This commit is contained in:
@@ -49,7 +49,7 @@ class ConnectionReaderFactoryImpl implements ConnectionReaderFactory {
|
||||
Cipher tagCipher = crypto.getTagCipher();
|
||||
Cipher frameCipher = crypto.getFrameCipher();
|
||||
Mac mac = crypto.getMac();
|
||||
FrameSource decrypter = new ConnectionDecrypter(in, tagCipher,
|
||||
IncomingEncryptionLayer decrypter = new IncomingEncryptionLayerImpl(in, tagCipher,
|
||||
frameCipher, tagKey, frameKey, mac.getMacLength(), false);
|
||||
// Create the reader
|
||||
return new ConnectionReaderImpl(decrypter, mac, macKey);
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.sf.briar.api.transport.ConnectionReader;
|
||||
|
||||
class ConnectionReaderImpl extends InputStream implements ConnectionReader {
|
||||
|
||||
private final FrameSource decrypter;
|
||||
private final IncomingEncryptionLayer decrypter;
|
||||
private final Mac mac;
|
||||
private final int macLength;
|
||||
private final byte[] buf;
|
||||
@@ -24,7 +24,7 @@ class ConnectionReaderImpl extends InputStream implements ConnectionReader {
|
||||
private long frame = 0L;
|
||||
private int bufOffset = 0, bufLength = 0;
|
||||
|
||||
ConnectionReaderImpl(FrameSource decrypter, Mac mac, ErasableKey macKey) {
|
||||
ConnectionReaderImpl(IncomingEncryptionLayer decrypter, Mac mac, ErasableKey macKey) {
|
||||
this.decrypter = decrypter;
|
||||
this.mac = mac;
|
||||
// Initialise the MAC
|
||||
|
||||
@@ -48,7 +48,7 @@ class ConnectionWriterFactoryImpl implements ConnectionWriterFactory {
|
||||
// Create the encrypter
|
||||
Cipher tagCipher = crypto.getTagCipher();
|
||||
Cipher frameCipher = crypto.getFrameCipher();
|
||||
ConnectionEncrypter encrypter = new ConnectionEncrypterImpl(out,
|
||||
OutgoingEncryptionLayer encrypter = new OutgoingEncryptionLayerImpl(out,
|
||||
capacity, tagCipher, frameCipher, tagKey, frameKey, false);
|
||||
// Create the writer
|
||||
Mac mac = crypto.getMac();
|
||||
|
||||
@@ -22,14 +22,14 @@ import net.sf.briar.api.transport.ConnectionWriter;
|
||||
*/
|
||||
class ConnectionWriterImpl extends OutputStream implements ConnectionWriter {
|
||||
|
||||
private final ConnectionEncrypter encrypter;
|
||||
private final OutgoingEncryptionLayer encrypter;
|
||||
private final Mac mac;
|
||||
private final byte[] buf;
|
||||
|
||||
private int bufLength = FRAME_HEADER_LENGTH;
|
||||
private long frame = 0L;
|
||||
|
||||
ConnectionWriterImpl(ConnectionEncrypter encrypter, Mac mac,
|
||||
ConnectionWriterImpl(OutgoingEncryptionLayer encrypter, Mac mac,
|
||||
ErasableKey macKey) {
|
||||
this.encrypter = encrypter;
|
||||
this.mac = mac;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
interface FrameSink {
|
||||
|
||||
/** Writes the given frame. */
|
||||
void writeFrame(byte[] b, int len) throws IOException;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package net.sf.briar.transport;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
interface FrameSource {
|
||||
interface IncomingEncryptionLayer {
|
||||
|
||||
/**
|
||||
* Reads a frame into the given buffer and returns its length, or -1 if no
|
||||
@@ -16,7 +16,7 @@ import javax.crypto.spec.IvParameterSpec;
|
||||
import net.sf.briar.api.FormatException;
|
||||
import net.sf.briar.api.crypto.ErasableKey;
|
||||
|
||||
class ConnectionDecrypter implements FrameSource {
|
||||
class IncomingEncryptionLayerImpl implements IncomingEncryptionLayer {
|
||||
|
||||
private final InputStream in;
|
||||
private final Cipher tagCipher, frameCipher;
|
||||
@@ -27,9 +27,9 @@ class ConnectionDecrypter implements FrameSource {
|
||||
|
||||
private long frame = 0L;
|
||||
|
||||
ConnectionDecrypter(InputStream in, Cipher tagCipher, Cipher frameCipher,
|
||||
ErasableKey tagKey, ErasableKey frameKey, int macLength,
|
||||
boolean tagEverySegment) {
|
||||
IncomingEncryptionLayerImpl(InputStream in, Cipher tagCipher,
|
||||
Cipher frameCipher, ErasableKey tagKey, ErasableKey frameKey,
|
||||
int macLength, boolean tagEverySegment) {
|
||||
this.in = in;
|
||||
this.tagCipher = tagCipher;
|
||||
this.frameCipher = frameCipher;
|
||||
@@ -16,7 +16,7 @@ import net.sf.briar.api.crypto.ErasableKey;
|
||||
import net.sf.briar.api.plugins.Segment;
|
||||
import net.sf.briar.api.plugins.SegmentSource;
|
||||
|
||||
class SegmentedConnectionDecrypter implements FrameSource {
|
||||
class IncomingSegmentedEncryptionLayer implements IncomingEncryptionLayer {
|
||||
|
||||
private final SegmentSource in;
|
||||
private final Cipher tagCipher, frameCipher;
|
||||
@@ -28,7 +28,7 @@ class SegmentedConnectionDecrypter implements FrameSource {
|
||||
|
||||
private long frame = 0L;
|
||||
|
||||
SegmentedConnectionDecrypter(SegmentSource in, Cipher tagCipher,
|
||||
IncomingSegmentedEncryptionLayer(SegmentSource in, Cipher tagCipher,
|
||||
Cipher frameCipher, ErasableKey tagKey, ErasableKey frameKey,
|
||||
int macLength, boolean tagEverySegment) {
|
||||
this.in = in;
|
||||
@@ -3,7 +3,10 @@ package net.sf.briar.transport;
|
||||
import java.io.IOException;
|
||||
|
||||
/** Encrypts authenticated data to be sent over a connection. */
|
||||
interface ConnectionEncrypter extends FrameSink {
|
||||
interface OutgoingEncryptionLayer {
|
||||
|
||||
/** Writes the given frame. */
|
||||
void writeFrame(byte[] b, int len) throws IOException;
|
||||
|
||||
/** Flushes the output stream. */
|
||||
void flush() throws IOException;
|
||||
@@ -12,7 +12,7 @@ import javax.crypto.spec.IvParameterSpec;
|
||||
|
||||
import net.sf.briar.api.crypto.ErasableKey;
|
||||
|
||||
class ConnectionEncrypterImpl implements ConnectionEncrypter {
|
||||
class OutgoingEncryptionLayerImpl implements OutgoingEncryptionLayer {
|
||||
|
||||
private final OutputStream out;
|
||||
private final Cipher tagCipher, frameCipher;
|
||||
@@ -22,7 +22,7 @@ class ConnectionEncrypterImpl implements ConnectionEncrypter {
|
||||
|
||||
private long capacity, frame = 0L;
|
||||
|
||||
ConnectionEncrypterImpl(OutputStream out, long capacity, Cipher tagCipher,
|
||||
OutgoingEncryptionLayerImpl(OutputStream out, long capacity, Cipher tagCipher,
|
||||
Cipher frameCipher, ErasableKey tagKey, ErasableKey frameKey,
|
||||
boolean tagEverySegment) {
|
||||
this.out = out;
|
||||
@@ -14,7 +14,7 @@ import net.sf.briar.api.crypto.ErasableKey;
|
||||
import net.sf.briar.api.plugins.Segment;
|
||||
import net.sf.briar.api.plugins.SegmentSink;
|
||||
|
||||
class SegmentedConnectionEncrypter implements ConnectionEncrypter {
|
||||
class OutgoingSegmentedEncryptionLayer implements OutgoingEncryptionLayer {
|
||||
|
||||
private final SegmentSink out;
|
||||
private final Cipher tagCipher, frameCipher;
|
||||
@@ -25,7 +25,7 @@ class SegmentedConnectionEncrypter implements ConnectionEncrypter {
|
||||
|
||||
private long capacity, frame = 0L;
|
||||
|
||||
SegmentedConnectionEncrypter(SegmentSink out, long capacity,
|
||||
OutgoingSegmentedEncryptionLayer(SegmentSink out, long capacity,
|
||||
Cipher tagCipher, Cipher frameCipher, ErasableKey tagKey,
|
||||
ErasableKey frameKey, boolean tagEverySegment) {
|
||||
this.out = out;
|
||||
Reference in New Issue
Block a user