Skip to content
Snippets Groups Projects
Forked from briar / briar
5020 commits behind the upstream repository.
  • Torsten Grote's avatar
    fc5a7290
    Calculate and verify signature and MAC for Introduction ACKs · fc5a7290
    Torsten Grote authored
    Before the introducee sends her ACK,
    she derives a master key from the ephemeral shared secret as before.
    
    Two nonces and a MAC key are then derived from the master key.
    The local introducee signs one of the nonces and calculates a MAC
    over her own identity public key, ephemeral public key,
    transport properties and timestamp.
    The local introducee includes the signature and MAC in her ACK.
    
    On receiving the remote introducee's ACK,
    the local introducee verifies the signature and MAC.
    Should the verification fail, an ABORT is sent to the introducer and
    the remote introducee that was added as inactive is deleted again.
    Verified
    fc5a7290
    History
    Calculate and verify signature and MAC for Introduction ACKs
    Torsten Grote authored
    Before the introducee sends her ACK,
    she derives a master key from the ephemeral shared secret as before.
    
    Two nonces and a MAC key are then derived from the master key.
    The local introducee signs one of the nonces and calculates a MAC
    over her own identity public key, ephemeral public key,
    transport properties and timestamp.
    The local introducee includes the signature and MAC in her ACK.
    
    On receiving the remote introducee's ACK,
    the local introducee verifies the signature and MAC.
    Should the verification fail, an ABORT is sent to the introducer and
    the remote introducee that was added as inactive is deleted again.
IntroductionConstants.java 2.14 KiB
package org.briarproject.api.introduction;

public interface IntroductionConstants {

	/* Protocol roles */
	int ROLE_INTRODUCER = 0;
	int ROLE_INTRODUCEE = 1;

	/* Message types */
	int TYPE_REQUEST = 1;
	int TYPE_RESPONSE = 2;
	int TYPE_ACK = 3;
	int TYPE_ABORT = 4;

	/* Message Constants */
	String TYPE = "type";
	String GROUP_ID = "groupId";
	String SESSION_ID = "sessionId";
	String CONTACT = "contactId";
	String NAME = "name";
	String PUBLIC_KEY = "publicKey";
	String E_PUBLIC_KEY = "ephemeralPublicKey";
	String MSG = "msg";
	String ACCEPT = "accept";
	String TIME = "time";
	String TRANSPORT = "transport";
	String MESSAGE_ID = "messageId";
	String MESSAGE_TIME = "timestamp";
	String MAC = "mac";
	String SIGNATURE = "signature";

	/* Validation Constants */
	int MAC_LENGTH = 32;

	/* Introducer Local State Metadata */
	String STATE = "state";
	String ROLE = "role";
	String GROUP_ID_1 = "groupId1";
	String GROUP_ID_2 = "groupId2";
	String CONTACT_1 = "contact1";
	String CONTACT_2 = "contact2";
	String AUTHOR_ID_1 = "authorId1";
	String AUTHOR_ID_2 = "authorId2";
	String CONTACT_ID_1 = "contactId1";
	String CONTACT_ID_2 = "contactId2";
	String RESPONSE_1 = "response1";
	String RESPONSE_2 = "response2";
	String READ = "read";

	/* Introduction Request Action */
	String PUBLIC_KEY1 = "publicKey1";
	String PUBLIC_KEY2 = "publicKey2";

	/* Introducee Local State Metadata (without those already defined) */
	String STORAGE_ID = "storageId";
	String INTRODUCER = "introducer";
	String LOCAL_AUTHOR_ID = "localAuthorId";
	String REMOTE_AUTHOR_ID = "remoteAuthorId";
	String OUR_PUBLIC_KEY = "ourEphemeralPublicKey";
	String OUR_PRIVATE_KEY = "ourEphemeralPrivateKey";
	String OUR_TIME = "ourTime";
	String ADDED_CONTACT_ID = "addedContactId";
	String NOT_OUR_RESPONSE = "notOurResponse";
	String EXISTS = "contactExists";
	String REMOTE_AUTHOR_IS_US = "remoteAuthorIsUs";
	String ANSWERED = "answered";
	String NONCE = "nonce";
	String MAC_KEY = "macKey";
	String OUR_TRANSPORT = "ourTransport";
	String OUR_MAC = "ourMac";
	String OUR_SIGNATURE = "ourSignature";

	String TASK = "task";
	int TASK_ADD_CONTACT = 0;
	int TASK_ACTIVATE_CONTACT = 1;
	int TASK_ABORT = 2;

}