2
$\begingroup$

I believe I do understand basics of how Estonian e-voting system work, but I'm stuck at their vote verification system. In order to get the vote verified, client needs to encrypt all of the possible vote selections plus some random string with election public key and then compare given results with voter's actual vote in order to find a match.

Here is where I got stuck. I've learned that RSA public encryption doesn't always put out same result because of padding, so how is it possible that client produces same result to the one on the server?

I'm a complete beginner regarding cryptography and would therefore appreciate answers given in as basic manner as possible. Since I'm a beginner I'm not really interested in the details how they implemented it but in how could I somehow reproduce this in my very much simplified PHP project using openssl.

Let's say there are 3 candidates: Mike Miller, John Smith and Nick Stone and user chooses John Smith.

$public_key='--- election public key ----';
$vote='John Smith';
openssl_public_encrypt($vote, $encrypted_vote, $public_key);
Lets say $encrypted_vote gets stored in database.

Vote verification:

$actual_encrypted_vote; //users actual vote retrieved from database 
$candidates= array("Mike Miller", "John Smith", "Nick Stone");
$public_key='--- election public key ----';
$selected_candidate="";
foreach($candidates as $candidate){
    openssl_public_encrypt($candidate, $encrypted_vote, $public_key);
    if($encrypted_vote == $actual_encrypted_vote)
        $selected_candidate=$candidate;
}
echo "You voted for: ".$selected_candidate;

This obviously doesn't work, since RSA encryption, because of padding, always produces different result for same key and data. So what should I do to get this work?

Is it possible to set specific padding and use it at both encryptions or is it something else?

$\endgroup$
  • $\begingroup$ I don't know anything about the Estonia e-voting mechanism. But it can't work the way you describe: that allows anyone to find out how each voter voted. Many e-voting systems allow anyone to verify whether a voter voted, and allow the voter to verify that their choice was recorded correctly, but they do preserve voter secrecy. RSA encryption uses random padding precisely to avoid anyone finding out the encrypted message by guessing and matching. $\endgroup$ – Gilles Aug 10 '17 at 12:07
  • $\begingroup$ Please post a link to you source of information. Also see Security Analysis of the Estonian Internet Voting System for more information. $\endgroup$ – zaph Aug 10 '17 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.