-
Notifications
You must be signed in to change notification settings - Fork 1
Server communication
The system contains multiple servers, which all have APIs. These APIs can be found on this page. Communication is through REST.
To secure the connection between the servers, and the clients casting votes, we implemented HTTPS SSL connections.
This is done using a ServerConnector
with a HTTPS SslContextFactory
, and a HttpConfiguration
. We've also created a self-signed certificate by running keytool -keystore -alias evhe -keyalg RSA -keysize 2048
, outputting a keystore.jks file, which we store in /certs/.
In order for testing on localhost, we added the following code
HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> hostname.equals("localhost"))
For our client and public server to be able to talk to the key server, they use an SSLContext
with a TrustManagerFactory
loading our certificate. The SSLContext is then added to the JerseyClientBuilder.
Request that requests the key-server to send a public-key to be used in the voting session.
key | value |
---|---|
Type | GET |
Path | /publicKey |
Params | None |
Resp | Hexadecimal public key |
Code | 200/500 |
Request that prompts the server for a plaintext of the given ciphertext
key | value |
---|---|
Type | POST |
Path | /result |
Params | None |
Body | Encrypted sum of all votes |
Resp | Sum of all votes |
Code | 200/500 |
Request that requests the public server to send a public-key to be used in the voting session.
404 is returned if the server does not yet have a public key in store
key | value |
---|---|
Type | GET |
Path | /publicKey |
Params | None |
Resp | Hexadecimal public key |
Code | 200/404/500 |
Request that posts an encrypted vote to the public server.
Returns 403: Permission Denied
if vote has already been cast
key | value |
---|---|
Type | POST |
Path | /vote |
Params | None |
Body | Tuple: (ID, Encrypted vote) |
Resp | Empty |
Code | 204/403/500 |
key | value |
---|---|
Type | GET |
Path | /generateVoters |
Params | None |
Resp | newline seperated ids(HTML) |
Code | 200/500 |
key | value |
---|---|
Type | GET |
Path | /result |
Params | None |
Resp | result as HTML |
Code | 200/500 |
For iteration two the API needed to be updated to change the nature of the public server to become that of a bulletin board.
For the vote verification part of the iteration to work the signature of votes will also need to be updated
For this the following API entries were added to PublicServer
:
key | value |
---|---|
Type | GET |
Path | /getVotes |
Params | None |
Resp | List of votes |
Code | 200/404/500 |
key | value |
---|---|
Type | POST |
Path | /vote |
Params | None |
Body | Tuple:(ID, Enc(vote), proof) |
Resp | Empty |
Code | 204/403/500 |
Where proof is a proof that the vote is either 0 or 1.