Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use size of Base64-encoded ID to calculate ballot length for decryption #168

Merged
merged 4 commits into from
Jun 25, 2024

Conversation

PascalinDe
Copy link
Member

@PascalinDe PascalinDe commented Jun 21, 2024

To calculate the ballot length to construct the El Gamal pairs for decryption, currently the decoded ID is used. However, since the ID arrives encoded from the frontend, the length of the Base64-encoded needs to be used instead.

Also fixes the related tests that assumed that the ID was stored in Base64-encoded form when it is not (see e.g.

q := form.Configuration.GetQuestion(ID(questionID))
where the corresponding question is retrieved using ID that has been decoded in ln. 71).

Also cleaned up the comments and cleaned up the code around the calculation of the ballot's size to make it more clear.

This resolves #167 .

Some more details:

@PascalinDe PascalinDe self-assigned this Jun 21, 2024
@PascalinDe PascalinDe marked this pull request as draft June 21, 2024 15:30
@PascalinDe PascalinDe changed the title fix: count newline character at the end of the lines WIP Jun 24, 2024
@PascalinDe PascalinDe changed the title WIP fix: use size of Base64-encoded ID to calculate ballot length for decryption Jun 24, 2024
@PascalinDe PascalinDe requested a review from ineiti June 24, 2024 12:43
@PascalinDe PascalinDe marked this pull request as ready for review June 24, 2024 14:00
@PascalinDe PascalinDe merged commit 5b03fe8 into main Jun 25, 2024
11 checks passed
@PascalinDe PascalinDe deleted the 167 branch June 25, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

Wrong calculation of ballot-size truncates choices of voters
2 participants