Updated protobuf definitions with more content; a better naming scheme and removed redundant java classes
parent
498789cdce
commit
7510e61bcb
|
@ -1,11 +1,7 @@
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import meerkat.bulletinboard.BulletinBoard;
|
import static meerkat.protobuf.Voting.*;
|
||||||
import meerkat.comm.BulletinBoardMessageProtos;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static meerkat.comm.BulletinBoardMessageProtos.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by talm on 10/26/15.
|
* Created by talm on 10/26/15.
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +11,7 @@ public class Demo {
|
||||||
|
|
||||||
BulletinBoardMessage msg;
|
BulletinBoardMessage msg;
|
||||||
|
|
||||||
BulletinBoardMessage.Unsigned msgContents = BulletinBoardMessage.Unsigned.newBuilder()
|
UnsignedBulletinBoardMessage msgContents = UnsignedBulletinBoardMessage.newBuilder()
|
||||||
.addTags("test")
|
.addTags("test")
|
||||||
.setData(ByteString.copyFromUtf8("some data"))
|
.setData(ByteString.copyFromUtf8("some data"))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package meerkat.bulletinboard;
|
package meerkat.bulletinboard;
|
||||||
|
|
||||||
import meerkat.comm.*;
|
import meerkat.comm.*;
|
||||||
import meerkat.crypto.Signature;
|
import static meerkat.protobuf.Voting.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -13,10 +13,8 @@ public interface BulletinBoard {
|
||||||
/**
|
/**
|
||||||
* Post a message to the bulletin board
|
* Post a message to the bulletin board
|
||||||
* @param msg
|
* @param msg
|
||||||
* @param sig
|
|
||||||
*/
|
*/
|
||||||
MessageID postMessage(Message msg, Signature sig) throws CommunicationException;
|
MessageID postMessage(BulletinBoardMessage msg) throws CommunicationException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check how "safe" a given message is
|
* Check how "safe" a given message is
|
||||||
|
@ -34,10 +32,10 @@ public interface BulletinBoard {
|
||||||
* @param max maximum number of messages to return (0=no limit)
|
* @param max maximum number of messages to return (0=no limit)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Message> readMessages(MessageFilter filter, int max);
|
List<BulletinBoardMessage> readMessages(MessageFilter filter, int max);
|
||||||
|
|
||||||
interface MessageCallback {
|
interface MessageCallback {
|
||||||
void handleNewMessage(Message msg, Signature sig);
|
void handleNewMessage(BulletinBoardMessage msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package meerkat.comm;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 24/10/15.
|
|
||||||
*
|
|
||||||
* A structured message
|
|
||||||
*/
|
|
||||||
public interface Message {
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package meerkat.crypto;
|
package meerkat.crypto;
|
||||||
|
|
||||||
import meerkat.comm.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import static meerkat.protobuf.Crypto.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by talm on 25/10/15.
|
* Created by talm on 25/10/15.
|
||||||
|
@ -10,7 +11,7 @@ import java.util.List;
|
||||||
* Sign arrays of messages
|
* Sign arrays of messages
|
||||||
*/
|
*/
|
||||||
public interface DigitalSignature { // Extends SCAPI DigitalSignature
|
public interface DigitalSignature { // Extends SCAPI DigitalSignature
|
||||||
public Signature sign(List<Message> msgs);
|
public Signature sign(List<Message> msg);
|
||||||
|
|
||||||
public boolean verify(Signature sig, List<Message> msgs);
|
public boolean verify(Signature sig, List<Message> msgs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package meerkat.crypto;
|
||||||
|
|
||||||
|
import com.google.protobuf.Message;
|
||||||
|
import static meerkat.protobuf.Crypto.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by talm on 11/2/15.
|
||||||
|
*/
|
||||||
|
public interface Encryption {
|
||||||
|
Message encrypt(Message plaintext, EncryptionRandomness rnd);
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
package meerkat.crypto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 10/26/15.
|
|
||||||
*/
|
|
||||||
public interface EncryptionRandomness {
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package meerkat.crypto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 10/26/15.
|
|
||||||
*/
|
|
||||||
public class RandomnessGenerationProof {
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package meerkat.crypto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 24/10/15.
|
|
||||||
*
|
|
||||||
* A digital signature
|
|
||||||
*/
|
|
||||||
public interface Signature {
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.crypto.mixnet;
|
package meerkat.crypto.mixnet;
|
||||||
|
|
||||||
import meerkat.comm.Message;
|
import meerkat.voting.EncryptedBallot;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -8,5 +8,5 @@ import java.util.List;
|
||||||
* Created by talm on 25/10/15.
|
* Created by talm on 25/10/15.
|
||||||
*/
|
*/
|
||||||
public interface Mixer {
|
public interface Mixer {
|
||||||
public List<Message> mix(List<Message> ciphertexts);
|
public List<EncryptedBallot> mix(List<EncryptedBallot> ballots);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
package meerkat.voting;
|
|
||||||
|
|
||||||
import meerkat.crypto.EncryptionRandomness;
|
|
||||||
import meerkat.crypto.RandomnessGenerationProof;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 10/26/15.
|
|
||||||
*/
|
|
||||||
public class BallotSecrets {
|
|
||||||
PlaintextBallot plaintext;
|
|
||||||
|
|
||||||
EncryptionRandomness encryptionRandomness;
|
|
||||||
RandomnessGenerationProof proof;
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package meerkat.voting;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parameters local to the voting booth:
|
|
||||||
* Private and public signature keys
|
|
||||||
* Logging keys,
|
|
||||||
* Randomness generation params
|
|
||||||
* etc.
|
|
||||||
*/
|
|
||||||
public class BoothParams {
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package meerkat.voting;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 25/10/15.
|
|
||||||
*/
|
|
||||||
public class ElectionParams {
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.voting;
|
package meerkat.voting;
|
||||||
|
|
||||||
import meerkat.comm.Message;
|
import com.google.protobuf.Message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by talm on 25/10/15.
|
* Created by talm on 25/10/15.
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package meerkat.voting;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 10/26/15.
|
|
||||||
*/
|
|
||||||
public interface EncryptedBallotWithSecrets extends EncryptedBallot {
|
|
||||||
/**
|
|
||||||
* Return the secrets required to open and verify an encrypted ballot
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
BallotSecrets getBallotSecrets();
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package meerkat.voting;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by talm on 25/10/15.
|
|
||||||
*/
|
|
||||||
public class PlaintextBallot {
|
|
||||||
/**
|
|
||||||
* Answers to the ballot questions.
|
|
||||||
* Each answer is a list of integers; its parsing depends on the question type.
|
|
||||||
* For example, a multiple choice question would have a length-1 list containing
|
|
||||||
* the single choice's index.
|
|
||||||
*/
|
|
||||||
List<List<Integer>> answers;
|
|
||||||
|
|
||||||
long serialNumber;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,7 @@
|
||||||
package meerkat.voting;
|
package meerkat.voting;
|
||||||
|
|
||||||
|
import static meerkat.protobuf.Voting.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by talm on 25/10/15.
|
* Created by talm on 25/10/15.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meerkat.comm;
|
|
||||||
|
|
||||||
import 'meerkat/crypto/signature.proto';
|
|
||||||
|
|
||||||
option java_outer_classname = "BulletinBoardMessageProtos";
|
|
||||||
|
|
||||||
message BulletinBoardMessage {
|
|
||||||
message Unsigned {
|
|
||||||
// Optional tags describing message
|
|
||||||
repeated string tags = 1;
|
|
||||||
|
|
||||||
// The actual content of the message
|
|
||||||
bytes data = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Unsigned msg = 1;
|
|
||||||
|
|
||||||
// Signature of message (and tags)
|
|
||||||
meerkat.crypto.Signature sig = 2;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package meerkat;
|
||||||
|
|
||||||
|
option java_package = "meerkat.protobuf";
|
||||||
|
|
||||||
|
enum SignatureType {
|
||||||
|
ECDSA = 0;
|
||||||
|
DSA = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A digital signature
|
||||||
|
message Signature {
|
||||||
|
SignatureType type = 1;
|
||||||
|
|
||||||
|
// Data encoding depends on type; default is x509 BER-encoded
|
||||||
|
bytes data = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Public key used to verify signatures
|
||||||
|
message SignatureVerificationKey {
|
||||||
|
SignatureType type = 1;
|
||||||
|
|
||||||
|
bytes data = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A public encryption key
|
||||||
|
message EncryptionPublicKey {
|
||||||
|
bytes data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Randomness used for encryption
|
||||||
|
message EncryptionRandomness {
|
||||||
|
bytes data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A proof that randomness is correctly generated
|
||||||
|
message RandomnessGenerationProof {
|
||||||
|
bytes data = 1;
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package meerkat.crypto;
|
|
||||||
|
|
||||||
option java_outer_classname = "SignatureProtos";
|
|
||||||
|
|
||||||
message Signature {
|
|
||||||
enum Type {
|
|
||||||
ECDSA = 0;
|
|
||||||
DSA = 1;
|
|
||||||
}
|
|
||||||
Type type = 1;
|
|
||||||
|
|
||||||
bytes data = 2;
|
|
||||||
}
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package meerkat;
|
||||||
|
|
||||||
|
import 'meerkat/crypto.proto';
|
||||||
|
|
||||||
|
option java_package = "meerkat.protobuf";
|
||||||
|
|
||||||
|
|
||||||
|
message UnsignedBulletinBoardMessage {
|
||||||
|
// Optional tags describing message
|
||||||
|
repeated string tags = 1;
|
||||||
|
|
||||||
|
// The actual content of the message
|
||||||
|
bytes data = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BulletinBoardMessage {
|
||||||
|
|
||||||
|
UnsignedBulletinBoardMessage msg = 1;
|
||||||
|
|
||||||
|
// Signature of message (and tags)
|
||||||
|
meerkat.Signature sig = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A ballot question. This is an opaque
|
||||||
|
// data type that is parsed by the UI to display
|
||||||
|
// the question.
|
||||||
|
message BallotQuestion {
|
||||||
|
bytes data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// An answer to a specific ballot question.
|
||||||
|
// The answer is a vector of signed integers,
|
||||||
|
// to encompass voting schemes such as ranked voting
|
||||||
|
// and STV.
|
||||||
|
message BallotAnswer {
|
||||||
|
repeated sint64 answer = 1 [packed=true];
|
||||||
|
}
|
||||||
|
|
||||||
|
message PlaintextBallot {
|
||||||
|
uint64 serialNumber = 1; // Ballot serial number
|
||||||
|
|
||||||
|
repeated BallotAnswer answers = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BallotSecrets {
|
||||||
|
PlaintextBallot plaintext_ballot = 1;
|
||||||
|
|
||||||
|
EncryptionRandomness encryption_randomness = 2;
|
||||||
|
RandomnessGenerationProof proof = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BoothParams {
|
||||||
|
repeated SignatureVerificationKey pscVerificationKeys = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// A table to translate to and from compactly encoded answers
|
||||||
|
// and their human-understandable counterparts.
|
||||||
|
// This should be parsable by the UI
|
||||||
|
message BallotAnswerTranslationTable {
|
||||||
|
bytes data = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ElectionParams {
|
||||||
|
// TODO: different sets of keys for different roles?
|
||||||
|
repeated SignatureVerificationKey trusteeVerificationKeys = 1;
|
||||||
|
|
||||||
|
// How many trustees must participate in a signature for it to be considered valid.
|
||||||
|
uint32 trusteeSignatureThreshold = 2;
|
||||||
|
|
||||||
|
// The key used to encrypt ballots. The corresponding private key
|
||||||
|
// is shared between the trustees.
|
||||||
|
EncryptionPublicKey ballotEncryptionKey = 3;
|
||||||
|
|
||||||
|
// Verification keys for valid mixers.
|
||||||
|
repeated SignatureVerificationKey mixerVerificationKeys = 4;
|
||||||
|
|
||||||
|
// How many mixers must participate for the mixing to be considered valid
|
||||||
|
uint32 mixerThreshold = 5;
|
||||||
|
|
||||||
|
// Candidate list (or other question format)
|
||||||
|
repeated BallotQuestion questions = 6;
|
||||||
|
|
||||||
|
// Translation table between answers and plaintext encoding
|
||||||
|
BallotAnswerTranslationTable answerTranslationTable = 7;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue