From 93ee4d004e27f219261b9e451ae77e9a59f9963b Mon Sep 17 00:00:00 2001 From: akwizgran Date: Wed, 3 Aug 2011 21:08:09 +0100 Subject: [PATCH] Reduced maximum public key lengths to reasonable lengths for ECDSA. --- api/net/sf/briar/api/protocol/Author.java | 2 +- api/net/sf/briar/api/protocol/Group.java | 2 +- api/net/sf/briar/api/protocol/Message.java | 2 +- components/net/sf/briar/protocol/MessageReader.java | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/net/sf/briar/api/protocol/Author.java b/api/net/sf/briar/api/protocol/Author.java index 0006cd64f..690e4c69a 100644 --- a/api/net/sf/briar/api/protocol/Author.java +++ b/api/net/sf/briar/api/protocol/Author.java @@ -9,7 +9,7 @@ public interface Author extends Writable { static final int MAX_NAME_LENGTH = 50; /** The maximum length of an author's public key, in bytes. */ - static final int MAX_PUBLIC_KEY_LENGTH = 1000; + static final int MAX_PUBLIC_KEY_LENGTH = 100; /** Returns the author's unique identifier. */ AuthorId getId(); diff --git a/api/net/sf/briar/api/protocol/Group.java b/api/net/sf/briar/api/protocol/Group.java index 7e33755c3..a552cb17e 100644 --- a/api/net/sf/briar/api/protocol/Group.java +++ b/api/net/sf/briar/api/protocol/Group.java @@ -9,7 +9,7 @@ public interface Group extends Writable { static final int MAX_NAME_LENGTH = 50; /** The maximum length of a group's public key, in bytes. */ - static final int MAX_PUBLIC_KEY_LENGTH = 1000; + static final int MAX_PUBLIC_KEY_LENGTH = 100; /** Returns the group's unique identifier. */ GroupId getId(); diff --git a/api/net/sf/briar/api/protocol/Message.java b/api/net/sf/briar/api/protocol/Message.java index 3df4b5f46..bbc418214 100644 --- a/api/net/sf/briar/api/protocol/Message.java +++ b/api/net/sf/briar/api/protocol/Message.java @@ -6,7 +6,7 @@ public interface Message { static final int MAX_SIZE = (1024 * 1024) - 200; /** The maximum size of a signature, in bytes. */ - static final int MAX_SIGNATURE_SIZE = 100; + static final int MAX_SIGNATURE_LENGTH = 100; /** Returns the message's unique identifier. */ MessageId getId(); diff --git a/components/net/sf/briar/protocol/MessageReader.java b/components/net/sf/briar/protocol/MessageReader.java index b5530068e..96b6824c5 100644 --- a/components/net/sf/briar/protocol/MessageReader.java +++ b/components/net/sf/briar/protocol/MessageReader.java @@ -73,13 +73,13 @@ class MessageReader implements ObjectReader { // Read the author's signature, if there is one byte[] authorSig = null; if(author == null) r.readNull(); - else authorSig = r.readBytes(Message.MAX_SIGNATURE_SIZE); + else authorSig = r.readBytes(Message.MAX_SIGNATURE_LENGTH); // Record the length of the data covered by the group's signature int signedByGroup = (int) counting.getCount(); // Read the group's signature, if there is one byte[] groupSig = null; if(group.getPublicKey() == null) r.readNull(); - else groupSig = r.readBytes(Message.MAX_SIGNATURE_SIZE); + else groupSig = r.readBytes(Message.MAX_SIGNATURE_LENGTH); // That's all, folks r.removeConsumer(counting); r.removeConsumer(copying);