commit 2aecbcdc749852dd342ea1312c2560be911cbca3 Author: Tal Moran Date: Mon Oct 26 09:35:44 2015 +0200 Initial commit (some skeleton classes and interfaces) diff --git a/src/meerkat/bulletinboard/BulletinBoard.java b/src/meerkat/bulletinboard/BulletinBoard.java new file mode 100644 index 0000000..4ea0bce --- /dev/null +++ b/src/meerkat/bulletinboard/BulletinBoard.java @@ -0,0 +1,51 @@ +package meerkat.bulletinboard; + +import meerkat.comm.*; +import meerkat.crypto.Signature; + +import java.util.List; +import java.util.Set; + +/** + * Created by talm on 24/10/15. + */ +public interface BulletinBoard { + /** + * Post a message to the bulletin board + * @param msg + * @param sig + */ + MessageID postMessage(Message msg, Signature sig) throws CommunicationException; + + + /** + * Check how "safe" a given message is + * @param id + * @return a normalized "redundancy score" from 0 (local only) to 1 (fully published) + */ + float getRedundancy(MessageID id); + + /** + * Read all messages posted since a given ID + * Note that if messages haven't been "fully posted", this might return a different + * set of messages in different calls. However, messages that are fully posted + * are guaranteed to be included. + * @param filter return only messages that match the filter (null means no filtering). + * @param max maximum number of messages to return (0=no limit) + * @return + */ + List readMessages(MessageFilter filter, int max); + + interface MessageCallback { + void handleNewMessage(Message msg, Signature sig); + } + + /** + * Register a callback that will be called with each new message that is posted. + * The callback will be called only once for each message. + * @param callback + * @param filter only call back for messages that match the filter. + */ + void registerNewMessageCallback(MessageCallback callback, MessageFilter filter); + +} diff --git a/src/meerkat/bulletinboard/MessageFilter.java b/src/meerkat/bulletinboard/MessageFilter.java new file mode 100644 index 0000000..45701f0 --- /dev/null +++ b/src/meerkat/bulletinboard/MessageFilter.java @@ -0,0 +1,14 @@ +package meerkat.bulletinboard; + +/** + * Created by talm on 25/10/15. + * + * A filter for messages (run on the BB server side). + * + * TODO: define a limited filter language (e.g., by tag, by signer, by time, etc.) that can + * be efficiently run on the BB database. + * + */ +public interface MessageFilter { + +} diff --git a/src/meerkat/comm/CommunicationException.java b/src/meerkat/comm/CommunicationException.java new file mode 100644 index 0000000..6dacb21 --- /dev/null +++ b/src/meerkat/comm/CommunicationException.java @@ -0,0 +1,7 @@ +package meerkat.comm; + +/** + * Created by talm on 24/10/15. + */ +public class CommunicationException extends Exception { +} diff --git a/src/meerkat/comm/Message.java b/src/meerkat/comm/Message.java new file mode 100644 index 0000000..47c916d --- /dev/null +++ b/src/meerkat/comm/Message.java @@ -0,0 +1,12 @@ +package meerkat.comm; + +import java.util.Set; + +/** + * Created by talm on 24/10/15. + * + * A structured message + */ +public interface Message { +} + diff --git a/src/meerkat/comm/MessageID.java b/src/meerkat/comm/MessageID.java new file mode 100644 index 0000000..2b97939 --- /dev/null +++ b/src/meerkat/comm/MessageID.java @@ -0,0 +1,10 @@ +package meerkat.comm; + +/** + * Created by talm on 24/10/15. + * + * + */ +public class MessageID { +} + diff --git a/src/meerkat/comm/Timestamp.java b/src/meerkat/comm/Timestamp.java new file mode 100644 index 0000000..6c63854 --- /dev/null +++ b/src/meerkat/comm/Timestamp.java @@ -0,0 +1,7 @@ +package meerkat.comm; + +/** + * Created by talm on 24/10/15. + */ +public class Timestamp { +} diff --git a/src/meerkat/crypto/DigitalSignature.java b/src/meerkat/crypto/DigitalSignature.java new file mode 100644 index 0000000..3a86caf --- /dev/null +++ b/src/meerkat/crypto/DigitalSignature.java @@ -0,0 +1,16 @@ +package meerkat.crypto; + +import meerkat.comm.Message; + +import java.util.List; + +/** + * Created by talm on 25/10/15. + * + * Sign arrays of messages + */ +public interface DigitalSignature { // Extends SCAPI DigitalSignature + public Signature sign(List msgs); + + public boolean verify(Signature sig, List msgs); +} diff --git a/src/meerkat/crypto/Signature.java b/src/meerkat/crypto/Signature.java new file mode 100644 index 0000000..432e7cd --- /dev/null +++ b/src/meerkat/crypto/Signature.java @@ -0,0 +1,9 @@ +package meerkat.crypto; + +/** + * Created by talm on 24/10/15. + * + * A digital signature + */ +public interface Signature { +} diff --git a/src/meerkat/crypto/mixnet/Mixer.java b/src/meerkat/crypto/mixnet/Mixer.java new file mode 100644 index 0000000..f77d302 --- /dev/null +++ b/src/meerkat/crypto/mixnet/Mixer.java @@ -0,0 +1,12 @@ +package meerkat.crypto.mixnet; + +import meerkat.comm.Message; + +import java.util.List; + +/** + * Created by talm on 25/10/15. + */ +public interface Mixer { + public List mix(List ciphertexts); +} diff --git a/src/meerkat/crypto/mixnet/Trustee.java b/src/meerkat/crypto/mixnet/Trustee.java new file mode 100644 index 0000000..e8044cd --- /dev/null +++ b/src/meerkat/crypto/mixnet/Trustee.java @@ -0,0 +1,7 @@ +package meerkat.crypto.mixnet; + +/** + * Created by talm on 25/10/15. + */ +public class Trustee { +} diff --git a/src/meerkat/crypto/mixnet/Verifier.java b/src/meerkat/crypto/mixnet/Verifier.java new file mode 100644 index 0000000..b733317 --- /dev/null +++ b/src/meerkat/crypto/mixnet/Verifier.java @@ -0,0 +1,7 @@ +package meerkat.crypto.mixnet; + +/** + * Created by talm on 25/10/15. + */ +public class Verifier { +} diff --git a/src/meerkat/logging/LogVerifier.java b/src/meerkat/logging/LogVerifier.java new file mode 100644 index 0000000..7ba928a --- /dev/null +++ b/src/meerkat/logging/LogVerifier.java @@ -0,0 +1,7 @@ +package meerkat.logging; + +/** + * Created by talm on 25/10/15. + */ +public class LogVerifier { +} diff --git a/src/meerkat/logging/Logger.java b/src/meerkat/logging/Logger.java new file mode 100644 index 0000000..343ff31 --- /dev/null +++ b/src/meerkat/logging/Logger.java @@ -0,0 +1,7 @@ +package meerkat.logging; + +/** + * Created by talm on 25/10/15. + */ +public class Logger { +} diff --git a/src/meerkat/voting/Ballot.java b/src/meerkat/voting/Ballot.java new file mode 100644 index 0000000..ca405ff --- /dev/null +++ b/src/meerkat/voting/Ballot.java @@ -0,0 +1,8 @@ +package meerkat.voting; + +/** + * Created by talm on 25/10/15. + */ +public interface Ballot { + +} diff --git a/src/meerkat/voting/ElectionParams.java b/src/meerkat/voting/ElectionParams.java new file mode 100644 index 0000000..3c78d42 --- /dev/null +++ b/src/meerkat/voting/ElectionParams.java @@ -0,0 +1,7 @@ +package meerkat.voting; + +/** + * Created by talm on 25/10/15. + */ +public class ElectionParams { +} diff --git a/src/meerkat/voting/EncryptedBallot.java b/src/meerkat/voting/EncryptedBallot.java new file mode 100644 index 0000000..3add851 --- /dev/null +++ b/src/meerkat/voting/EncryptedBallot.java @@ -0,0 +1,21 @@ +package meerkat.voting; + +import meerkat.comm.Message; + +/** + * Created by talm on 25/10/15. + */ +public interface EncryptedBallot { + /** + * Return the public portion of the ballot (this can be published to the bulletin board without violating privacy). + * @return + */ + Message getPublicPortion(); + + /** + * Return the secrets required to open and verify an encrypted ballot + * @return + */ + Message getBallotOpening(); + +} diff --git a/src/meerkat/voting/VotingBooth.java b/src/meerkat/voting/VotingBooth.java new file mode 100644 index 0000000..8882702 --- /dev/null +++ b/src/meerkat/voting/VotingBooth.java @@ -0,0 +1,12 @@ +package meerkat.voting; + +/** + * Created by talm on 25/10/15. + */ +public interface VotingBooth { + void init(ElectionParams params); + + EncryptedBallot encryptBallot(Ballot ballot); + + +}