mirror of
https://github.com/saymrwulf/swisspost-evoting-go-poc.git
synced 2026-05-14 20:58:03 +00:00
Proof-of-concept reimplementation of the Swiss Post e-voting cryptographic protocol in Go. Single binary, 52 source files, 2 dependencies. Covers ElGamal encryption, Bayer-Groth verifiable shuffles, zero-knowledge proofs, return codes, and a full election ceremony demo.
38 lines
1 KiB
Go
38 lines
1 KiB
Go
package zkp
|
|
|
|
import (
|
|
emath "github.com/user/evote/pkg/math"
|
|
)
|
|
|
|
// SchnorrProof is a proof of knowledge of discrete logarithm.
|
|
// Proves knowledge of x such that y = g^x.
|
|
type SchnorrProof struct {
|
|
E emath.ZqElement // Hash challenge
|
|
Z emath.ZqElement // Response
|
|
}
|
|
|
|
// ExponentiationProof proves that multiple values are exponentiations
|
|
// of bases by the same exponent.
|
|
type ExponentiationProof struct {
|
|
E emath.ZqElement // Hash challenge
|
|
Z emath.ZqElement // Response
|
|
}
|
|
|
|
// PlaintextEqualityProof proves two ciphertexts encrypt the same plaintext
|
|
// under different keys.
|
|
type PlaintextEqualityProof struct {
|
|
E emath.ZqElement // Hash challenge
|
|
Z *emath.ZqVector // Response vector (size 2)
|
|
}
|
|
|
|
// DecryptionProof proves correct decryption of an ElGamal ciphertext.
|
|
type DecryptionProof struct {
|
|
E emath.ZqElement // Hash challenge
|
|
Z *emath.ZqVector // Response vector (size l)
|
|
}
|
|
|
|
// VerifiableDecryptions holds a set of decrypted messages with proofs.
|
|
type VerifiableDecryptions struct {
|
|
Messages []emath.GqElement
|
|
Proofs []DecryptionProof
|
|
}
|