Skip to content

kastel-security/electionguard-java

 
 

Repository files navigation

🗳 ElectionGuard Java

last changed: 03/01/2022

This is a port of https://github.com/microsoft/electionguard-python/ to Java.

Also see:

Election Verification

To verify an Election Record:

The full Verification Specification is implemented.

Workflow using Remote Guardians

The following command line programs run the entire workflow needed to run an election:

  1. RemoteKeyCeremony

  2. RemoteKeyCeremonyTrustee

  3. EncryptBallots

  4. AccumulateTally

  5. RemoteDecryption

  6. RemoteDecryptionTrustee

The entire workflow, consisting of the above steps plus verification can be run from a single command:

Election Record

Serialization

Election Record Visualization

A simple Swing-based visualization of the Election Record. This is a debugging tool for developers, not a polished tool for end-users (eg election officials).

Input Validation

Election manifest, input ballot, and encrypted and decrypted tallies can be validated for consistency by classes in the com.sunya.electionguard.input package. These are complementary to the cyptographic verifications.

Library Use

ElectionGuard-Java is a full port of the ElectionGuard python library, and can be used in your own projects. Contributions here and to the python library are welcome!

Building from source

git clone https://github.com/JohnLCaron/electionguard-java.git
cd electionguard-java
./gradlew clean assemble fatJar myJavadocs

The javadocs will be in build/docs/javadoc/index.html. The jars will be in build/libs. Good luck, Jim.

Protobuf definitions

These may be interesting to implement in other libraries:

Python vs Java

Notes

  • Assumes Java 17.
  • Most classes are immutable. Builders are used where needed to separate mutable and immutable uses.
  • Uses Java's BigInteger for cryptographic computations.
  • Uses Gson for JSON serialization.
  • Also serializes using protobuf.
  • Use Java record classes instead of @AutoValue
  • Uses Flogger for logging.
  • Uses JUnit5, jqwik, Mockito for testing.
  • Uses gradle 7 for building.

TODO

  • Not yet fully compatible with python library JSON serialization
  • Review error logging.
  • Measure computational performance.
  • Investigate parallelization strategies.