Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
79addefc
Commit
79addefc
authored
Dec 20, 2011
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
for weak browsers (ahem, ie) that can't even deserialize a long encrypted ballot, don't try.
parent
3cf0775b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
heliosbooth/vote.html
+22
-5
22 additions, 5 deletions
heliosbooth/vote.html
with
22 additions
and
5 deletions
heliosbooth/vote.html
+
22
−
5
View file @
79addefc
...
...
@@ -407,8 +407,8 @@ BOOTH.check_encryption_status = function() {
};
BOOTH
.
_after_ballot_encryption
=
function
()
{
//
removing the chrome weird fix because no more Java
BOOTH
.
encrypted_vote_json
=
JSON
.
stringify
(
BOOTH
.
encrypted_ballot
.
toJSONObject
());
//
if already serialized, use that, otherwise serialize
BOOTH
.
encrypted_vote_json
=
BOOTH
.
encrypted_ballot_serialized
||
JSON
.
stringify
(
BOOTH
.
encrypted_ballot
.
toJSONObject
());
var
do_hash
=
function
()
{
BOOTH
.
encrypted_ballot_hash
=
b64_sha256
(
BOOTH
.
encrypted_vote_json
);
// BOOTH.encrypted_ballot.get_hash();
...
...
@@ -456,7 +456,20 @@ BOOTH.seal_ballot_raw = function() {
BOOTH
.
request_ballot_encryption
=
function
()
{
$
.
post
(
BOOTH
.
election_url
+
"
/encrypt-ballot
"
,
{
'
answers_json
'
:
$
.
toJSON
(
BOOTH
.
ballot
.
answers
)},
function
(
result
)
{
BOOTH
.
encrypted_ballot
=
HELIOS
.
EncryptedVote
.
fromJSONObject
(
$
.
secureEvalJSON
(
result
),
BOOTH
.
election
);
//BOOTH.encrypted_ballot = HELIOS.EncryptedVote.fromJSONObject($.secureEvalJSON(result), BOOTH.election);
// rather than deserialize and reserialize, which is inherently slow on browsers
// that already need to do network requests, just remove the plaintexts
BOOTH
.
encrypted_ballot_with_plaintexts_serialized
=
result
;
var
ballot_json_obj
=
$
.
secureEvalJSON
(
BOOTH
.
encrypted_ballot_with_plaintexts_serialized
);
var
answers
=
ballot_json_obj
.
answers
;
for
(
var
i
=
0
;
i
<
answers
.
length
;
i
++
)
{
delete
answers
[
i
][
'
answer
'
];
delete
answers
[
i
][
'
randomness
'
];
}
BOOTH
.
encrypted_ballot_serialized
=
JSON
.
stringify
(
ballot_json_obj
);
window
.
setTimeout
(
BOOTH
.
_after_ballot_encryption
,
0
);
});
};
...
...
@@ -475,7 +488,7 @@ BOOTH.seal_ballot = function() {
};
BOOTH
.
audit_ballot
=
function
()
{
BOOTH
.
audit_trail
=
$
.
toJSON
(
BOOTH
.
encrypted_ballot
.
get_audit_trail
());
BOOTH
.
audit_trail
=
BOOTH
.
encrypted_ballot_with_plaintexts_serialized
||
$
.
toJSON
(
BOOTH
.
encrypted_ballot
.
get_audit_trail
());
BOOTH
.
show
(
$
(
'
#audit_div
'
)).
processTemplate
({
'
audit_trail
'
:
BOOTH
.
audit_trail
,
'
election_url
'
:
BOOTH
.
election_url
});
};
...
...
@@ -495,8 +508,12 @@ BOOTH.cast_ballot = function() {
BOOTH
.
setup_ballot
(
BOOTH
.
election
);
// clear the plaintext from the encrypted
if
(
BOOTH
.
encrypted_ballot
)
BOOTH
.
encrypted_ballot
.
clearPlaintexts
();
BOOTH
.
encrypted_ballot_serialized
=
null
;
BOOTH
.
encrypted_ballot_with_plaintexts_serialized
=
null
;
// remove audit trail
BOOTH
.
audit_trail
=
null
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment