Ballot Encryption
An ElectionGuard ballot is comprised entirely of encryptions of one (indicating selection made) and zero (indicating selection not made). To enable homomorphic addition (for tallying), these values are exponentiated during encryption. Specifically, to encrypt a ballot entry \((V)\), a random value \(R\) is selected such that \(0 \le R \lt q\) and the following computation is performed:
Zero (not selected) is encrypted as
One (selected) is encrypted as
Note that if multiple encrypted votes
are formed, their componentwise product
serves as an encryption of \(\sum_iV_i\) – which is the tally of those votes.^{1}
A contest in an election consists of a set of options together with a selection limit that indicates the number of selections that are allowed to be made in that contest. In most elections, most contests have a selection limit of one. However, a larger selection limit (e.g., select up to three) is not uncommon in some elections. Approval voting can be achieved by setting the selection limit to the total number of options in a contest. Ranked choice voting is not supported in this version of ElectionGuard, but it may be enabled in a future version.^{2} Also, writeins are assumed to be explicitly registered or allowed to be lumped into a single "writeins" category for the purpose of verifiable tallying. Verifiable tallying of freeform writeins may be best done with a MixNet^{3} design.
A legitimate vote in a contest consists of a set of selections with cardinality not exceeding the selection limit of that contest. To accommodate legitimate undervotes, the internal representation of a contest is augmented with “placeholder” options equal in number to the selection limit. Placeholder options are selected as necessary to force the total number of selections made in a contest to be equal to the selection limit. When the selection limit is one, for example, the single placeholder option can be thought of as a “none of the above” option.
With larger selection limits, the number of placeholder options selected corresponds to the number of additional options that a voter could have selected in a contest.
Info
For efficiency, the placeholder options could be eliminated in an approval vote. However, to simplify the construction of election verifiers, we presume that placeholder options are always present – even for approval votes.
Two things must now be proven about the encryption of each vote to ensure the integrity of a ballot.
 The encryption associated with each option is either an encryption of zero or an encryption of one.
 The sum of all encrypted values in each contest is equal to the selection limit for that contest (usually one).
The use of ElGamal encryption enables efficient zeroknowledge proofs of these requirements, and the FiatShamir heuristic can be used to make these proofs noninteractive. Chaum Pedersen proofs are used to demonstrate that an encryption is that of a specified value, and these are combined with the CramerDamgårdSchoenmakers technique to show that an encryption is that of one of a specified set of values – particularly that a value is an encryption of either zero or one. The encryptions of selections in a contest are homomorphically combined, and the result is shown to be an encryption of that contest’s selection limit – again using a ChaumPedersen proof.
Info
Note that the decryption of the selection limit could be more efficiently demonstrated by just releasing the sum of the nonces used for each of the individual encryptions. But, again to simplify the construction of election verifiers, a ChaumPedersen proof is used here as well.
The “random” nonces used for the ElGamal encryption of the ballot nonces are derived from a single 256bit master nonce \(R_B\) for each ballot. For each contest listed in the ballot coding file, a contest nonce \(R_C\) is derived from the master nonce \((R_B)\) and the contest label \((L_C)\) as
using the hash function SHA256. For each option listed in the ballot coding file, the nonce used to encrypt that option is derived from the contest nonce \((R_C)\) and the selection label for that option \((L_S)\) as
A user of ElectionGuard may optionally provide an additional public key. If such a key is provided, ElectionGuard uses that key to encrypt each ballot’s master nonce \(R_B\) and return this encryption together with the encrypted ballot.
Ballot nonces may be independent across different ballots, and only the nonces used to encrypt ballot selections need to be derived from the master nonce. The use of a single master nonce for each ballot allows the entire ballot encryption to be rederived from the contents of a ballot and the master nonce. It also allows the encrypted ballot to be fully decrypted with the single master nonce.
Outline for proofs of ballot correctness
To prove that an ElGamal encryption pair \((\alpha, \beta)\) is an encryption of zero, the ChaumPedersen protocol proceeds as follows.
NIZK Proof that \((\alpha, \beta)\) is an encryption of zero (given knowledge of encryption nonce \(R\))
The prover selects a random value \(u\) in \(Z_q\) and commits to the pair
A hash computation is then performed (using the FiatShamir heuristic) to create a pseudorandom challenge value
and the prover responds with
A verifier can now confirm the claim by checking that both
and
are true.
NIZK Proof that \((\alpha,\beta)\) is an encryption of one (given knowledge of encryption nonce \(R\))
To prove that \((\alpha, \beta)\) is an encryption of one, \(\frac{\beta}{g} \bmod p\) is substituted for \(\beta\) in the above. The verifier can be relieved of the need to perform a modular division by computing \(\beta \bar{g} \bmod p\) rather than \(\beta \bmod p\). As an alternative, the verifier can confirm that
instead of
As with many zeroknowledge protocols, if the prover knows a challenge value prior to making its commitment, it can create a false proof. For example, if a challenge \(c\) is known to be forthcoming, a prover can generate a random \(v\) in \(Z_q\) and commit to
This selection will satisfy the required checks for (α,β) to appear as an encryption of zero regardless of the values of (α,β). Similarly, setting
will satisfy the required checks for \((\alpha,\beta)\) to appear as an encryption of one regardless of the values of (α,β). This quirk is what enables the CramerDamgårdSchoenmakers technique to prove a disjunction of two predicates.
Sketch of NIZK Proof that (\alpha, \beta) is an encryption of zero or one
After the prover makes commitments \((a_0,b_0 )\) and \((a_1,b_1 )\) to the respective assertions that \((α,β)\) is an encryption of zero and \((α,β)\) is an encryption of one, a single challenge value \(c\) is selected by hashing all commitments and baseline parameters. The prover must then provide challenge values \(c_0\) and \(c_1\) such that \(c=c_0+c_1 \bmod q\). Since the prover has complete freedom to choose one of \(c_0\) and \(c_1\), the prover can fix one value in advance – either \(c_0\) if \((α,β)\) is actually an encryption of one or \(c_1\) if \((α,β)\) is actually an encryption of zero. In response to the resulting challenge \(c\), the prover uses this freedom to answer its faux claim with its chosen challenge value and then uses the remaining challenge value (as forced by the constraint that \(c=(c_0+c_1 ) \bmod q)\) to demonstrate the truth of the other claim. An observer can see that one of the two claims must be true but cannot tell which.
Details for proofs of ballot correctness
The full protocol proceeds as follows – fully divided into the two cases. To encrypt an “unselected” option on a ballot, a random nonce R is selected uniformly Z_q and an encryption of zero is formed as
NIZK Proof that \((\alpha,\beta)\) is an encryption of zero or one (given knowledge of encryption nonce \(R\) for which \((α,β)\) is an encryption of zero)
To create the proof that \((α,β)\) is an encryption of a zero or a one, randomly select \(c_1\), \(v_1\), and \(u_0\) from \(Z_q\) and form the commitments
and
A challenge value \(c\) is formed by hashing the extended base hash \(\bar{Q}\) together with \((\alpha,\beta)\), \((a_0,b_0 )\), and \((a_1,b_1 )\) to form a challenge value
The proof is completed by forming \(c_0=(cc_1 ) \bmod q\) and \(v_0=(u_0+c_0 \cdot R) \bmod q\) and answering the challenge by returning \(c_0\), \(c_1\), \(v_0\), and \(v_1\).
To encrypt a “selected” option on a ballot, a random nonce \(R\) is selected uniformly from \(Z_q\) and an encryption of one is formed as \((\alpha,\beta)=(g^r \bmod p, g \cdot K^r \bmod p)\).
NIZK Proof that \((\alpha,\beta)\) is an encryption of zero or one (given knowledge of encryption nonce \(R\) for which \((\alpha,\beta)\) is an encryption of one)
To create the proof that \((\alpha,\beta)\) is an encryption of a zero or a one, randomly select \(c_0\), \(v_0\), and \(u_1\) from \(Z_q\) and form the commitments
and
A challenge value \(c\) is formed by hashing the extended base hash \(\bar{Q}\) together with \((\alpha,\beta)\), \((a_0,b_0 )\), and \((a_1,b_1 )\) to form a challenge value
The proof is completed by forming
and
and answering the challenge by returning \(c_0\), \(c_1\), \(v_0\), and \(v_1\).
In either of the two above cases, what is published in the election record is the encryption \((\alpha,\beta)\) together with the commitments \((a_0,b_0 )\) and \((a_1,b_1 )\) which are all hashed together with the election’s extended base hash to form the challenge value c which is published together with values \(c_0\), \(c_1\), \(v_0\), and \(v_1\).
Important
An election verifier must confirm the following for each possible selection on a ballot:
(A) The given values \(\alpha\), \(\beta\), \(a_0\), \(b_0\), \(a_1\), and \(b_1\) are all in the set \(Z_p^r\). (A value \(x\) is in \(Z_p^r\) if and only if \(x\) is an integer such that \(0 \le x \lt p\) and \(x^q \bmod p=1\) is satisfied.)
(B) The challenge \(c\) is correctly computed as
(C) The given values c_0, c_1, v_0, and v_1 are each in the set Z_q. (A value \(x\) is in \(Z_q\) if and only if \(x\) is an integer such that \(0 \le x \lt q\)).
(D) The equation
is satisfied.
(E) The equation
is satisfied.
(F) The equation
is satisfied.
(G) The equation
is satisfied.
(H) The equation
is satisfied.
Proof of satisfying the selection limit
The final step in proving that a ballot is wellformed is demonstrating that the selection limits for each contest have not been exceeded. This is accomplished by homomorphically combining all of the \((\alpha_i,\beta_i )\) values for a contest by forming the aggregate contest encryption
and proving that \((\alpha,\beta)\) is an encryption of the total number of votes allowed for that contest (usually one). The simplest way to complete this proof is to combine all of the random nonces \(R_i\) that were used to form each
or
depending on whether the value encrypted is zero or one. The aggregate nonce
matches the aggregate contest encryption as
where \(L\) is the selection limit for the contest. (Recall that \(L\) extra “placeholder” positions will be added to each contest and set to one as necessary to ensure that exactly \(L\) selections are made for the contest.)
NIZK Proof that \((\alpha,\beta)\) is an encryption of \(L\) (given knowledge of aggregate encryption nonce \(R\))
An additional ChaumPedersen proof of \((\alpha,\beta)\) being an encryption of \(L\) is performed by selecting a random \(U\) in \(Z_q\), publishing
then hashing these values together with the election’s extended base hash \(\bar{Q}\) to form a pseudorandom challenge
and responding by publishing ^{4}
Note that all of the above proofs can be performed directly by the entity performing the public key encryption of a ballot without access to the decryption key(s). All that is required is the nonces \(R_i\) used for the individual selection encryptions.
Important
An election verifier must confirm the following for each contest on the ballot:
(A) The number of placeholder positions matches the contest’s selection limit \(L\)
(B) The contest total \((A,B)\) satisfies
and
where the \((\alpha_i,\beta_i )\) represent all possible selections (including placeholder selections) for the contest.
(C) The given value \(V\) is in \(Z_q\).
(D) The given values \(a\) and \(b\) are each in \(Z_p^r\).
(E) The challenge value \(C\) is correctly computed as
(F) The equation
is satisfied.
(G) The equation
is satisfied.
Verification Codes
Upon completion of the encryption of each ballot, a verification code is prepared for each voter. The code is a running hash that begins with the extended base hash code \(\bar{Q}\) and includes an identifier for the voting device, the location of the voting device, the date and time that the ballot was encrypted, and, of course, the encryption of the ballot itself. The hash \((H)\) used for this purpose is SHA256.
The tracking code is formed as follows.
where \(\bar{Q}\) is the extended base hash code of the election. For ballot with index \(i>0\),
where \(D\) consists of the voting device information described above, \(T\) is the date and time of ballot encryption, and \(B_i\) is an ordered list of the individual encryptions on the ballot – with the ordering as specified by the ballot coding file. At the conclusion of a voting period (this may be the end of a day in a multiday election), the hash chain is closed by computing
where \(H_l\) is the final tracking code produced by that device during that voting period. The close of the hash chain can be computed either by the voting device or subsequently by election administrators, and it is published as part of the election record.
Important
An election verifier must confirm that each of the values in the running hash is correctly computed. Specifically, an election verifier must confirm each of the following.
(A) The equation \(H_0=H(\bar{Q})\) is satisfied.
(B) For each ballot
is satisfied.
(C) The closing hash
is correctly computed from the final tracking code \(H_l\)
Once in possession of a tracking code (and never before), a voter is afforded an option to either cast the associated ballot or spoil it and restart the ballot preparation process. The precise mechanism for voters to make these selections may vary depending upon the instantiation, but this choice would ordinarily be made immediately after a voter is presented with the tracking code, and the status of the ballot would be undetermined until the decision is made. It is possible, for instance, for a voter to make the decision directly on the voting device, or a voter may instead be afforded an option to deposit the ballot in a receptacle or to take it to a poll worker to be spoiled. For votebymail scenarios, a voter can be sent (hashes of) two complete sets of encryptions for each selectable option and can effect a ballot challenge implicitly by choosing which encryptions to return.

The initial decryption actually forms the value \(g^\sum_i V_i \bmod p\). However, since \(\sum_i V_i\) is a relatively small value, it can be effectively computed from \(g^\sum_i V_i \bmod p\) by means of an exhaustive search or similar methods. ↩

Benaloh J., Moran. T, Naish L., Ramchen K., and Teague V. ShuffleSum: CoercionResistant Verifiable Tallying for STV Voting (2009) in Transactions of Information Forensics and Security ↩

Chaum D. Untraceable Electronic Mail, Return Addresses, and Digital Pseudonyms (1981) Communications of the ACM ↩

One could simply release the aggregate nonce \(R=\prod_i R_i \bmod q\) to complete this proof. However, since ChaumPedersen proofs are being performed elsewhere, it is simpler for a verifier to just repeat the same steps. ↩