mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Removed tag from connection context.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package net.sf.briar.transport;
|
||||
|
||||
import static net.sf.briar.api.transport.TransportConstants.MAX_FRAME_LENGTH;
|
||||
import static net.sf.briar.api.transport.TransportConstants.TAG_LENGTH;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
|
||||
import net.sf.briar.api.crypto.CryptoComponent;
|
||||
import net.sf.briar.api.crypto.ErasableKey;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
@@ -30,9 +33,12 @@ class ConnectionWriterFactoryImpl implements ConnectionWriterFactory {
|
||||
initiator);
|
||||
FrameWriter encryption;
|
||||
if(initiator) {
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
Cipher tagCipher = crypto.getTagCipher();
|
||||
ErasableKey tagKey = crypto.deriveTagKey(secret, alice);
|
||||
TagEncoder.encodeTag(tag, tagCipher, tagKey, connection);
|
||||
encryption = new OutgoingEncryptionLayer(out, capacity,
|
||||
crypto.getFrameCipher(), frameKey, MAX_FRAME_LENGTH,
|
||||
ctx.getTag());
|
||||
crypto.getFrameCipher(), frameKey, MAX_FRAME_LENGTH, tag);
|
||||
} else {
|
||||
encryption = new OutgoingEncryptionLayer(out, capacity,
|
||||
crypto.getFrameCipher(), frameKey, MAX_FRAME_LENGTH);
|
||||
|
||||
@@ -59,7 +59,7 @@ class TransportConnectionRecogniser {
|
||||
assert old == null;
|
||||
} else {
|
||||
ConnectionContext ctx1 = new ConnectionContext(contactId,
|
||||
transportId, tag1, secret, connection1, alice);
|
||||
transportId, secret, connection1, alice);
|
||||
WindowContext wctx1 = new WindowContext(window, ctx1, period);
|
||||
WindowContext old = tagMap.put(new Bytes(tag1), wctx1);
|
||||
assert old == null;
|
||||
@@ -83,7 +83,7 @@ class TransportConnectionRecogniser {
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
TagEncoder.encodeTag(tag, cipher, key, connection);
|
||||
ConnectionContext ctx = new ConnectionContext(contactId,
|
||||
transportId, tag, secret, connection, alice);
|
||||
transportId, secret, connection, alice);
|
||||
WindowContext wctx = new WindowContext(window, ctx, period);
|
||||
WindowContext old = tagMap.put(new Bytes(tag), wctx);
|
||||
assert old == null;
|
||||
|
||||
Reference in New Issue
Block a user