mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Forgot to update some constants to reflect the new crypto primitives.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.briarproject.api.invitation;
|
package org.briarproject.api.invitation;
|
||||||
|
|
||||||
|
|
||||||
public interface InvitationConstants {
|
public interface InvitationConstants {
|
||||||
|
|
||||||
long CONNECTION_TIMEOUT = 30 * 1000; // Milliseconds
|
long CONNECTION_TIMEOUT = 30 * 1000; // Milliseconds
|
||||||
@@ -7,8 +8,4 @@ public interface InvitationConstants {
|
|||||||
long CONFIRMATION_TIMEOUT = 60 * 1000; // Milliseconds
|
long CONFIRMATION_TIMEOUT = 60 * 1000; // Milliseconds
|
||||||
|
|
||||||
int CODE_BITS = 19; // Codes must fit into six decimal digits
|
int CODE_BITS = 19; // Codes must fit into six decimal digits
|
||||||
|
|
||||||
int HASH_LENGTH = 48; // Bytes
|
|
||||||
|
|
||||||
int MAX_PUBLIC_KEY_LENGTH = 97; // Bytes
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package org.briarproject.invitation;
|
|||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
import static org.briarproject.api.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
import static org.briarproject.api.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||||
|
import static org.briarproject.api.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
|
||||||
import static org.briarproject.api.AuthorConstants.MAX_SIGNATURE_LENGTH;
|
import static org.briarproject.api.AuthorConstants.MAX_SIGNATURE_LENGTH;
|
||||||
import static org.briarproject.api.TransportPropertyConstants.MAX_PROPERTIES_PER_TRANSPORT;
|
import static org.briarproject.api.TransportPropertyConstants.MAX_PROPERTIES_PER_TRANSPORT;
|
||||||
import static org.briarproject.api.TransportPropertyConstants.MAX_PROPERTY_LENGTH;
|
import static org.briarproject.api.TransportPropertyConstants.MAX_PROPERTY_LENGTH;
|
||||||
import static org.briarproject.api.TransportPropertyConstants.MAX_TRANSPORT_ID_LENGTH;
|
import static org.briarproject.api.TransportPropertyConstants.MAX_TRANSPORT_ID_LENGTH;
|
||||||
import static org.briarproject.api.invitation.InvitationConstants.CONNECTION_TIMEOUT;
|
import static org.briarproject.api.invitation.InvitationConstants.CONNECTION_TIMEOUT;
|
||||||
import static org.briarproject.api.invitation.InvitationConstants.HASH_LENGTH;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
@@ -23,13 +23,13 @@ import java.util.Map.Entry;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.briarproject.api.Author;
|
import org.briarproject.api.Author;
|
||||||
import org.briarproject.api.AuthorConstants;
|
|
||||||
import org.briarproject.api.AuthorFactory;
|
import org.briarproject.api.AuthorFactory;
|
||||||
import org.briarproject.api.ContactId;
|
import org.briarproject.api.ContactId;
|
||||||
import org.briarproject.api.FormatException;
|
import org.briarproject.api.FormatException;
|
||||||
import org.briarproject.api.LocalAuthor;
|
import org.briarproject.api.LocalAuthor;
|
||||||
import org.briarproject.api.TransportId;
|
import org.briarproject.api.TransportId;
|
||||||
import org.briarproject.api.TransportProperties;
|
import org.briarproject.api.TransportProperties;
|
||||||
|
import org.briarproject.api.UniqueId;
|
||||||
import org.briarproject.api.crypto.CryptoComponent;
|
import org.briarproject.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.api.crypto.KeyManager;
|
import org.briarproject.api.crypto.KeyManager;
|
||||||
import org.briarproject.api.crypto.KeyPair;
|
import org.briarproject.api.crypto.KeyPair;
|
||||||
@@ -40,7 +40,6 @@ import org.briarproject.api.crypto.Signature;
|
|||||||
import org.briarproject.api.db.DatabaseComponent;
|
import org.briarproject.api.db.DatabaseComponent;
|
||||||
import org.briarproject.api.db.DbException;
|
import org.briarproject.api.db.DbException;
|
||||||
import org.briarproject.api.db.NoSuchTransportException;
|
import org.briarproject.api.db.NoSuchTransportException;
|
||||||
import org.briarproject.api.invitation.InvitationConstants;
|
|
||||||
import org.briarproject.api.messaging.Group;
|
import org.briarproject.api.messaging.Group;
|
||||||
import org.briarproject.api.messaging.GroupFactory;
|
import org.briarproject.api.messaging.GroupFactory;
|
||||||
import org.briarproject.api.plugins.ConnectionManager;
|
import org.briarproject.api.plugins.ConnectionManager;
|
||||||
@@ -132,8 +131,8 @@ abstract class Connector extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected byte[] receivePublicKeyHash(Reader r) throws IOException {
|
protected byte[] receivePublicKeyHash(Reader r) throws IOException {
|
||||||
byte[] b = r.readBytes(HASH_LENGTH);
|
byte[] b = r.readBytes(UniqueId.LENGTH);
|
||||||
if(b.length < HASH_LENGTH) throw new FormatException();
|
if(b.length < UniqueId.LENGTH) throw new FormatException();
|
||||||
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received hash");
|
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received hash");
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
@@ -147,7 +146,7 @@ abstract class Connector extends Thread {
|
|||||||
|
|
||||||
protected byte[] receivePublicKey(Reader r) throws GeneralSecurityException,
|
protected byte[] receivePublicKey(Reader r) throws GeneralSecurityException,
|
||||||
IOException {
|
IOException {
|
||||||
byte[] b = r.readBytes(InvitationConstants.MAX_PUBLIC_KEY_LENGTH);
|
byte[] b = r.readBytes(MAX_PUBLIC_KEY_LENGTH);
|
||||||
keyParser.parsePublicKey(b);
|
keyParser.parsePublicKey(b);
|
||||||
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received key");
|
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received key");
|
||||||
return b;
|
return b;
|
||||||
@@ -203,7 +202,7 @@ abstract class Connector extends Thread {
|
|||||||
throws GeneralSecurityException, IOException {
|
throws GeneralSecurityException, IOException {
|
||||||
// Read the name, public key and signature
|
// Read the name, public key and signature
|
||||||
String name = r.readString(MAX_AUTHOR_NAME_LENGTH);
|
String name = r.readString(MAX_AUTHOR_NAME_LENGTH);
|
||||||
byte[] publicKey = r.readBytes(AuthorConstants.MAX_PUBLIC_KEY_LENGTH);
|
byte[] publicKey = r.readBytes(MAX_PUBLIC_KEY_LENGTH);
|
||||||
byte[] sig = r.readBytes(MAX_SIGNATURE_LENGTH);
|
byte[] sig = r.readBytes(MAX_SIGNATURE_LENGTH);
|
||||||
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received pseudonym");
|
if(LOG.isLoggable(INFO)) LOG.info(pluginName + " received pseudonym");
|
||||||
// Verify the signature
|
// Verify the signature
|
||||||
|
|||||||
Reference in New Issue
Block a user