Validate the decrypted IV before creating a reader/writer.

This commit is contained in:
akwizgran
2011-10-18 15:58:10 +01:00
parent 2f457162a5
commit d7a417f36d
18 changed files with 121 additions and 80 deletions

View File

@@ -5,8 +5,8 @@ import net.sf.briar.api.TransportId;
public interface BatchConnectionFactory {
void createIncomingConnection(ContactId c, BatchTransportReader r,
byte[] encryptedIv);
void createIncomingConnection(TransportId t, ContactId c,
BatchTransportReader r, byte[] encryptedIv);
void createOutgoingConnection(TransportId t, ContactId c,
BatchTransportWriter w);

View File

@@ -6,9 +6,17 @@ import net.sf.briar.api.TransportId;
public interface ConnectionReaderFactory {
ConnectionReader createConnectionReader(InputStream in, byte[] encryptedIv,
byte[] secret);
/**
* Creates a connection reader for a batch-mode connection or the
* initiator's side of a stream-mode connection.
*/
ConnectionReader createConnectionReader(InputStream in, TransportId t,
byte[] encryptedIv, byte[] secret);
ConnectionReader createConnectionReader(InputStream in, boolean initiator,
TransportId t, long connection, byte[] secret);
/**
* Creates a connection reader for the responder's side of a stream-mode
* connection.
*/
ConnectionReader createConnectionReader(InputStream in, TransportId t,
long connection, byte[] secret);
}

View File

@@ -6,9 +6,17 @@ import net.sf.briar.api.TransportId;
public interface ConnectionWriterFactory {
/**
* Creates a connection writer for a batch-mode connection or the
* initiator's side of a stream-mode connection.
*/
ConnectionWriter createConnectionWriter(OutputStream out, long capacity,
boolean initiator, TransportId t, long connection, byte[] secret);
TransportId t, long connection, byte[] secret);
/**
* Creates a connection writer for the responder's side of a stream-mode
* connection.
*/
ConnectionWriter createConnectionWriter(OutputStream out, long capacity,
TransportId t, byte[] encryptedIv, byte[] secret);
}