Working version of Bulletin Board Server + refactoring of Bulletin Board ProtoBufs + successful integration test
parent
15859391a1
commit
47edf0df34
|
@ -71,7 +71,7 @@ task integrationTest(type: Test) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gretty {
|
gretty {
|
||||||
httpPort = 8081
|
httpPort = 8082
|
||||||
contextPath = '/'
|
contextPath = '/'
|
||||||
integrationTestTask = 'integrationTest'
|
integrationTestTask = 'integrationTest'
|
||||||
loggingLevel = 'TRACE'
|
loggingLevel = 'TRACE'
|
||||||
|
|
|
@ -11,7 +11,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import meerkat.bulletinboard.BulletinBoardServer;
|
import meerkat.bulletinboard.BulletinBoardServer;
|
||||||
import meerkat.bulletinboard.sqlserver.SQLiteBulletinBoardServer;
|
import meerkat.bulletinboard.sqlserver.SQLiteBulletinBoardServer;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
|
|
||||||
public class BulletinBoardHttpServer extends HttpServlet {
|
public class BulletinBoardHttpServer extends HttpServlet {
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ package meerkat.bulletinboard.service;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import meerkat.protobuf.Crypto;
|
import meerkat.protobuf.Crypto;
|
||||||
import meerkat.protobuf.Voting;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,7 +15,7 @@ public class HelloProtoBuf {
|
||||||
public Message sayHello() {
|
public Message sayHello() {
|
||||||
BulletinBoardMessage.Builder msg = BulletinBoardMessage.newBuilder();
|
BulletinBoardMessage.Builder msg = BulletinBoardMessage.newBuilder();
|
||||||
|
|
||||||
Voting.UnsignedBulletinBoardMessage.Builder unsigned = Voting.UnsignedBulletinBoardMessage.newBuilder();
|
UnsignedBulletinBoardMessage.Builder unsigned = UnsignedBulletinBoardMessage.newBuilder();
|
||||||
unsigned.setData(ByteString.copyFromUtf8("Hello World!"));
|
unsigned.setData(ByteString.copyFromUtf8("Hello World!"));
|
||||||
List<String> tags = Arrays.asList("Greetings", "FirstPrograms");
|
List<String> tags = Arrays.asList("Greetings", "FirstPrograms");
|
||||||
unsigned.addAllTags(tags);
|
unsigned.addAllTags(tags);
|
||||||
|
|
|
@ -3,10 +3,6 @@ package meerkat.bulletinboard.sqlserver;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
|
|
||||||
import com.google.protobuf.ProtocolStringList;
|
import com.google.protobuf.ProtocolStringList;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
@ -16,14 +12,11 @@ import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
|
||||||
import meerkat.bulletinboard.BulletinBoardServer;
|
import meerkat.bulletinboard.BulletinBoardServer;
|
||||||
import meerkat.protobuf.Voting.MessageFilterList;
|
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Crypto.SignatureVerificationKey;
|
import meerkat.protobuf.Crypto.SignatureVerificationKey;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessageList;
|
|
||||||
import meerkat.crypto.Digest;
|
import meerkat.crypto.Digest;
|
||||||
import meerkat.crypto.concrete.SHA256Digest;
|
import meerkat.crypto.concrete.SHA256Digest;
|
||||||
import meerkat.protobuf.Voting.MessageID;
|
|
||||||
|
|
||||||
public abstract class BulletinBoardSQLServer implements BulletinBoardServer{
|
public abstract class BulletinBoardSQLServer implements BulletinBoardServer{
|
||||||
|
|
||||||
|
@ -69,10 +62,17 @@ public abstract class BulletinBoardSQLServer implements BulletinBoardServer{
|
||||||
*/
|
*/
|
||||||
protected abstract void insertNewTags(String[] tags) throws SQLException;
|
protected abstract void insertNewTags(String[] tags) throws SQLException;
|
||||||
|
|
||||||
|
private BoolMsg boolToBoolMsg(boolean b){
|
||||||
|
return BoolMsg.newBuilder()
|
||||||
|
.setValue(b)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean postMessage(BulletinBoardMessage msg) throws CommunicationException {
|
public BoolMsg postMessage(BulletinBoardMessage msg) throws CommunicationException {
|
||||||
|
|
||||||
if (!verifyMessage(msg)) {
|
if (!verifyMessage(msg)) {
|
||||||
return false;
|
return boolToBoolMsg(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement pstmt;
|
PreparedStatement pstmt;
|
||||||
|
@ -130,7 +130,7 @@ public abstract class BulletinBoardSQLServer implements BulletinBoardServer{
|
||||||
throw new CommunicationException("Error Linking tags: " + e.getMessage());
|
throw new CommunicationException("Error Linking tags: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return boolToBoolMsg(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,9 +4,6 @@ import java.sql.DriverManager;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
@ -16,20 +13,14 @@ import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
|
||||||
|
|
||||||
import com.google.protobuf.Message;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.BulletinBoardServer;
|
|
||||||
import meerkat.protobuf.Bulletinboardserver;
|
|
||||||
import meerkat.protobuf.Voting.MessageFilterList;
|
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
import meerkat.bulletinboard.sqlserver.BulletinBoardSQLServer;
|
import meerkat.bulletinboard.sqlserver.BulletinBoardSQLServer;
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessageList;
|
|
||||||
|
|
||||||
|
|
||||||
@Path("/SQLServer")
|
@Path("/sqlserver")
|
||||||
public class SQLiteBulletinBoardServer extends BulletinBoardSQLServer {
|
public class SQLiteBulletinBoardServer extends BulletinBoardSQLServer {
|
||||||
|
|
||||||
protected static final int TIMEOUT = 20;
|
protected static final int TIMEOUT = 20;
|
||||||
|
@ -104,24 +95,15 @@ public class SQLiteBulletinBoardServer extends BulletinBoardSQLServer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Path("postmessage")
|
||||||
|
@POST
|
||||||
@Override
|
@Override
|
||||||
public boolean postMessage(BulletinBoardMessage msg) throws CommunicationException {
|
public BoolMsg postMessage(BulletinBoardMessage msg) throws CommunicationException {
|
||||||
return super.postMessage(msg);
|
return super.postMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Path("readmessages")
|
||||||
@POST
|
@POST
|
||||||
@Consumes(Constants.MEDIATYPE_PROTOBUF)
|
|
||||||
@Produces(Constants.MEDIATYPE_PROTOBUF)
|
|
||||||
public Message doPostMessage(BulletinBoardMessage msg)throws CommunicationException {
|
|
||||||
boolean result = super.postMessage(msg);
|
|
||||||
|
|
||||||
return BulletinBoardServer.Boolean.newBuilder()
|
|
||||||
.setValue(result)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
// @GET
|
|
||||||
@Consumes(Constants.MEDIATYPE_PROTOBUF)
|
@Consumes(Constants.MEDIATYPE_PROTOBUF)
|
||||||
@Produces(Constants.MEDIATYPE_PROTOBUF)
|
@Produces(Constants.MEDIATYPE_PROTOBUF)
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,10 +3,8 @@ package meerkat.bulletinboard.webapp;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import meerkat.bulletinboard.service.HelloProtoBuf;
|
import meerkat.bulletinboard.service.HelloProtoBuf;
|
||||||
import meerkat.protobuf.Crypto.Signature;
|
import meerkat.protobuf.Crypto.*;
|
||||||
import meerkat.protobuf.Crypto.SignatureType;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
|
||||||
import meerkat.protobuf.Voting.UnsignedBulletinBoardMessage;
|
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package meerkat.bulletinboard;
|
package meerkat.bulletinboard;
|
||||||
|
|
||||||
import meerkat.protobuf.Voting;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
import meerkat.rest.ProtobufMessageBodyReader;
|
import meerkat.rest.ProtobufMessageBodyReader;
|
||||||
import meerkat.rest.ProtobufMessageBodyWriter;
|
import meerkat.rest.ProtobufMessageBodyWriter;
|
||||||
|
@ -29,8 +29,8 @@ public class HelloProtoIntegrationTest {
|
||||||
client.register(ProtobufMessageBodyWriter.class);
|
client.register(ProtobufMessageBodyWriter.class);
|
||||||
|
|
||||||
WebTarget webTarget = client.target(BASE_URL).path(HELLO_URL);
|
WebTarget webTarget = client.target(BASE_URL).path(HELLO_URL);
|
||||||
Voting.BulletinBoardMessage response = webTarget.request(Constants.MEDIATYPE_PROTOBUF)
|
BulletinBoardMessage response = webTarget.request(Constants.MEDIATYPE_PROTOBUF)
|
||||||
.get(Voting.BulletinBoardMessage.class);
|
.get(BulletinBoardMessage.class);
|
||||||
|
|
||||||
System.out.println(response.getMsg().getData());
|
System.out.println(response.getMsg().getData());
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ package meerkat.bulletinboard;
|
||||||
|
|
||||||
|
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import meerkat.protobuf.Crypto.Signature;
|
import meerkat.protobuf.Crypto.*;
|
||||||
import meerkat.protobuf.Crypto.SignatureType;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
|
||||||
import meerkat.protobuf.Voting.UnsignedBulletinBoardMessage;
|
|
||||||
import meerkat.rest.Constants;
|
import meerkat.rest.Constants;
|
||||||
import meerkat.rest.ProtobufMessageBodyReader;
|
import meerkat.rest.ProtobufMessageBodyReader;
|
||||||
import meerkat.rest.ProtobufMessageBodyWriter;
|
import meerkat.rest.ProtobufMessageBodyWriter;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -21,9 +20,9 @@ import javax.ws.rs.core.Response;
|
||||||
public class SQLiteServerIntegrationTest {
|
public class SQLiteServerIntegrationTest {
|
||||||
|
|
||||||
private static String PROP_GETTY_URL = "gretty.httpBaseURI";
|
private static String PROP_GETTY_URL = "gretty.httpBaseURI";
|
||||||
private static String DEFAULT_BASE_URL = "http://localhost:8081/";
|
private static String DEFAULT_BASE_URL = "localhost:8082";
|
||||||
private static String BASE_URL = System.getProperty(PROP_GETTY_URL, DEFAULT_BASE_URL);
|
private static String BASE_URL = System.getProperty(PROP_GETTY_URL, DEFAULT_BASE_URL);
|
||||||
private static String SQL_SERVER_URL = "SQLServer";
|
private static String SQL_SERVER_URL = "sqlserver/postmessage";
|
||||||
|
|
||||||
Client client;
|
Client client;
|
||||||
|
|
||||||
|
@ -57,19 +56,13 @@ public class SQLiteServerIntegrationTest {
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// SQLiteBulletinBoardServer bbs = new SQLiteBulletinBoardServer();
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// bbs.init();
|
|
||||||
//
|
|
||||||
// bbs.postMessage(msg);
|
|
||||||
// response = Response.status(Status.OK).entity(bbs.testPrint()).build();
|
|
||||||
//
|
|
||||||
// bbs.close();
|
|
||||||
|
|
||||||
System.err.println("******** Testing: " + SQL_SERVER_URL);
|
System.err.println("******** Testing: " + SQL_SERVER_URL);
|
||||||
WebTarget webTarget = client.target(BASE_URL).path(SQL_SERVER_URL);
|
WebTarget webTarget = client.target(BASE_URL).path(SQL_SERVER_URL);
|
||||||
response = webTarget.request(Constants.MEDIATYPE_PROTOBUF).post(Entity.entity(msg, Constants.MEDIATYPE_PROTOBUF));
|
response = webTarget.request(Constants.MEDIATYPE_PROTOBUF).post(Entity.entity(msg, Constants.MEDIATYPE_PROTOBUF));
|
||||||
|
System.err.println(response);
|
||||||
|
BoolMsg bool = response.readEntity(BoolMsg.class);
|
||||||
|
assert bool.getValue();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import static meerkat.protobuf.Voting.*;
|
import static meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package meerkat.bulletinboard;
|
package meerkat.bulletinboard;
|
||||||
|
|
||||||
import meerkat.comm.*;
|
import meerkat.comm.*;
|
||||||
import static meerkat.protobuf.Voting.*;
|
import static meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package meerkat.bulletinboard;
|
package meerkat.bulletinboard;
|
||||||
|
|
||||||
import meerkat.comm.CommunicationException;
|
import meerkat.comm.CommunicationException;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessage;
|
import meerkat.protobuf.BulletinBoardAPI.*;
|
||||||
import meerkat.protobuf.Voting.BulletinBoardMessageList;
|
|
||||||
import meerkat.protobuf.Voting.MessageFilterList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Arbel on 07/11/15.
|
* Created by Arbel on 07/11/15.
|
||||||
|
@ -24,10 +22,10 @@ public interface BulletinBoardServer{
|
||||||
/**
|
/**
|
||||||
* Post a message to bulletin board.
|
* Post a message to bulletin board.
|
||||||
* @param msg is the actual (signed) message
|
* @param msg is the actual (signed) message
|
||||||
* @return TRUE if the message has been authenticated and FALSE otherwise.
|
* @return TRUE if the message has been authenticated and FALSE otherwise (in ProtoBuf form).
|
||||||
* @throws CommunicationException on DB connection error.
|
* @throws CommunicationException on DB connection error.
|
||||||
*/
|
*/
|
||||||
public boolean postMessage(BulletinBoardMessage msg) throws CommunicationException;
|
public BoolMsg postMessage(BulletinBoardMessage msg) throws CommunicationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read all messages posted matching the given filter.
|
* Read all messages posted matching the given filter.
|
||||||
|
|
|
@ -17,7 +17,7 @@ import static meerkat.protobuf.Crypto.*;
|
||||||
/**
|
/**
|
||||||
* Created by talm on 25/10/15.
|
* Created by talm on 25/10/15.
|
||||||
*
|
*
|
||||||
* Sign and verifyarrays of messages
|
* Sign and verify arrays of messages
|
||||||
*/
|
*/
|
||||||
public interface DigitalSignature {
|
public interface DigitalSignature {
|
||||||
final public static String CERTIFICATE_ENCODING_X509 = "X.509";
|
final public static String CERTIFICATE_ENCODING_X509 = "X.509";
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package meerkat;
|
||||||
|
|
||||||
|
option java_package = "meerkat.protobuf";
|
||||||
|
|
||||||
|
import 'meerkat/crypto.proto';
|
||||||
|
|
||||||
|
message BoolMsg {
|
||||||
|
bool value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message MessageID {
|
||||||
|
// The ID of a message for unique retrieval.
|
||||||
|
// Note that it is assumed that this ID is a function of the message itself.
|
||||||
|
bytes ID = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BulletinBoardMessageList {
|
||||||
|
|
||||||
|
repeated BulletinBoardMessage messages = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FilterType {
|
||||||
|
ID = 0; // Match exact message ID
|
||||||
|
EXACT_ENTRY = 1; // Match exact entry number in database (chronological)
|
||||||
|
MAX_ENTRY = 2; // Find all entries in database up to specified entry number (chronological)
|
||||||
|
SIGNATURE = 3; // Find all entries in database that correspond to specific signature (signer)
|
||||||
|
TAG = 4; // Find all entries in database that have a specific tag
|
||||||
|
MAX_MESSAGES = 5; // Return at most some specified number of messages
|
||||||
|
}
|
||||||
|
|
||||||
|
message MessageFilter {
|
||||||
|
|
||||||
|
FilterType type = 1;
|
||||||
|
|
||||||
|
// Concrete data input to filter
|
||||||
|
bytes filter = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MessageFilterList {
|
||||||
|
|
||||||
|
// Combination of filters.
|
||||||
|
// To be implemented using intersection ("AND") operations.
|
||||||
|
repeated MessageFilter filters = 1;
|
||||||
|
|
||||||
|
}
|
|
@ -6,59 +6,6 @@ import 'meerkat/crypto.proto';
|
||||||
|
|
||||||
option java_package = "meerkat.protobuf";
|
option java_package = "meerkat.protobuf";
|
||||||
|
|
||||||
message MessageID {
|
|
||||||
// The ID of a message for unique retrieval.
|
|
||||||
// Note that it is assumed that this ID is a function of the message itself.
|
|
||||||
bytes ID = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BulletinBoardMessageList {
|
|
||||||
|
|
||||||
repeated BulletinBoardMessage messages = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
enum FilterType {
|
|
||||||
ID = 0; // Match exact message ID
|
|
||||||
EXACT_ENTRY = 1; // Match exact entry number in database (chronological)
|
|
||||||
MAX_ENTRY = 2; // Find all entries in database up to specified entry number (chronological)
|
|
||||||
SIGNATURE = 3; // Find all entries in database that correspond to specific signature (signer)
|
|
||||||
TAG = 4; // Find all entries in database that have a specific tag
|
|
||||||
MAX_MESSAGES = 5; // Return at most some specified number of messages
|
|
||||||
}
|
|
||||||
|
|
||||||
message MessageFilter {
|
|
||||||
|
|
||||||
FilterType type = 1;
|
|
||||||
|
|
||||||
// Concrete data input to filter
|
|
||||||
bytes filter = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message MessageFilterList {
|
|
||||||
|
|
||||||
// Combination of filters.
|
|
||||||
// To be implemented using intersection ("AND") operations.
|
|
||||||
repeated MessageFilter filters = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// A ballot question. This is an opaque
|
// A ballot question. This is an opaque
|
||||||
// data type that is parsed by the UI to display
|
// data type that is parsed by the UI to display
|
||||||
// the question.
|
// the question.
|
||||||
|
|
|
@ -2,7 +2,7 @@ package meerkat.crypto.concrete;
|
||||||
|
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import meerkat.protobuf.Crypto;
|
import meerkat.protobuf.Crypto;
|
||||||
import meerkat.protobuf.Voting;
|
import meerkat.protobuf.Bulletinboardserver.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
@ -149,13 +149,13 @@ public class TestECDSASignature {
|
||||||
signer.loadSigningCertificate(keyStore);
|
signer.loadSigningCertificate(keyStore);
|
||||||
|
|
||||||
|
|
||||||
Voting.UnsignedBulletinBoardMessage.Builder unsignedMsgBuilder = Voting.UnsignedBulletinBoardMessage.newBuilder();
|
UnsignedBulletinBoardMessage.Builder unsignedMsgBuilder = UnsignedBulletinBoardMessage.newBuilder();
|
||||||
unsignedMsgBuilder.setData(ByteString.copyFromUtf8(HELLO_WORLD));
|
unsignedMsgBuilder.setData(ByteString.copyFromUtf8(HELLO_WORLD));
|
||||||
unsignedMsgBuilder.addTags("Tag1");
|
unsignedMsgBuilder.addTags("Tag1");
|
||||||
unsignedMsgBuilder.addTags("Tag2");
|
unsignedMsgBuilder.addTags("Tag2");
|
||||||
unsignedMsgBuilder.addTags("Tag3");
|
unsignedMsgBuilder.addTags("Tag3");
|
||||||
|
|
||||||
Voting.UnsignedBulletinBoardMessage usMsg = unsignedMsgBuilder.build();
|
UnsignedBulletinBoardMessage usMsg = unsignedMsgBuilder.build();
|
||||||
|
|
||||||
signer.updateContent(usMsg);
|
signer.updateContent(usMsg);
|
||||||
Crypto.Signature sig = signer.sign();
|
Crypto.Signature sig = signer.sign();
|
||||||
|
|
Loading…
Reference in New Issue