mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Derive and store secrets when a contact transport is added.
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
package net.sf.briar.api.crypto;
|
||||
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.db.ContactTransport;
|
||||
import net.sf.briar.api.protocol.TransportId;
|
||||
import net.sf.briar.api.transport.ConnectionContext;
|
||||
|
||||
public interface KeyManager {
|
||||
|
||||
/**
|
||||
* Starts the key manager and returns true if the manager started
|
||||
* successfully. This method must be called after the database has been
|
||||
* opened.
|
||||
* Starts the key manager and returns true if it started successfully. This
|
||||
* method must be called after the database has been opened.
|
||||
*/
|
||||
boolean start();
|
||||
|
||||
@@ -22,4 +22,10 @@ public interface KeyManager {
|
||||
* support the transport.
|
||||
*/
|
||||
ConnectionContext getConnectionContext(ContactId c, TransportId t);
|
||||
|
||||
/**
|
||||
* Called whenever a contact transport has been added. The initial secret
|
||||
* is erased before returning.
|
||||
*/
|
||||
void contactTransportAdded(ContactTransport ct, byte[] initialSecret);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ public class TemporarySecret extends ContactTransport {
|
||||
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) {
|
||||
this(old.getContactId(), old.getTransportId(), old.getEpoch(),
|
||||
old.getClockDifference(), old.getLatency(), old.getAlice(),
|
||||
/** Creates a temporary secret derived from the given contact transport. */
|
||||
public TemporarySecret(ContactTransport ct, long period, byte[] secret) {
|
||||
this(ct.getContactId(), ct.getTransportId(), ct.getEpoch(),
|
||||
ct.getClockDifference(), ct.getLatency(), ct.getAlice(),
|
||||
period, secret);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user