mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Fixed key derivation issues, moved tag encoding into crypto component.
This commit is contained in:
@@ -53,6 +53,10 @@ public interface CryptoComponent {
|
||||
*/
|
||||
byte[] deriveNextSecret(byte[] secret, long period);
|
||||
|
||||
/** Encodes the pseudo-random tag that is used to recognise a connection. */
|
||||
void encodeTag(byte[] tag, Cipher tagCipher, ErasableKey tagKey,
|
||||
long connection);
|
||||
|
||||
KeyPair generateAgreementKeyPair();
|
||||
|
||||
KeyPair generateSignatureKeyPair();
|
||||
|
||||
@@ -9,6 +9,7 @@ public class TemporarySecret extends ContactTransport {
|
||||
private final long period, outgoing, centre;
|
||||
private final byte[] secret, bitmap;
|
||||
|
||||
/** Creates a temporary secret with the given connection window. */
|
||||
public TemporarySecret(ContactId contactId, TransportId transportId,
|
||||
long epoch, long clockDiff, long latency, boolean alice,
|
||||
long period, byte[] secret, long outgoing, long centre,
|
||||
@@ -21,14 +22,19 @@ public class TemporarySecret extends ContactTransport {
|
||||
this.bitmap = bitmap;
|
||||
}
|
||||
|
||||
/** Creates a temporary secret with a new connection window. */
|
||||
public TemporarySecret(ContactId contactId, TransportId transportId,
|
||||
long epoch, long clockDiff, long latency, boolean alice,
|
||||
long period, byte[] secret) {
|
||||
this(contactId, transportId, epoch, clockDiff, latency, alice, period,
|
||||
secret, 0L, 0L, new byte[CONNECTION_WINDOW_SIZE / 8]);
|
||||
}
|
||||
|
||||
/** Creates a temporary secret derived from the given temporary secret. */
|
||||
public TemporarySecret(TemporarySecret old, long period, byte[] secret) {
|
||||
super(old.getContactId(), old.getTransportId(), old.getEpoch(),
|
||||
old.getClockDifference(), old.getLatency(), old.getAlice());
|
||||
this.period = period;
|
||||
this.secret = secret;
|
||||
outgoing = 0L;
|
||||
centre = 0L;
|
||||
bitmap = new byte[CONNECTION_WINDOW_SIZE / 8];
|
||||
this(old.getContactId(), old.getTransportId(), old.getEpoch(),
|
||||
old.getClockDifference(), old.getLatency(), old.getAlice(),
|
||||
period, secret);
|
||||
}
|
||||
|
||||
public long getPeriod() {
|
||||
|
||||
@@ -8,5 +8,5 @@ public interface ConnectionReaderFactory {
|
||||
* Creates a connection reader for one side of a connection.
|
||||
*/
|
||||
ConnectionReader createConnectionReader(InputStream in,
|
||||
ConnectionContext ctx, boolean initiator);
|
||||
ConnectionContext ctx, boolean incoming, boolean initiator);
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ public interface ConnectionWriterFactory {
|
||||
* Creates a connection writer for one side of a connection.
|
||||
*/
|
||||
ConnectionWriter createConnectionWriter(OutputStream out, long capacity,
|
||||
ConnectionContext ctx, boolean initiator);
|
||||
ConnectionContext ctx, boolean incoming, boolean initiator);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user