Comment on page
Browser Side Encryption
Encryption should be implemented at the edge — the voter. We provide a helper function for app developers to encrypt their users' votes within the users' browsers. This function relies on the native Web Crypto API.
To use the helper function, please add the following script tag to the web page that initiates the vote:
<script src="https://private-voting-docs.cryptosat.io/encrypt.js"></script>
Upon receiving a raw vote from the user, use the async function
encryptVote(pubkeyPem, vote)
to encrypt the vote. Here, pubkeyPem
should be the public key corresponding to the ballot for which the vote is intended
If you prefer to use your own implementation, ensure that it employs RSA encryption with OAEP padding and SHA256 hashing. Also, the Cryptosat Voting Contract expects the encrypted payload to be base64 encoded.