Initial commit (some skeleton classes and interfaces)
commit
2aecbcdc74
|
@ -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<Message> 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);
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.comm;
|
||||
|
||||
/**
|
||||
* Created by talm on 24/10/15.
|
||||
*/
|
||||
public class CommunicationException extends Exception {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package meerkat.comm;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by talm on 24/10/15.
|
||||
*
|
||||
* A structured message
|
||||
*/
|
||||
public interface Message {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package meerkat.comm;
|
||||
|
||||
/**
|
||||
* Created by talm on 24/10/15.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class MessageID {
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.comm;
|
||||
|
||||
/**
|
||||
* Created by talm on 24/10/15.
|
||||
*/
|
||||
public class Timestamp {
|
||||
}
|
|
@ -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<Message> msgs);
|
||||
|
||||
public boolean verify(Signature sig, List<Message> msgs);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package meerkat.crypto;
|
||||
|
||||
/**
|
||||
* Created by talm on 24/10/15.
|
||||
*
|
||||
* A digital signature
|
||||
*/
|
||||
public interface Signature {
|
||||
}
|
|
@ -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<Message> mix(List<Message> ciphertexts);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.crypto.mixnet;
|
||||
|
||||
/**
|
||||
* Created by talm on 25/10/15.
|
||||
*/
|
||||
public class Trustee {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.crypto.mixnet;
|
||||
|
||||
/**
|
||||
* Created by talm on 25/10/15.
|
||||
*/
|
||||
public class Verifier {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.logging;
|
||||
|
||||
/**
|
||||
* Created by talm on 25/10/15.
|
||||
*/
|
||||
public class LogVerifier {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.logging;
|
||||
|
||||
/**
|
||||
* Created by talm on 25/10/15.
|
||||
*/
|
||||
public class Logger {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package meerkat.voting;
|
||||
|
||||
/**
|
||||
* Created by talm on 25/10/15.
|
||||
*/
|
||||
public interface Ballot {
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package meerkat.voting;
|
||||
|
||||
/**
|
||||
* Created by talm on 25/10/15.
|
||||
*/
|
||||
public class ElectionParams {
|
||||
}
|
|
@ -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();
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue