Added a random salt to prevent ID clashes between anonymous messages.

This commit is contained in:
akwizgran
2011-09-13 17:56:44 +01:00
parent 8ec40587b2
commit 005e7d5207
6 changed files with 24 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package net.sf.briar.api.crypto;
import java.security.KeyPair;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.security.Signature;
import javax.crypto.Cipher;
@@ -36,5 +37,7 @@ public interface CryptoComponent {
MessageDigest getMessageDigest();
SecureRandom getSecureRandom();
Signature getSignature();
}

View File

@@ -13,6 +13,9 @@ public interface Message {
/** The maximum length of a signature in bytes. */
static final int MAX_SIGNATURE_LENGTH = 100;
/** The length of the random salt in bytes. */
static final int SALT_LENGTH = 8;
/** Returns the message's unique identifier. */
MessageId getId();