Skip to content

kastel-security/electionguard-kotlin-multiplatform

 
 

Repository files navigation

ElectionGuard-Kotlin-Multiplatform

This is a fork from https://github.com/votingworks/electionguard-kotlin-multiplatform aiming to provide a kotlin/js implementation for ballot encryption in order to be used in a web environment.

Therefore, we split the project in the following modules targeting different platforms:

Module JVM JS Node JS Browser
egklib-core
egklib-trustee
egklib-encrypt
egklib
egk-cli

Contributions Overview

  • Using the big-integer module as a replacement for java.math.BigInteger
  • Getting randomness from window.crypto or node:crypto.webcrypto instead of java.security.SecureRandom
  • Using @noble/hashes for sha256 and hmac.
  • For IO operations, we are using kotlin-node from the kotlin-wrappers project.
  • Amend signature of hashFunction and hmacFunction to address platform differences regarding number types.
  • Parallelized and thread-safe implementations are ported to the JS platform by only considering single-threaded execution.

TODO's

  • Provide readline functionality in the egk-cli module for the JS Node platform.
  • Investigate performance deficits on node and browser platforms.

The original README follows:

last update 01/21/2024

ElectionGuard-Kotlin-Multiplatform (EGK) is a Kotlin Multiplatform implementation of ElectionGuard, version 2.0.0, available under an MIT-style open source License.

Our GitHub repository is now hosted by VotingWorks.

Currently we have ~88% LOC code coverage on the common and jvm core library (7024/7995 LOC). We are focusing on just the JVM implementation, and will consider native and other implementations in the future.

Library dependencies are summarized here.

Currently Java 17 is required.

Table of contents:

Getting Started

Workflow and Command Line Programs

Serialization

We are waiting for the 2.0 JSON serialization specification from Microsoft, before finalizing our serialization. For now, we are still mostly using the 1.9 serialization.

Support for Protocol Buffers has been moved to this repo.

JSON Serialization specification

Validation

Verification

Test Vectors

These are JSON files that give inputs and expected outputs for the purpose of testing interoperability between implementations.

Implementation Notes

Authors

About

An implementation of ElectionGuard version 2.0.0 in Kotlin.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Kotlin 99.9%
  • JavaScript 0.1%