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:
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
Ensure that only an encrypted vote leaves the browser.
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.
Last updated