IntroduceeProtocolEngine uses wrong role when adding keys.

This commit is contained in:
akwizgran
2018-04-28 23:01:04 +01:00
parent d7492df81c
commit 68132d893b
3 changed files with 12 additions and 3 deletions

View File

@@ -24,6 +24,8 @@ public interface ContactManager {
* Stores a contact associated with the given local and remote pseudonyms, * Stores a contact associated with the given local and remote pseudonyms,
* derives and stores transport keys for each transport, and returns an ID * derives and stores transport keys for each transport, and returns an ID
* for the contact. * for the contact.
*
* @param alice true if the local party is Alice
*/ */
ContactId addContact(Transaction txn, Author remote, AuthorId local, ContactId addContact(Transaction txn, Author remote, AuthorId local,
SecretKey master, long timestamp, boolean alice, boolean verified, SecretKey master, long timestamp, boolean alice, boolean verified,
@@ -38,7 +40,10 @@ public interface ContactManager {
/** /**
* Stores a contact associated with the given local and remote pseudonyms, * Stores a contact associated with the given local and remote pseudonyms,
* and returns an ID for the contact. * derives and stores transport keys for each transport, and returns an ID
* for the contact.
*
* @param alice true if the local party is Alice
*/ */
ContactId addContact(Author remote, AuthorId local, ContactId addContact(Author remote, AuthorId local,
SecretKey master, long timestamp, boolean alice, boolean verified, SecretKey master, long timestamp, boolean alice, boolean verified,

View File

@@ -23,6 +23,8 @@ public interface KeyManager {
* <p/> * <p/>
* {@link StreamContext StreamContexts} for the contact can be created * {@link StreamContext StreamContexts} for the contact can be created
* after this method has returned. * after this method has returned.
*
* @param alice true if the local party is Alice
*/ */
void addContact(Transaction txn, ContactId c, SecretKey master, void addContact(Transaction txn, ContactId c, SecretKey master,
long timestamp, boolean alice) throws DbException; long timestamp, boolean alice) throws DbException;
@@ -33,6 +35,8 @@ public interface KeyManager {
* <p/> * <p/>
* The keys must be bound before they can be used for incoming streams, * The keys must be bound before they can be used for incoming streams,
* and also activated before they can be used for outgoing streams. * and also activated before they can be used for outgoing streams.
*
* @param alice true if the local party is Alice
*/ */
Map<TransportId, KeySetId> addUnboundKeys(Transaction txn, SecretKey master, Map<TransportId, KeySetId> addUnboundKeys(Transaction txn, SecretKey master,
long timestamp, boolean alice) throws DbException; long timestamp, boolean alice) throws DbException;
@@ -55,7 +59,7 @@ public interface KeyManager {
* the manager and the database. * the manager and the database.
*/ */
void removeKeys(Transaction txn, Map<TransportId, KeySetId> keys) void removeKeys(Transaction txn, Map<TransportId, KeySetId> keys)
throws DbException; throws DbException;
/** /**
* Returns true if we have keys that can be used for outgoing streams to * Returns true if we have keys that can be used for outgoing streams to

View File

@@ -457,7 +457,7 @@ class IntroduceeProtocolEngine
//noinspection ConstantConditions //noinspection ConstantConditions
keys = keyManager keys = keyManager
.addUnboundKeys(txn, new SecretKey(s.getMasterKey()), .addUnboundKeys(txn, new SecretKey(s.getMasterKey()),
timestamp, s.getRemote().alice); timestamp, s.getLocal().alice);
keyManager.bindKeys(txn, c.getId(), keys); keyManager.bindKeys(txn, c.getId(), keys);
// add signed transport properties for the contact // add signed transport properties for the contact