pax_global_header 0000666 0000000 0000000 00000000064 13071403144 0014507 g ustar 00root root 0000000 0000000 52 comment=36bd09c123887cdc287ea052b36659bf096cd095
belenios-1.4+dfsg/ 0000775 0000000 0000000 00000000000 13071403144 0014072 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/.gitignore 0000664 0000000 0000000 00000000026 13071403144 0016060 0 ustar 00root root 0000000 0000000 *~
_build
_run
env.sh
belenios-1.4+dfsg/.ocamlinit 0000664 0000000 0000000 00000001057 13071403144 0016055 0 ustar 00root root 0000000 0000000 #use "topfind";;
#require "zarith";;
#require "calendar";;
#require "uuidm";;
#require "atdgen";;
#require "yojson";;
#require "cryptokit";;
#camlp4o;;
#require "lwt.unix";;
#require "lwt.syntax";;
#directory "_build/src/lib";;
#load "lib.cma";;
let pp_print_datetime ppf x =
Format.pp_print_string ppf (Serializable_builtin_j.string_of_datetime x)
;;
let pp_print_uuid ppf x =
Format.pp_print_string ppf (Serializable_builtin_j.string_of_uuid x)
;;
#install_printer Z.pp_print;;
#install_printer pp_print_datetime;;
#install_printer pp_print_uuid;;
belenios-1.4+dfsg/AUTHORS 0000664 0000000 0000000 00000000215 13071403144 0015140 0 ustar 00root root 0000000 0000000 Main developer:
- Stéphane Glondu
Comments, review:
- Pierrick Gaudry
- Véronique Cortier
Logo:
- Alicia Filipiak
CSS:
- Vincent Cheval
belenios-1.4+dfsg/CHANGES.md 0000664 0000000 0000000 00000011044 13071403144 0015464 0 ustar 00root root 0000000 0000000 1.4 (2017-04-05)
================
* Add a debug mode, which has the possibility to use /dev/urandom as
source of entropy
* Check encrypted tally in "belenios-tool verify"
* Add a sample script to send credentials
* Web server:
+ Introduce a limit on the number of mails sent at once. This
effectively limits the number of voters in the general case.
+ Give a link to the future election to the credential authority and
trustees
+ For each mailto template, add a direct link. This makes life easier
for situations where complex mailto links are not supported.
1.3 (2017-02-01)
================
* Add support for blank votes
* More diagnostics in verify-diff
* Web server:
+ Do not log out of CAS
+ Automatically log out after a vote
+ Add Italian translation
1.2 (2016-10-05)
================
* Change the default group parameters to avoid possible
trapdoors. The new ones are generated using FIPS 186-4.
* Web server:
+ The administrator can choose the language(s) of mails sent by the
server
+ The administrator can import trustees from a previous election
+ Question editor: it is now possible to insert and remove
questions and answers anywhere
+ Add Romanian translation
* Command-line tool:
+ Add --url option to election subcommands (in particular verify)
+ Add a "verify-diff" command to belenios-tool
1.1 (2016-07-25)
================
* Web server:
+ Internationalization of voter-facing interfaces
- add French and German translations
+ Add a confirmation page for election finalization
+ Add cookie disclaimer
+ Add templates for mails to trustees
+ Add the Belenios logo and use www.belenios.org in links
+ Add OpenID Connect authentication for administrators
* Command-line tool:
+ Issue a proper warning when a result is missing
+ Support result files where decryption factors are not in the same
order as trustee public keys
1.0 (2016-04-22)
================
* Many changes in the web server:
+ Add election_missing_voters: it is now possible to see the list of
people who did not vote (new link in election administration
page).
+ Hide the login box when it is not relevant: We do no longer show
login links in the top right hand corner of the page. The voter
is automatically invited to log in when he is about to cast a
vote.
+ Do no longer show warning when window.crypto is unavailable (this
warning appeared on IE8).
+ In admin page, show tallied elections in a new section.
+ In admin page, sort (finalized) elections by finalization time.
+ Add a form to regenerate and mail a password.
+ Generating trustee keys is more resilient to momentary lack of
entropy.
+ Change default question to make the blank choice explicit.
+ Print number of accepted ballots on the result page.
+ Add the possibility to specify a login attached to an email
address. E-mail address and logins must be specified in the
following way: foo@example.com,login. When login is not
specified, the address is used as login. This feature is useful
mainly for CAS authentication.
+ Voters (and passwords) can be imported from another (finalized)
election.
+ Send a confirmation email after a successful vote.
+ Add a new notion of "archived" elections.
+ Pretty page for records.
+ An e-mail address can be attached to trustees.
+ Do not propose dummy authentication for new elections.
0.2 (2014-04-09)
================
* Major overhaul of the web server:
+ changes in configuration items
+ cleaner isolation between elections
+ add per-site and per-election administration pages
+ elections imported from the configuration file must be explicitly
listed (no more directory scanning)
+ authentication is more modular
+ changes in CAS authentication method:
- invoke credential requestor with `renew=true`
- do not assume CAS paths start with `/cas/`
+ change in the password authentication method:
- the password file must be uploaded via the web server (no more
reading on-disk file) before the method is used for the first
time
+ automatic logout after successful ballot casting
+ online creation of election
* Remove hardcoded default group
0.1.1 (2014-02-13)
==================
* New subcommands in belenios-tool: "mkelection" and "election vote"
* Add a demo (bash) script to simulate a whole election
* Prettier URLs for election pseudo-files
* Fix compatibility with reverse-proxies
0.1 (2014-01-13)
================
* First public release
belenios-1.4+dfsg/COPYING 0000664 0000000 0000000 00000103330 13071403144 0015125 0 ustar 00root root 0000000 0000000 GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
belenios-1.4+dfsg/INSTALL.md 0000664 0000000 0000000 00000017561 13071403144 0015534 0 ustar 00root root 0000000 0000000 Belenios compilation instructions
=================================
The easy way
------------
Belenios is written in OCaml and has some dependencies towards
third-party OCaml libraries. The easiest and most portable way to
compile Belenios from source is to use
[OPAM](http://opam.ocamlpro.com/), which is a package manager for
OCaml projects.
The non-OCaml prerequisites are:
* a POSIX system with a C compiler
* [GMP](http://gmplib.org/)
* [PCRE](http://www.pcre.org/)
* [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/)
* [m4](https://www.gnu.org/software/m4/)
* [SQLite3](https://www.sqlite.org/)
* [OpenSSL](https://www.openssl.org/)
* [Wget](https://www.gnu.org/software/wget/) or [curl](http://curl.haxx.se/)
* [Unzip](http://www.info-zip.org/UnZip.html)
* [aspcud](http://www.cs.uni-potsdam.de/wv/aspcud/) (optional)
* [ncurses](http://invisible-island.net/ncurses/)
* [uuidgen](https://www.kernel.org/pub/linux/utils/util-linux/)
These libraries and tools are pretty common, and might be directly part
of your operating system. On [Debian](http://www.debian.org/) and its
derivatives, they can be installed with the following command:
apt-get install build-essential libgmp-dev libpcre3-dev pkg-config m4 libssl-dev libsqlite3-dev wget ca-certificates unzip aspcud libncurses-dev uuid-runtime
If you are unfamiliar with OCaml or OPAM, we provide an
`opam-bootstrap.sh` shell script that creates a whole, hopefully
self-contained, OCaml+OPAM install, and then installs all the
dependencies of Belenios, everything into a single directory. You can
choose the directory by setting the `BELENIOS_SYSROOT` environment
variable, or it will take `~/.belenios` by default. Just run:
./opam-bootstrap.sh
On a modern desktop system, this needs approximately 10 minutes and 1
gigabyte of disk space.
If everything goes successfully, follow the given instructions to
update your shell environment, then run:
make all
and you can skip the next two sections and go directly to the
_Documentation_ section.
You can also compile a debug version by using the `BELENIOS_DEBUG`
environment variable:
BELENIOS_DEBUG=1 make all
Note that this version may introduce vulnerabilities and should not be
used in production!
To make sure everything went well, you can run tests:
make check
If you are familiar with OCaml, please read the `opam-bootstrap.sh`
shell script, or the following two sections to compile Belenios with
your existing OCaml installation.
Command-line tool
-----------------
To compile the command-line tool, you will need:
* [OCaml](http://caml.inria.fr/)
* [Findlib](http://projects.camlcity.org/projects/findlib.html)
* [Zarith](https://forge.ocamlcore.org/projects/zarith/)
* [Calendar](http://calendar.forge.ocamlcore.org/)
* [Uuidm](http://erratique.ch/software/uuidm)
* [Cryptokit](https://forge.ocamlcore.org/projects/cryptokit/)
* [Atdgen](http://mjambon.com/atdgen)
* [Yojson](http://mjambon.com/yojson.html)
* [Cmdliner](http://erratique.ch/software/cmdliner)
With OPAM, these dependencies can be installed with the following
command:
opam install atdgen zarith cryptokit uuidm calendar cmdliner
Once all the dependencies have been installed, the command-line tool
can be compiled with:
make
It produces a single executable, `belenios-tool`, in the `_build/`
directory. You can install it in your `PATH` (which we will assume in
the guides), or refer to it with a full path.
Web server
----------
The web server has the following additional dependencies:
* [Eliom](http://ocsigen.org/eliom/)
* [Csv](https://forge.ocamlcore.org/projects/csv/)
With OPAM, you can install them with:
opam install eliom csv
Once all the dependencies have been installed, the Eliom module can be
compiled with:
make all
It will produce a single Eliom module, `server.cma`, in the
`_build/src/web` directory. See `demo/ocsigenserver.conf.in` for an
ocsigenserver configuration template, and the _Server administrator's
guide_ for more information on how to use it.
Documentation
-------------
To generate HTML files from `.md` ones, you will need:
* [Markdown](http://daringfireball.net/projects/markdown/)
Additionnaly, you will need LaTeX to compile the specification.
On Debian-based systems, you can install the dependencies needed to
compile the documentation with:
sudo apt-get install markdown texlive
Once all the dependencies have been installed, the documentation can
be compiled with:
make doc
Compilation using only official Debian packages
-----------------------------------------------
At the time of writing (05 Apr 2016), you need the development version
of Debian (or Ubuntu) to be able to compile Belenios using only
official Debian packages. On Ubuntu, you need to enable the "Universe"
repository. Instead of using OPAM, the dependencies of Belenios can
then be installed with:
sudo apt-get install libatdgen-ocaml-dev libzarith-ocaml-dev libcryptokit-ocaml-dev libuuidm-ocaml-dev libcalendar-ocaml-dev libcmdliner-ocaml-dev
sudo apt-get install ocsigenserver eliom libcsv-ocaml-dev
Compiling on Windows using Cygwin
---------------------------------
Windows is not yet a fully supported platform, but you can compile at
least the command-line tool on Windows + 32-bit
[Cygwin](http://cygwin.com/index.html). You might need the following
packages:
* curl
* dos2unix
* flexdll
* gcc-core
* gcc-g++
* git
* gmp
* libgmp-devel
* libncursesw-devel
* libpcre-devel
* libsqlite3-devel
* m4
* make
* ocaml
* ocaml-base
* ocaml-camlp4
* ocaml-compiler-libs
* openssh
* patch
* pkg-config
* zlib-devel
With these packages installed, you should be able to install OPAM by
following its [installation instructions from
sources](http://opam.ocaml.org/doc/Install.html#FromSources).
Once OPAM is installed, follow the instructions in the _Command-line
tool_ section above.
Troubleshooting
---------------
### OCamlDuce incompatibility
OCamlDuce is an optional transitive dependency of Belenios, but
Belenios does not use it. If OCamlDuce was installed outside of OPAM
(e.g. via your system package manager), you may face issues. You can
work around them by uninstalling OCamlDuce and restarting the
installation procedure.
### Missing sources
The instructions outlined in this document and in the
`opam-bootstrap.sh` script imply downloading files from third-party
servers. Sometimes, these servers can be down. For example, you can
get:
=-=-= Installing ocamlnet.3.7.3 =-=-=
ocamlnet.3.7.3 Downloading http://download.camlcity.org/download/ocamlnet-3.7.3.tar.gz
[ERROR] http://download.camlcity.org/download/ocamlnet-3.7.3.tar.gz is not available
===== ERROR while installing ocamlnet.3.7.3 =====
Could not get the source for ocamlnet.3.7.3.
This can be worked around with the following steps:
* source the generated `env.sh` file (you must adapt it if you use an
incompatible shell such as tcsh);
* download the file from an alternate source (for example
[Debian source packages](http://www.debian.org/distrib/packages));
* run `opam pin ` (in the
example above, `` would be `ocamlnet`);
* resume the installation by running again the `opam install` command
found in `opam-bootstrap.sh`;
* follow the instructions given at the end of `opam-bootstrap.sh`.
### Errors while compiling ocsigenserver
If ocsigenserver fails to install because of a SSL-related error:
* edit `opam-bootstrap.sh` by adding ` ssl=0.5.2` to the `opam
install` call;
* run `./opam-bootstrap.sh`.
An alternative could be to install aspcud before running
`opam-bootstrap.sh`.
### Errors while compiling Belenios itself
If you succeeded installing all dependencies, but you get errors while
compiling Belenios, maybe you installed an incompatible version of a
dependency. The `opam-bootstrap.sh` script is tuned to install only
compatible versions; you can have a look at it to get these versions.
belenios-1.4+dfsg/Makefile 0000664 0000000 0000000 00000001751 13071403144 0015536 0 ustar 00root root 0000000 0000000 minimal:
ocamlbuild minimal.otarget
all:
ocamlbuild all.otarget
check: all
demo/demo.sh
clean:
ocamlbuild -clean
rm -f *~
tree: _build/tree.html
_build/tree.html: _build/_digests
mkdir -p _build
tree -o $@ -H '..' -I '_build|_run|*~'
.PHONY: doc
doc:
ocamlbuild doc.otarget
$(MAKE) doc/specification.pdf
doc/specification.pdf: doc/specification.tex
cd doc && for u in 1 2 3; do pdflatex specification.tex; done
archive:
@if [ `git status --porcelain | grep -v '^?? ' | wc -l ` -eq 0 ]; then \
COMMIT_ID=`git describe --tags`; \
VERSION=`cat VERSION`; \
if [ "$$(printf $$COMMIT_ID | head -c$$(printf $$VERSION | wc -c))" = "$$VERSION" ]; then \
git archive --prefix=belenios-$$COMMIT_ID/ $$COMMIT_ID | gzip -9n > ../belenios-$$COMMIT_ID.tar.gz; \
ln -sf belenios-$$COMMIT_ID.tar.gz ../belenios.tar.gz; \
ls -l ../belenios.tar.gz; \
else \
echo "VERSION is not up-to-date!"; exit 1; \
fi; \
else \
echo "The tree is not clean!"; exit 1; \
fi
belenios-1.4+dfsg/README.md 0000664 0000000 0000000 00000006316 13071403144 0015357 0 ustar 00root root 0000000 0000000 Belenios
========
Introduction
------------
Belenios is a verifiable voting system that partly implements the
Helios-C protocol described [here](http://eprint.iacr.org/2013/177),
which is itself derived from [Helios](http://vote.heliosvoting.org).
It consists of a command-line tool and a web server. Both use the same
backend and can be used to organize elections and perform
verifications. They employ messages formatted in a common format, a
specification of which is available in doc/specification.tex.
Compilation instructions are provided in INSTALL.md.
Election overview
-----------------
An election involves several roles: an administrator, a credential
authority, trustees and voters. For maximum security, each of these
roles must be performed by a different entity. An election can be
summarized as follows:
1. The administrator initiates the process.
2. The credential authority generates one credential per voter; he
sends the private part to each voter and all public parts to
the administrator.
3. Each trustee generates a keypair and sends his/her public key to
the administrator.
4. The administrator collects all public credentials and trustees'
public keys and sets up the election.
5. The administrator opens the election.
6. Each voter votes; the administrator collects, checks and publishes
all the ballots.
7. The administrator closes the election.
8. Trustees collectively decrypt the result.
9. The administrator announces the result of the election.
The command-line tool
---------------------
Each step can be performed with the help of the command-line tool. The
tool is also the most convenient way to exercise the verifiability
capabilities of the system.
More information in doc/tool.md.
The web server
--------------
The whole process can be executed using the web server. Each step can
be done with a browser. In this case, the formal "administrator" role
above is typically shared between the server and a human operator. The
server can also assume the roles of credential authority and
trustee. Therefore, in its simplest (and weakest) form, an election
involves only an operator henceforth called "election administrator"
(usually distinct from the person who sets up and administrates the
server itself) and voters. In its strongest form, an election involves
the election administrator, a credential authority, (at least) two
trustees and voters.
More information in doc/web.md.
Legal
-----
### Internal code
By "internal code", we mean everything that is not in the `ext/`
directory.
Copyright © 2012-2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version, with the additional
exemption that compiling, linking, and/or using OpenSSL is allowed.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
### External code
Please refer to each file for accurate copyright and licensing
information.
belenios-1.4+dfsg/RELEASE_NOTES.md 0000664 0000000 0000000 00000001031 13071403144 0016437 0 ustar 00root root 0000000 0000000 1.1
===
* To upgrade a web server running version 1.0, you need to delete the
Ocsipersist store (by default the `ocsidb` file referred in the
configuration file). This will archive all finalized elections, and
delete all unfinalized elections (i.e. the elections being
prepared). Additionally, you should clean up the data directory (the
one referred in the `` directive in the configuration file)
by removing all temporary files (run `rm *.*` in this directory)
and private keys (`rm */private_key.json`).
belenios-1.4+dfsg/VERSION 0000664 0000000 0000000 00000000004 13071403144 0015134 0 ustar 00root root 0000000 0000000 1.4
belenios-1.4+dfsg/_tags 0000664 0000000 0000000 00000001202 13071403144 0015105 0 ustar 00root root 0000000 0000000 <**/*.{ml,mli,byte,native,odoc}>: debug, annot, package(uuidm), package(atdgen), package(yojson)
: package(zarith), package(calendar), package(cryptokit)
: thread, package(eliom.server), package(lwt.ppx), package(csv)
: package(zarith), package(calendar), package(cryptokit), package(cmdliner), use_platform-native
or or : package(js_of_ocaml), syntax(camlp4o), package(js_of_ocaml.syntax), package(lwt.syntax), use_platform-js
<**/*serializable_j.ml>: warn(-32)
true: warn(A-4-6-29-44-48), safe_string
belenios-1.4+dfsg/all.itarget 0000664 0000000 0000000 00000000432 13071403144 0016222 0 ustar 00root root 0000000 0000000 minimal.otarget
src/lib/lib.cma
src/web/server.cma
src/static/logo.png
src/static/placeholder.png
src/static/belenios-tool.html.otarget
src/static/vote.html.otarget
src/static/tool_js_tkeygen.js
src/static/tool_js_credgen.js
src/static/tool_js_questions.js
src/static/tool_js_pd.js
belenios-1.4+dfsg/api.odocl 0000664 0000000 0000000 00000000057 13071403144 0015667 0 ustar 00root root 0000000 0000000 Serializable_t
Signatures
Group_field
Election
belenios-1.4+dfsg/contrib/ 0000775 0000000 0000000 00000000000 13071403144 0015532 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/contrib/send_credentials.py 0000775 0000000 0000000 00000005065 13071403144 0021423 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
import smtplib
from email.mime.text import MIMEText
from string import Template
import time
import getpass
# In DEGUB mode, emails are sent to this address instead of the true one.
# (typically the address of the credential authority)
DEBUG=False
DEBUG_MAIL='bozo.leclown@example.com'
# Edit the following according to your election:
FROM='bozo.leclown@example.com' # can be the email of the credential authority
SUBJECT='Élection du meilleur cookie: votre matériel de vote'
UUID='7af1a378-ed25-481a-9775-7b1a7e55c746'
# Your outgoing email configuration:
SMTP='smtp.example.com'
username='bozo'
password = getpass.getpass("please type your password: ")
# name of the file where to read the credentials
CODE_FILE='codefile.txt'
# Edit the email template:
TEMPLATE=Template("""
Bonjour,
Nous vous invitons à participer à l'élection du meilleur cookie
à l'adresse suivante:
https://belenios.loria.fr/elections/$UUID/
Vous aurez besoin de vos identifiants LDAP ou de votre login/mot de
passe, mais aussi du code de vote personnel (appelé "credential") que voici :
$ELECTION_CODE
Le scrutin est ouvert du 1 avril à 9h au 2 avril à 18h.
Veillez bien à aller au bout des 6 étapes pour que votre vote soit pris
en compte. Un mail de confirmation vous sera envoyé.
Pour rappel, il y a deux candidats : Maïté et Amandine.
Merci de votre participation
==========================================================
Hello,
You are listed as a voter for the election of the best cookie.
Please visit the following link:
https://belenios.loria.fr/elections/$UUID/
You will need your LDAP or login / password, and also the following
credential (personal code):
$ELECTION_CODE
The election is open from April 1st, 9am to April 2nd, 6pm.
Be sure to go through the 6 steps to ensure that your vote is taken into
account. A confirmation email will be sent.
Reminder: there are two candidates Maïté and Amandine.
Thank you for your participation.
""")
# Real stuf starts here. Pretty short, isn't it?
with open(CODE_FILE) as cf:
d = dict(UUID=UUID)
s = smtplib.SMTP(SMTP)
s.starttls()
s.login(username, password)
for line in cf:
l = line.split()
d['ELECTION_CODE']=l[1]
msg = MIMEText(TEMPLATE.substitute(d))
email=l[0].split(",")[0]
msg['Subject'] = SUBJECT
msg['From'] = FROM
if DEBUG:
msg['To'] = DEBUG_MAIL
else:
msg['To'] = email
s.send_message(msg)
time.sleep(0.2) # short delay; might need more for very large election
s.quit()
belenios-1.4+dfsg/demo/ 0000775 0000000 0000000 00000000000 13071403144 0015016 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/demo/data/ 0000775 0000000 0000000 00000000000 13071403144 0015727 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/ 0000775 0000000 0000000 00000000000 13071403144 0022260 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/election.json 0000664 0000000 0000000 00000004454 13071403144 0024764 0 ustar 00root root 0000000 0000000 {"description":"This is a test election.","name":"Test election","public_key":{"group":{"g":"14887492224963187634282421537186040801304008017743492304481737382571933937568724473847106029915040150784031882206090286938661464458896494215273989547889201144857352611058572236578734319505128042602372864570426550855201448111746579871811249114781674309062693442442368697449970648232621880001709535143047913661432883287150003429802392229361583608686643243349727791976247247948618930423866180410558458272606627111270040091203073580238905303994472202930783207472394578498507764703191288249547659899997131166130259700604433891232298182348403175947450284433411265966789131024573629546048637848902243503970966798589660808533","p":"16328632084933010002384055033805457329601614771185955389739167309086214800406465799038583634953752941675645562182498120750264980492381375579367675648771293800310370964745767014243638518442553823973482995267304044326777047662957480269391322789378384619428596446446984694306187644767462460965622580087564339212631775817895958409016676398975671266179637898557687317076177218843233150695157881061257053019133078545928983562221396313169622475509818442661047018436264806901023966236718367204710755935899013750306107738002364137917426595737403871114187750804346564731250609196846638183903982387884578266136503697493474682071","q":"61329566248342901292543872769978950870633559608669337131139375508370458778917"},"y":"14635082878118572654479921080249944001812293038810422159343238089595479240882299219246906288014009621479772514986719666120580071805977517512709536449580704387040200602501172760388225540685840285411774228955056554894778199335402959258815158862988075365242410449387167116346296481514414882426546780519521778091037414413395238663990507052035474205192620851516755387953867800973935897054822286902740224243498380336367014173394548123266419420289185997583417780349142205089750866593480737143971921887353321220824821931497851896766898090557192411266787781010869883177247094501345068629045693383217704047201748215908551010065"},"questions":[{"answers":["a","b","c","d","e"],"min":0,"max":1,"question":"Question 1?"},{"answers":["a","b","c","d","e","f"],"min":2,"max":3,"question":"Question 2?"},{"answers":["a","b","c"],"min":1,"max":1,"question":"Question 3?"}],"uuid":"6d122f00-2650-4de8-87de-30037a21f943","short_name":"test"}
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/hashed_public_creds.txt 0000664 0000000 0000000 00000001354 13071403144 0026776 0 ustar 00root root 0000000 0000000 10 78fbc40b46a0d8fbd0959bcabbd960d118db07095c0a463ca87fccf059b8715e
11 1c6cc6bd8015c298d23fe6c8e6f0e3c40e80b1c01a51516fcad653a8e44e558b
12 b4be90a3583a4deeb8012b6905df2420a86e7b1d06906a1d9fb9695efaea5ffb
13 fab1383f26d4029d0750cde3ce3c23b926b53117fcec63132a86ca82685abdb1
14 4ad432b511490a52101d9267787a37d1292f6d514bc5475dee90627d4a1a4691
15 9951422ac5b6ee9e27c677092ca078ed50aefe56ee4a01675a2bc2a3e75cb812
16 4dbdc1f056584694f852185f8e5543db6e2a1af3d5535d41e5df766db28d33a5
17 72bef7daf72605177be48c6c33309d5cfc81c409a20173d1714762e719001e4c
18 d812d6a43fe42d464ed0a9d530777834fcccc3a4a6b6fb85026ec3027b70c9f3
19 8aff557fe1e1a924b3c2cf4c15c56a195cd5a31c5650d840d5fb9c31b52b7fbf
20 6279249bf13b16f2f27387513270ac7312e9141f4088d8801a090685e12777bd
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/metadata.json 0000664 0000000 0000000 00000000173 13071403144 0024734 0 ustar 00root root 0000000 0000000 {"owner":{"domain":"demo","name":"admin"},"auth_config":[{"auth_system":"dummy","auth_instance":"demo","auth_config":[]}]}
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/private_creds.txt 0000664 0000000 0000000 00000000321 13071403144 0025647 0 ustar 00root root 0000000 0000000 10 HsqB3C3y62Ekq4D
11 p6daZwYojpKg1Ja
12 qGnAWQdTbw2TVxf
13 Bn8t5PtC9EDC5wd
14 cF4uzN1qRWGkPQW
15 Ak7yGRGcxC5EN9o
16 MbJL9tXDnX2KuA8
17 GDkn18MG1Y8d6AE
18 xZifA2wkZVzANyh
19 NukC6hSSm7AU25N
20 FSCHesimUonmFcX
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/private_keys.jsons 0000664 0000000 0000000 00000000237 13071403144 0026045 0 ustar 00root root 0000000 0000000 "9600046171371266358328616343161466905101638659943090708733129049062697628544"
"53655776381189087226481245629930397938597271135267524399539248211815395676810"
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/public_creds.txt 0000664 0000000 0000000 00000015206 13071403144 0025463 0 ustar 00root root 0000000 0000000 12821148605952984544760889842541783652995936458797805359873185240470923998658741906650004571172973116730280167928180381707306158430093669866569466802522854974307338320319664261287166086053060812214922094495366373891610300137781219875304026158467314207520155759278469663560134035556654418797256292553637317160630332371863419391125494940751655295712149753455314957562093905105374009329418829591150209548637139210636319865210434820182897099554681003882753620340365557282722129604553566811810001408342402194765830196780197107862545710930140361966586030469793371536305101406153820619823355956607130182541702013930841341521
12916210039107128665462871982817523017879074124921228210811731905234984800289629620126369202737920406641613398086092285204754736564479157220216059870418683973912513767227564136990498803655822850300268201745266868832668543635328203949126432435084428569537222093862881965869331957143068779286098078732495796290700680480266285365620904937223330428222246309454647369898608122387876955705105543698897510404309689993259288111314365073719516106026372856771460113434169212700530434270567020417429451005263293929579947893785338211022272023044177081309504149242022600418854645076879742120472365207081560762903739082212605886587
14674864957339153852505913711939706040267825580247016902336000933896030304875356396275561693529722847130790286501672133854563299332702327120144246050113541693308768371219102843300891427941565331808303386652072484814509565983392753138003678245713355639255100357927131221177328159635348568699468841601501535356022622353158198218355574179173130172628103918248763723241863179728392154280944649289690591095983355137971480233514386802388050339823761441824866215512398271797017898979737471538260059022177549235405761100861908921968361718176091279726090483444169137877349168121897279033787677304057001785684121694666659973512
2221355242458157707021840469698299737474912907235158809140700540189330012054803534654837102221100003391420953420194694622728848790567038956551258836171783356235032810099670637844909974615303163216025500854811145569649589253199249753873501217588248019680775470134459649733815263990838262049871552913886868001068216855220751643985244743798925161009381402114076683483862306729750535020230928029950208895359407217113230269665172177802110253776595800192383509890507741306791260213028328559318123573915067694364162370445115210040265678263995848373685144907553394523781082701945812585323541699238238449921061906081888525763
2932347112123979279950158982087198655433552938220417023380816267001934863819001007522790840469001768338025593319860644274272934631553789389056335674963598499889998920105398023042976449861390044991657481091662252664879480013971382087274329403561227622710676167819191513822010616561252801626013782927724383598028779790744500263232235960132419349064564935665563669840911346281236341963502883075149974702725735940286404803437417732023855435189144636492636288930231509229739340519636939181143187014927614313426013372473754155278928702652041557595686818577286801988065078853241828523560039837183564574609976172394350521138
4082932203753073754417844744117522411410290571464179286216056344656379974026921764651697120445244508572518004752905214981083405160527317987755675986659150943921870595831562213246465535543260427796984086516821441251300260388937417209905897285783649400566143816526377845002598929064896248512185493968741088788162694313299162906987477790390468125177494182529895266055568002708726318562845117127339432819472348438035138662351316018714511802574486139515987912515041829772197663776556539922441546337076526308591086313023035422070423613203169890852348954379649345243166612059044085704467200109401839505943752955885814326960
4357979345745019164137298295975820492006083194777597416940569360943624562812954088842405641207440165847815793265076745909348480568868633142340117232015720969603952747454628450925308755707551651046973859378834688613892180600924054507402367183807224356075212054800172994767900918553185772386827644002323955269011205926376149862988597178570326479642870843651137052133527962324049264429589390074620528189480679565796463310750956854050733523862411350841598623724893620868094354005140670696278533709278257726275577882202492627050001012222673085378794203636223895600069014246074545395174576890404850883802055157198529345202
5741008643571559481915100969776655993651502567740380069796921724693341298664237324988659681470550570276411944723678396976290132132011658285900979749779365244156795722582435307537106638312184967179637297484368915527703141318458194842750727266867121531776186782006845518120335912981045971698432210797372311438796929301619249586252984271439761809612761084460288644117495694862197967144326335232466773968059435098764334529903518788712623545999858433274075755874300622992770251766083588508815874746204923476442364091278122920430098864103224159314576915898203242403026732539012267713803573680076954870797446479736890576730
7501865618256637074408041134128157679617467968206426848463227439745391551821960264456613700629297709181227781916325929022537053109093814905176606403988549708366825032253903031858355294215808193663694310463361937606946654468823047420217362044504416130330519457671413345697887345996861518765584342208928067361698673608413671971809159752271479860165852314100855050800484634454653619715040102457635504331240973958150154916175216859036650810019453462035198930647815263151850295651483990038310226388626811212627805282446164410158337154965878861614113143876772737552114558727420280422537877212083692913726159486491362561436
9469333065238600523561998838217015564584879582017726086519390367999547696516572568174845463450385161920162807372115893045192364950476425579694432007806129673715117816866647253508596438862970680902015493326939047590087214113823321897008000701860082715983132974077957685982126511257631708173978813176607909609955183512341952743032914943209779703475829476805601448900960658761483625396788665300441537467920004044596053104424665268627131497699738580567565334260414360462562013584919491403125339432052448867851854762934078160818129933591083109181505571731287550392154625364765907604124588454078140865209343171920759318759
9913418346634216632818377836292472538914380697506100471418516491471021631483277833968210636650323719537724627791467049533922407911645409779670497849777911543320304294457396501546734295357184648171227241306807211089266481287460057841005042519111569259185125973842871923974704043080198008794227796751850975230191930970912077450640645426907622282708744105967835507535146071395383632299850723306813477725951201628369206166107400574930183333401444126783384104588120551368056442896471383087680510781270106112787311210923217374404237916485781875145691988847907863214914963561283710204486155012684658508992353877375741020693
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/public_keys.jsons 0000664 0000000 0000000 00000003162 13071403144 0025651 0 ustar 00root root 0000000 0000000 {"pok":{"challenge":"49253835875688215480303040712975641939449998725720650273890574275119699892199","response":"35960270992659874796390333476558071240144894347474659693404398510944635277001"},"public_key":"4130309479050310785588803003799175864250543971804189793968919324200477734697810059763631539438036073038178926714422709506063553893435956871413894188503965023132707149869964218525713102804650128526336351566034852371736441155704862791610920288413996488876905272045597984516135393344109876056562216520594230353546877387569956101851195763843192089450155590369315352762650709712686551945735518323900111749060580699773743676201562383303645381103627778440460854101752273860535798354116608436622497825222346944292638416506142723226423289655984068152092273348967894185615781393847933926595940678779516218466876036558072035268"}
{"pok":{"challenge":"41565449212291247652921537420346114660658332454116526238513560067875507128079","response":"14440376305059194868705326348923866406701380798837611269349528384987551722927"},"public_key":"5215560899172444407130424319213683694051000716257457119130381566360174029617501243974443328385840893843828396429566437986143187766540097743809858735292442828221080192297727742120718566721438190244611216917472468446934752906450013257316406265121307296224119775915481819794715887505265725215570958192145278933724483926678341611259431220856601820908061113574158011315602495397285249047526691738424611247906328472423148071255520485683052002968460988700719115849891775375265752593433544571311921664618697422430109727500355400015726425499435588069406310231185025013708018711724117187751385851843858607124369613952623078809"}
belenios-1.4+dfsg/demo/data/6d122f00-2650-4de8-87de-30037a21f943/voters.txt 0000664 0000000 0000000 00000000321 13071403144 0024337 0 ustar 00root root 0000000 0000000 user10@example.com
user11@example.com
user12@example.com
user13@example.com
user14@example.com
user15@example.com
user16@example.com
user17@example.com
user18@example.com
user19@example.com
user20@example.com
belenios-1.4+dfsg/demo/data/index.json 0000664 0000000 0000000 00000000103 13071403144 0017723 0 ustar 00root root 0000000 0000000 [{"dir":"6d122f00-2650-4de8-87de-30037a21f943","featured":"true"}]
belenios-1.4+dfsg/demo/demo.sh 0000775 0000000 0000000 00000004022 13071403144 0016277 0 ustar 00root root 0000000 0000000 #!/bin/bash
set -e
export BELENIOS_USE_URANDOM=1
BELENIOS=${BELENIOS:-$PWD}
belenios-tool () {
$BELENIOS/_build/belenios-tool "$@"
}
header () {
echo
echo "=-=-= $1 =-=-="
echo
}
header "Setup election"
UUID=`uuidgen`
echo "UUID of the election is $UUID"
DIR=$BELENIOS/demo/data/$UUID
mkdir $DIR
cd $DIR
# Common options
uuid="--uuid $UUID"
group="--group $BELENIOS/demo/groups/default.json"
# Generate credentials
belenios-tool credgen $uuid $group --count 5
mv *.pubcreds public_creds.txt
mv *.privcreds private_creds.txt
# Generate trustee keys
belenios-tool trustee-keygen $group
belenios-tool trustee-keygen $group
belenios-tool trustee-keygen $group
cat *.pubkey > public_keys.jsons
# Generate election parameters
belenios-tool mkelection $uuid $group --template $BELENIOS/demo/templates/questions.json
header "Simulate votes"
cat > votes.txt <&2
echo >&2
done > ballots.tmp
mv ballots.tmp ballots.jsons
header "Perform verification"
belenios-tool verify
header "Simulate and verify update"
tdir="$(mktemp -d)"
cp election.json public_creds.txt public_keys.jsons "$tdir"
head -n3 ballots.jsons > "$tdir/ballots.jsons"
belenios-tool verify-diff --dir1="$tdir" --dir2=.
rm -rf "$tdir"
header "Perform decryption"
for u in *.privkey; do
belenios-tool decrypt --privkey $u
echo >&2
done > partial_decryptions.tmp
mv partial_decryptions.tmp partial_decryptions.jsons
header "Finalize tally"
belenios-tool finalize
header "Perform final verification"
belenios-tool verify
echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo
echo "The simulated election was successful! Its result can be seen in"
echo " $DIR/result.json"
echo
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo
belenios-1.4+dfsg/demo/groups/ 0000775 0000000 0000000 00000000000 13071403144 0016335 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/demo/groups/default.json 0000664 0000000 0000000 00000002465 13071403144 0020663 0 ustar 00root root 0000000 0000000 {"g":"2402352677501852209227687703532399932712287657378364916510075318787663274146353219320285676155269678799694668298749389095083896573425601900601068477164491735474137283104610458681314511781646755400527402889846139864532661215055797097162016168270312886432456663834863635782106154918419982534315189740658186868651151358576410138882215396016043228843603930989333662772848406593138406010231675095763777982665103606822406635076697764025346253773085133173495194248967754052573659049492477631475991575198775177711481490920456600205478127054728238140972518639858334115700568353695553423781475582491896050296680037745308460627","p":"20694785691422546401013643657505008064922989295751104097100884787057374219242717401922237254497684338129066633138078958404960054389636289796393038773905722803605973749427671376777618898589872735865049081167099310535867780980030790491654063777173764198678527273474476341835600035698305193144284561701911000786737307333564123971732897913240474578834468260652327974647951137672658693582180046317922073668860052627186363386088796882120769432366149491002923444346373222145884100586421050242120365433561201320481118852408731077014151666200162313177169372189248078507711827842317498073276598828825169183103125680162072880719","q":"78571733251071885079927659812671450121821421258408794611510081919805623223441"}
belenios-1.4+dfsg/demo/groups/rfc3526-2048.json 0000664 0000000 0000000 00000002352 13071403144 0020717 0 ustar 00root root 0000000 0000000 {"g":"2","p":"32317006071311007300338913926423828248817941241140239112842009751400741706634354222619689417363569347117901737909704191754605873209195028853758986185622153212175412514901774520270235796078236248884246189477587641105928646099411723245426622522193230540919037680524235519125679715870117001058055877651038861847280257976054903569732561526167081339361799541336476559160368317896729073178384589680639671900977202194168647225871031411336429319536193471636533209717077448227988588565369208645296636077250268955505928362751121174096972998068410554359584866583291642136218231078990999448652468262416972035911852507045361090559","q":"16158503035655503650169456963211914124408970620570119556421004875700370853317177111309844708681784673558950868954852095877302936604597514426879493092811076606087706257450887260135117898039118124442123094738793820552964323049705861622713311261096615270459518840262117759562839857935058500529027938825519430923640128988027451784866280763083540669680899770668238279580184158948364536589192294840319835950488601097084323612935515705668214659768096735818266604858538724113994294282684604322648318038625134477752964181375560587048486499034205277179792433291645821068109115539495499724326234131208486017955926253522680545279"}
belenios-1.4+dfsg/demo/groups/weak.json 0000664 0000000 0000000 00000000036 13071403144 0020156 0 ustar 00root root 0000000 0000000 {"g":"2","p":"263","q":"131"}
belenios-1.4+dfsg/demo/ocsigenserver.conf.in 0000664 0000000 0000000 00000003132 13071403144 0021147 0 ustar 00root root 0000000 0000000
8001
_RUNDIR_/log
_RUNDIR_/lib
_RUNDIR_/upload
128kB
_TMPDIR_/run/ocsigenserver_command
utf-8
belenios-1.4+dfsg/demo/password_db.csv 0000664 0000000 0000000 00000000675 13071403144 0020052 0 ustar 00root root 0000000 0000000 user1,oofeibae,ea66a656b159beaec4a10e6a2b18abf0ff348d1bd74dcb9019bc763b2df67c27,phiexoey
user2,laigezae,5a4230902e6dfb96e5b0ebe71b1ce88e9b37f8802dc075d046e62985e14909d2,eiseesho
user3,ivoorool,41c0f0c2e4b7db2d3d0e7e586bd8c31342eefec60d695a55395879dd6ff0357b,heethiax
user4,ceedohgh,c235819606ff698aa44cde97fc94ec8b91aeea8b0b68c137238dedae4c33ab01,liuyeige
user5,yeorogai,7727130f59b76646d4c3d6a9f3b6f4bede8a85210cb54bda913737c3e376168b,feoridee
belenios-1.4+dfsg/demo/run-server.sh 0000775 0000000 0000000 00000001305 13071403144 0017464 0 ustar 00root root 0000000 0000000 #!/bin/sh
if [ ! -d _build ]; then
echo "This script should be run from the root of the (built) source tree!"
exit 1
fi
BELENIOS_RUNDIR=${BELENIOS_RUNDIR:-_run}
BELENIOS_TMPDIR=${BELENIOS_TMPDIR:-/tmp/belenios}
OCAML_STDLIBDIR=$(ocamlc -where)
mkdir -p \
$BELENIOS_RUNDIR/etc \
$BELENIOS_RUNDIR/log \
$BELENIOS_RUNDIR/lib \
$BELENIOS_RUNDIR/upload \
$BELENIOS_RUNDIR/spool \
$BELENIOS_TMPDIR/run
sed \
-e "s@_OCAML_STDLIBDIR_@$OCAML_STDLIBDIR@g" \
-e "s@_TMPDIR_@$BELENIOS_TMPDIR@g" \
-e "s@_RUNDIR_@$BELENIOS_RUNDIR@g" \
-e "s@_SRCDIR_@$PWD@g" \
demo/ocsigenserver.conf.in > $BELENIOS_RUNDIR/etc/ocsigenserver.conf
ocsigenserver -c $BELENIOS_RUNDIR/etc/ocsigenserver.conf "$@"
belenios-1.4+dfsg/demo/templates/ 0000775 0000000 0000000 00000000000 13071403144 0017014 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/demo/templates/questions.json 0000664 0000000 0000000 00000000402 13071403144 0021735 0 ustar 00root root 0000000 0000000 {"description":"Description of the election.","name":"Name of the election","questions":[{"answers":["Answer 1","Answer 2"],"min":0,"max":1,"question":"Question 1?"},{"answers":["Answer 1","Answer 2"],"blank":true,"min":1,"max":1,"question":"Question 2?"}]}
belenios-1.4+dfsg/doc.itarget 0000664 0000000 0000000 00000000074 13071403144 0016221 0 ustar 00root root 0000000 0000000 api.docdir/index.html
README.html
INSTALL.html
CHANGES.html
belenios-1.4+dfsg/doc/ 0000775 0000000 0000000 00000000000 13071403144 0014637 5 ustar 00root root 0000000 0000000 belenios-1.4+dfsg/doc/.gitignore 0000664 0000000 0000000 00000000036 13071403144 0016626 0 ustar 00root root 0000000 0000000 *.aux
*.log
*.out
*.toc
*.pdf
belenios-1.4+dfsg/doc/fips.sage 0000664 0000000 0000000 00000003655 13071403144 0016452 0 ustar 00root root 0000000 0000000 import hashlib
######################################################################
### Generate p and q according to FIPS 186-4, section A.1.1.2
L = 2048
N = 256
seedlen = 358 # not used
outlen = 256
seed = "Belenios: Verifiable online voting system "
def stringToInt(string):
seq = [ ord(x) for x in string]
res = ZZ(seq, 256)
return res
def intToString(number):
seq = number.digits(base=256)
seq = [ chr(x) for x in seq ]
return reduce(lambda a, b: a + b, seq)
# hash integer to an integer with SHA256
def Hash(number):
string = intToString(number)
return int(hashlib.sha256(string).hexdigest(), 16)
assert seedlen >= N
n = (L/outlen).n().ceiling() - 1
b = L-1-(n*outlen)
count = 0
found = False
while True:
domain_parameter_seed = stringToInt(seed + str(count))
U = Hash(domain_parameter_seed) % 2^(N-1)
q = 2^(N-1) + U + 1 - (U % 2)
count += 1
if q.is_prime():
break
offset = 1
counter = 0
while counter < 4*L:
V = [ Hash(domain_parameter_seed + offset + j) for j in range(0,n+1) ]
W = V[0]
for j in range(1, n):
W += V[j]*2^(outlen*j)
W += (V[n] % 2^b)*2^(n*outlen)
X = W + 2^(L-1)
c = X % (2*q)
p = X - (c-1)
if p > 2^(L-1) and p.is_pseudoprime():
found = True
break
offset = offset + n + 1
counter += 1
if found:
print "p = " + str(p)
print "q = " + str(q)
print "domain_parameter_seed = " + str(domain_parameter_seed)
print "counter = " + str(counter)
else:
print "Not found"
######################################################################
### Generate g according to section A.2.3
index = 0
N = q.nbits()
e = (p-1)//q
count = 1
U = count + 2^16*(index + 2^16*(0x6767656E + 2^32*domain_parameter_seed))
W = Hash(U)
g = int(GF(p, proof=False)(W)^e)
assert g >= 2
print "g = " + str(g)
print "Checking primality of p (not only pseudo-primality), this will take some time..."
assert p.is_prime()
belenios-1.4+dfsg/doc/specification.tex 0000664 0000000 0000000 00000064601 13071403144 0020210 0 ustar 00root root 0000000 0000000 \documentclass[a4paper]{article}
\usepackage{a4wide}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{bbm}
\usepackage{hyperref}
\newcommand{\version}{0.2}
\newcommand{\F}{\mathbbm{F}}
\newcommand{\G}{\mathbbm{G}}
\newcommand{\Z}{\mathbbm{Z}}
\newcommand{\N}{\mathbbm{N}}
\newcommand{\I}{\mathbbm{I}}
\newcommand{\B}{\mathbbm{B}}
\newcommand{\public}{\textsf{public}}
\newcommand{\shuffle}{\textsf{shuffle}}
\newcommand{\basesixfour}{\textsf{BASE64}}
\newcommand{\shatwo}{\textsf{SHA256}}
\newcommand{\jstring}{\texttt{string}}
\newcommand{\uuid}{\texttt{uuid}}
\newcommand{\tpk}{\texttt{trustee\_public\_key}}
\newcommand{\election}{\texttt{election}}
\newcommand{\ballot}{\texttt{ballot}}
\newcommand{\etally}{\texttt{encrypted\_tally}}
\newcommand{\pdecryption}{\texttt{partial\_decryption}}
\newcommand{\result}{\texttt{result}}
\title{Belenios specification}
\date{Version~\version}
\author{Stéphane Glondu}
\begin{document}
\maketitle
\tableofcontents
\section{Introduction}
This document is a specification of the voting protocol implemented in
Belenios v\version. More discussion, theoretical explanations and
bibliographical references can be found in a technical report
available online.\footnote{\url{http://eprint.iacr.org/2013/177}}
The Belenios protocol is very similar to Helios (with a signature
added to ballots and different zero-knowledge proofs) and Helios-C
(with the distributed key generation of trustees of Helios, without
threshold support).
The cryptography involved in Belenios needs a cyclic group $\G$ where
discrete logarithms are hard to compute. We will denote by $g$ a
generator and $q$ its order. We use a multiplicative notation for the
group operation. For practical purposes, we use a multiplicative
subgroup of $\F^*_p$ (hence, all exponentiations are implicitly done
modulo $p$). We suppose the group parameters are agreed on
beforehand. Default group parameters are given as examples in
section~\ref{default-group}.
\section{Parties}
\begin{itemize}
\item $S$: voting server
\item $A$: server administrator
\item $C$: credential authority
\item $T_1,\dots,T_m$: trustees
\item $V_1,\dots,V_n$: voters
\end{itemize}
\section{Processes}
\label{processes}
\subsection{Election setup}
\label{election-setup}
\begin{enumerate}
\item $A$ generates a fresh \hyperref[basic-types]{$\uuid$} $u$ and
sends it to $C$
\item $C$ generates \hyperref[credentials]{credentials}
$c_1,\dots,c_n$ and computes
$L=\shuffle(\public(c_1),\dots,\public(c_n))$
\item for $j\in[1\dots n]$, $C$ sends $c_j$ to $V_j$
\item $C$ forgets $c_1,\dots,c_n$
\item $C$ forgets the mapping between $j$ and $\public(c_j)$
if credential recovery is not needed
\item $C$ sends $L$ to $A$
\item for $z\in[1\dots m]$,
\begin{enumerate}
\item $T_z$ generates a \hyperref[trustee-keys]{$\tpk$} $k_z$ and
sends it to $A$
\item $A$ checks $k_z$
\end{enumerate}
\item $A$ combines all the trustee public keys into the election
public key $y$
\item $A$ creates the \hyperref[elections]{$\election$} $E$
\item $A$ loads $E$ and $L$ into $S$ and starts it
\end{enumerate}
\subsection{Vote}
\begin{enumerate}
\item $V$ gets $E$
\item $V$ creates a \hyperref[ballots]{$\ballot$} $b$ and submits it to $S$
\item $S$ validates $b$ and publishes it
\end{enumerate}
\subsection{Credential recovery}
\begin{enumerate}
\item $V$ contacts $C$
\item $C$ looks up $V$'s public credential $\public(c_i)$ and
generates a new credential $c'_i$
\item $C$ sends $c'_i$ to $V$ and forgets it
\item $C$ sends $\public(c_i)$ and $\public(c'_i)$ to $A$
\item $A$ checks that $\public(c_i)$ has not been used and replaces it
by $\public(c'_i)$ in $L$
\end{enumerate}
\subsection{Tally}
\begin{enumerate}
\item $A$ stops $S$ and computes the \hyperref[tally]{$\etally$} $\Pi$
\item for $z\in[1\dots m]$,
\begin{enumerate}
\item $A$ sends $\Pi$ to $T_z$
\item $T_z$ generates a \hyperref[tally]{$\pdecryption$} $\delta_z$
and sends it to $A$
\item $A$ verifies $\delta_z$
\end{enumerate}
\item $A$ combines all the partial decryptions, computes and publishes
the election \hyperref[election-result]{\result}
\end{enumerate}
\section{Messages}
\label{messages}
\subsection{Conventions}
Structured data is encoded in JSON (RFC 4627). There is no specific
requirement on the formatting and order of fields, but care must be
taken when hashes are computed. We use the notation
$\textsf{field}(o)$ to access the field \textsf{field} of $o$.
\subsection{Basic types}
\label{basic-types}
\begin{itemize}
\item $\jstring$: JSON string
\item $\uuid$: UUID (see RFC 4122), encoded as a JSON string
\item $\I$: small integer, encoded as a JSON number
\item $\B$: boolean, encoded as a JSON boolean
\item $\N$, $\Z_q$, $\G$: big integer, written in base 10 and encoded as a
JSON string
\end{itemize}
\subsection{Common structures}
\label{common}
\newcommand{\pk}{\texttt{public\_key}}
\newcommand{\sk}{\texttt{private\_key}}
\newcommand{\proof}{\texttt{proof}}
\newcommand{\iproof}{\texttt{iproof}}
\newcommand{\ciphertext}{\texttt{ciphertext}}
\newcommand{\pklabel}{\textsf{public\_key}}
\newcommand{\pok}{\textsf{pok}}
\newcommand{\challenge}{\textsf{challenge}}
\newcommand{\response}{\textsf{response}}
\newcommand{\alphalabel}{\textsf{alpha}}
\newcommand{\betalabel}{\textsf{beta}}
\newcommand{\Hash}{\mathcal{H}}
\begin{gather*}
\proof=\left\{
\begin{array}{rcl}
\challenge&:&\Z_q\\
\response&:&\Z_q
\end{array}
\right\}
\qquad
\ciphertext=\left\{
\begin{array}{rcl}
\alphalabel&:&\G\\
\betalabel&:&\G
\end{array}
\right\}
\end{gather*}
\subsection{Trustee keys}
\label{trustee-keys}
\begin{gather*}
\pk=\G\qquad\sk=\Z_q\\
\tpk=\left\{
\begin{array}{rcl}
\pok&:&\proof\\
\pklabel&:&\pk
\end{array}
\right\}
\end{gather*}
A private key is a random number $x$ modulo $q$. The corresponding
$\pklabel$ is $X=g^x$. A $\tpk$ is a bundle of this public key with a
\hyperref[common]{$\proof$} of knowledge computed as follows:
\begin{enumerate}
\item pick a random $w\in\Z_q$
\item compute $A=g^w$
\item $\challenge=\Hash_\pok(X,A)\mod q$
\item $\response=w+x\times\challenge\mod q$
\end{enumerate}
where $\Hash_\pok$ is computed as follows:
\[\Hash_\pok(X,A) = \shatwo(\verb=pok|=X\verb=|=A) \]
where $\pok$ and the vertical bars are verbatim and numbers are
written in base 10. The result is interpreted as a 256-bit big-endian
number. The proof is verified as follows:
\begin{enumerate}
\item compute $A={g^\response}/{y^\challenge}$
\item check that $\challenge=\Hash_\pok(\pklabel,A)\mod q$
\end{enumerate}
\subsection{Credentials}
\label{credentials}
\newcommand{\secret}{\texttt{secret}}
A secret \emph{credential} $c$ is a 15-character string, where characters are
taken from the set:
\[\texttt{123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz}\]
The first 14 characters are random, and the last one is a checksum to
detect typing errors. To compute the checksum, each character is
interpreted as a base 58 digit: $\texttt{1}$ is $0$, $\texttt{2}$ is
$1$, \dots, $\texttt{z}$ is $57$. The first 14 characters are
interpreted as a big-endian number $c_1$ The checksum is $53-c_1\mod
53$.
From this string, a secret exponent $s=\secret(c)$ is derived by using
PBKDF2 (RFC 2898) with:
\begin{itemize}
\item $c$ as password;
\item HMAC-SHA256 (RFC 2104, FIPS PUB 180-2) as pseudorandom function;
\item the $\uuid$ (interpreted as a 16-byte array) of the election as
salt;
\item $1000$ iterations
\end{itemize}
and an output size of 1 block, which is interpreted as a big-endian
256-bit number and then reduced modulo $q$ to form $s$. From this
secret exponent, a public key $\public(c)=g^s$ is computed.
\subsection{Election}
\label{elections}
\newcommand{\question}{\texttt{question}}
\begin{gather*}
\texttt{wrapped\_pk}=\left\{
\begin{array}{rcl}
\textsf{g}&:&\G\\
\textsf{p}&:&\N\\
\textsf{q}&:&\N\\
\textsf{y}&:&\G
\end{array}
\right\}
\end{gather*}
The election public key, which is denoted by $y$ thoughout this
document, is computed by multiplying all the public keys of the
trustees, and bundled with the group parameters in a
\texttt{wrapped\_pk} structure.
\newcommand{\blank}{\textsf{blank}}
\newcommand{\minlabel}{\textsf{min}}
\newcommand{\maxlabel}{\textsf{max}}
\newcommand{\answers}{\textsf{answers}}
\begin{gather*}
\question=\left\{
\begin{array}{rcl}
\answers&:&\jstring^\ast\\
?\blank&:&\B\\
\minlabel&:&\I\\
\maxlabel&:&\I\\
\textsf{question}&:&\jstring
\end{array}
\right\}
\qquad
\election=\left\{
\begin{array}{rcl}
\textsf{description}&:&\jstring\\
\textsf{name}&:&\jstring\\
\textsf{public\_key}&:&\texttt{wrapped\_pk}\\
\textsf{questions}&:&\texttt{question}^\ast\\
\textsf{uuid}&:&\texttt{uuid}
\end{array}
\right\}
\end{gather*}
The $\blank$ field of $\question$ is optional. When present and true,
the voter can vote blank for this question. In a blank vote, all
answers are set to $0$ regardless of the values of $\minlabel$ and
$\maxlabel$ ($\minlabel$ doesn't need to be $0$).
\newcommand{\answer}{\texttt{answer}}
\newcommand{\signature}{\texttt{signature}}
\newcommand{\iproofs}{\textsf{individual\_proofs}}
\newcommand{\oproof}{\textsf{overall\_proof}}
\newcommand{\bproof}{\textsf{blank\_proof}}
\newcommand{\choices}{\textsf{choices}}
\newcommand{\iprove}{\textsf{iprove}}
During an election, the following data needs to be public in order to
verify the setup phase and to validate ballots:
\begin{itemize}
\item the $\election$ structure described above;
\item all the $\tpk$s that were generated during the
\hyperref[election-setup]{setup phase};
\item the set $L$ of public credentials.
\end{itemize}
\subsection{Encrypted answers}
\label{answers}
\begin{gather*}
\answer=\left\{
\begin{array}{rcl}
\choices&:&\ciphertext^\ast\\
\iproofs&:&\iproof^\ast\\
\oproof&:&\iproof\\
?\bproof&:&\proof^2
\end{array}
\right\}
\end{gather*}
An answer to a \hyperref[elections]{$\question$} is the vector
$\choices$ of encrypted weights given to each answer. When $\blank$ is
false (or absent), a blank vote is not allowed and this vector has the
same length as $\answers$; otherwise, a blank vote is allowed and this
vector has an additionnal leading weight corresponding to whether the
vote is blank or not. Each weight comes with a proof (in \iproofs,
same length as \choices) that it is $0$ or $1$. The whole answer also
comes with additional proofs that weights respect constraints.
More concretely, each weight $m\in[0\dots1]$ is encrypted into a
$\ciphertext$ as follows:
\begin{enumerate}
\item pick a random $r\in\Z_q$
\item $\alphalabel=g^r$
\item $\betalabel=y^rg^m$
\end{enumerate}
where $y$ is the election public key.
To compute the proofs, the voter needs a
\hyperref[credentials]{credential} $c$. Let $s=\secret(c)$, and
$S=g^s$ written in base 10. The individual proof that $m\in[0\dots1]$
is computed by running $\iprove(S,r,m,0,1)$ (see
section~\ref{iproof}).
When a blank vote is not allowed, $\oproof$ proves that
$M\in[\minlabel\dots\maxlabel]$ and is computed by running
$\iprove(S,R,M-\minlabel,\minlabel,\dots,\maxlabel)$ where $R$ is the
sum of the $r$ used in ciphertexts, and $M$ the sum of the $m$. There
is no $\bproof$.
When a blank vote is allowed, and there are $n$ choices, the answer is
modeled as a vector $(m_0,m_1,\dotsc,m_n)$, when $m_0$ is whether this
is a blank vote or not, and $m_i$ (for $i>0$) is whether choice $i$
has been selected. Each $m_i$ is encrypted and proven equal to $0$ or
$1$ as above. Let $m_\Sigma=m_1+\dotsb+m_n$. The additionnal proofs
are as follows:
\begin{itemize}
\item $\bproof$ proves that $m_0=0\lor m_\Sigma=0$;
\item $\oproof$ proves that $m_0=1\lor m_\Sigma\in[\minlabel\dots\maxlabel]$.
\end{itemize}
They are computed as described in section~\ref{bproof}.
\subsection{Proofs of interval membership}
\label{iproof}
\begin{gather*}
\iproof=\proof^\ast
\end{gather*}
Given a pair $(\alpha,\beta)$ of group elements, one can prove that it
has the form $(g^r,y^rg^{M_i})$ with $M_i\in[M_0,\dots,M_k]$ by
creating a sequence of $\proof$s $\pi_0,\dots,\pi_k$ with the
following procedure, parameterised by a group element $S$:
\begin{enumerate}
\item for $j\neq i$:
\begin{enumerate}
\item create $\pi_j$ with a random $\challenge$ and a random
$\response$
\item compute
\[A_j=\frac{g^\response}{\alpha^\challenge}\quad\text{and}\quad
B_j=\frac{y^\response}{(\beta/g^{M_j})^\challenge}\]
\end{enumerate}
\item $\pi_i$ is created as follows:
\begin{enumerate}
\item pick a random $w\in\Z_q$
\item compute $A_i=g^w$ and $B_i=y^w$
\item $\challenge(\pi_i)=\Hash_\iprove(S,\alpha,\beta,A_0,B_0,\dots,A_k,B_k)-\sum_{j\neq
i}\challenge(\pi_j)\mod q$
\item $\response(\pi_i)=w+r\times\challenge(\pi_i)\mod q$
\end{enumerate}
\end{enumerate}
In the above, $\Hash_\iprove$ is computed as follows:
\[\Hash_\iprove(S,\alpha,\beta,A_0,B_0,\dots,A_k,B_k)=\shatwo(\verb=prove|=S\verb=|=\alpha\verb=,=\beta\verb=|=A_0\verb=,=B_0\verb=,=\dots\verb=,=A_k\verb=,=B_k)\mod q\]
where \verb=prove=, the vertical bars and the commas are verbatim and
numbers are written in base 10. The result is interpreted as a 256-bit
big-endian number. We will denote the whole procedure by
$\iprove(S,r,i,M_0,\dots,M_k)$.
The proof is verified as follows:
\begin{enumerate}
\item for $j\in[0\dots k]$, compute
\[A_j=\frac{g^{\response(\pi_j)}}{\alpha^{\challenge(\pi_j)}}\quad\text{and}\quad
B_j=\frac{y^{\response(\pi_j)}}{(\beta/g^{M_j})^{\challenge(\pi_j)}}\]
\item check that
\[\Hash_\iprove(S,\alpha,\beta,A_0,B_0,\dots,A_k,B_k)=\sum_{j\in[0\dots
k]}\challenge(\pi_j)\mod q\]
\end{enumerate}
\subsection{Proofs of possibly-blank votes}
\label{bproof}
In this section, we suppose:
\[
(\alpha_0,\beta_0)=(g^{r_0},y^{r_0}g^{m_0})
\quad\text{and}\quad
(\alpha_\Sigma,\beta_\Sigma)=(g^{r_\Sigma},y^{r_\Sigma}g^{m_\Sigma})
\]
Note that $\alpha_\Sigma$, $\beta_\Sigma$ and $r_\Sigma$ can be easily
computed from the encryptions of $m_1,\dotsc,m_n$ and their associated
secrets.
Additionnally, let $P$ be the string
``$g\verb=,=y\verb=,=\alpha_0\verb=,=\beta_0\verb=,=\alpha_\Sigma\verb=,=\beta_\Sigma$'',
where the commas are verbatim and the numbers are written in base
10. Let also $M_1,\dotsc,M_k$ be the sequence
$\minlabel,\dots,\maxlabel$ ($k=\maxlabel-\minlabel+1$).
\subsubsection{Non-blank votes ($m_0=0$)}
\label{non-blank-votes}
\paragraph{Computing \bproof}
In $m_0=0\lor m_\Sigma=0$, the first case is true. The proof $\bproof$
of the whole statement is the couple of proofs $(\pi_0,\pi_\Sigma)$
built as follows:
\begin{enumerate}
\item pick random $\challenge(\pi_\Sigma)$ and $\response(\pi_\Sigma)$
in $\Z_q$
\item compute
$A_\Sigma=g^{\response(\pi_\Sigma)}\times\alpha_\Sigma^{\challenge(\pi_\Sigma)}$
and
$B_\Sigma=y^{\response(\pi_\Sigma)}\times\beta_\Sigma^{\challenge(\pi_\Sigma)}$
\item pick a random $w$ in $\Z_q$
\item compute $A_0=g^w$ and $B_0=y^w$
\item compute \[\challenge(\pi_0)=\Hash_{\mathsf{bproof0}}(S,P,A_0,B_0,A_\Sigma,B_\Sigma)-\challenge(\pi_\Sigma)\mod q\]
\item compute $\response(\pi_0)=w-r_0\times\challenge(\pi_0)\mod q$
\end{enumerate}
In the above, $\Hash_{\mathsf{bproof0}}$ is computed as follows:
\[\Hash_{\mathsf{bproof0}}(\dotsc)=
\shatwo(\verb=bproof0|=S\verb=|=P\verb=|=A_0\verb=,=B_0\verb=,=A_\Sigma\verb=,=B_\Sigma)\mod q\]
where \verb=bproof0=, the vertical bars and the commas are verbatim and
numbers are written in base 10. The result is interpreted as a 256-bit
big-endian number.
\paragraph{Computing \oproof}
In $m_0=1\lor m_\Sigma\in[M_1\dots M_k]$, the second case
is true. Let $i$ be such that $m_\Sigma=M_i$. The proof of the whole
statement is a $(k+1)$-tuple $(\pi_0,\pi_1,\dotsc,\pi_k)$ built as
follows:
\begin{enumerate}
\item pick random $\challenge(\pi_0)$ and $\response(\pi_0)$
in $\Z_q$
\item compute
$A_0=g^{\response(\pi_0)}\times\alpha_0^{\challenge(\pi_0)}$
and
$B_0=y^{\response(\pi_0)}\times(\beta_0/g)^{\challenge(\pi_0)}$
\item for $j>0$ and $j\neq i$:
\begin{enumerate}
\item create $\pi_j$ with a random $\challenge$ and a random
$\response$ in $\Z_q$
\item compute
$A_j={g^\response}\times{\alpha_\Sigma^\challenge}$ and
$B_j={y^\response}\times{(\beta_\Sigma/g^{M_j})^\challenge}$
\end{enumerate}
\item pick a random $w\in\Z_q$
\item compute $A_i=g^w$ and $B_i=y^w$
\item compute
\[\challenge(\pi_i)=\Hash_{\textsf{bproof1}}(S,P,A_0,B_0,\dots,A_k,B_k)-\sum_{j\neq i}\challenge(\pi_j)\mod q\]
\item compute $\response(\pi_i)=w-r_\Sigma\times\challenge(\pi_i)\mod q$
\end{enumerate}
In the above, $\Hash_{\mathsf{bproof1}}$ is computed as follows:
\[\Hash_{\mathsf{bproof1}}(\dotsc)=
\shatwo(\verb=bproof1|=S\verb=|=P\verb=|=A_0\verb=,=B_0\verb=,=\dotsc\verb=,=A_k\verb=,=B_k)\mod q\]
where \verb=bproof1=, the vertical bars and the commas are verbatim and
numbers are written in base 10. The result is interpreted as a 256-bit
big-endian number.
\subsubsection{Blank votes ($m_0=1$)}
\paragraph{Computing \bproof}
In $m_0=0\lor m_\Sigma=0$, the second case is true. The proof
$\bproof$ of the whole statement is the couple of proofs
$(\pi_0,\pi_\Sigma)$ built as in section~\ref{non-blank-votes}, but
exchanging subscripts $0$ and $\Sigma$ everywhere except in the call
to $\Hash_{\textsf{bproof0}}$.
\paragraph{Computing \oproof}
In $m_0=1\lor m_\Sigma\in[M_1\dots M_k]$, the first case is
true. The proof of the whole statement is a $(k+1)$-tuple
$(\pi_0,\pi_1,\dotsc,\pi_k)$ built as follows:
\begin{enumerate}
\item for $j>0$:
\begin{enumerate}
\item create $\pi_j$ with a random $\challenge$ and a random
$\response$ in $\Z_q$
\item compute
$A_j={g^\response}\times{\alpha_\Sigma^\challenge}$ and
$B_j={y^\response}\times{(\beta_\Sigma/g^{M_j})^\challenge}$
\end{enumerate}
\item pick a random $w\in\Z_q$
\item compute $A_0=g^w$ and $B_0=y^w$
\item compute
\[\challenge(\pi_0)=\Hash_{\textsf{bproof1}}(S,P,A_0,B_0,\dots,A_k,B_k)-\sum_{j>0}\challenge(\pi_j)\mod q\]
\item compute $\response(\pi_0)=w-r_0\times\challenge(\pi_0)\mod q$
\end{enumerate}
\subsubsection{Verifying proofs}
\paragraph{Verifying \bproof}
A proof of $m_0=0\lor m_\Sigma=0$ is a couple of proofs
$(\pi_0,\pi_\Sigma)$ such that the following procedure passes:
\begin{enumerate}
\item compute
$A_0=g^{\response(\pi_0)}\times\alpha_0^{\challenge(\pi_0)}$
and
$B_0=y^{\response(\pi_0)}\times\beta_0^{\challenge(\pi_0)}$
\item compute
$A_\Sigma=g^{\response(\pi_\Sigma)}\times\alpha_\Sigma^{\challenge(\pi_\Sigma)}$
and
$B_\Sigma=y^{\response(\pi_\Sigma)}\times\beta_\Sigma^{\challenge(\pi_\Sigma)}$
\item check that
\[\Hash_{\mathsf{bproof0}}(S,P,A_0,B_0,A_\Sigma,B_\Sigma)=\challenge(\pi_0)+\challenge(\pi_\Sigma)\mod q\]
\end{enumerate}
\paragraph{Verifying \oproof}
A proof of $m_0=1\lor m_\Sigma\in[M_1\dots M_k]$ is a $(k+1)$-tuple
$(\pi_0,\pi_1,\dotsc,\pi_k)$ such that the following procedure passes:
\begin{enumerate}
\item compute
$A_0=g^{\response(\pi_0)}\times\alpha_0^{\challenge(\pi_0)}$
and
$B_0=y^{\response(\pi_0)}\times(\beta_0/g)^{\challenge(\pi_0)}$
\item for $j>0$, compute
\[A_j=g^{\response(\pi_j)}\times\alpha_j^{\challenge(\pi_j)}
\quad\text{and}\quad
B_j=y^{\response(\pi_j)}\times(\beta_j/g^{M_j})^{\challenge(\pi_j)}\]
\item check that
\[\Hash_{\textsf{bproof1}}(S,P,A_0,B_0,\dots,A_k,B_k)=\sum_{j=0}^k\challenge(\pi_j)\mod q\]
\end{enumerate}
\subsection{Signatures}
\label{signatures}
\begin{gather*}
\signature=\left\{
\begin{array}{rcl}
\pklabel&:&\pk\\
\challenge&:&\Z_q\\
\response&:&\Z_q
\end{array}
\right\}
\end{gather*}
\newcommand{\siglabel}{\textsf{signature}}
Each ballot contains a digital signature to avoid ballot stuffing. The
signature needs a \hyperref[credentials]{credential} $c$ and uses all
the \ciphertext{}s $\gamma_1,\dots,\gamma_l$ that appear in the ballot
($l$ is the sum of the lengths of $\choices$). It is computed as
follows:
\begin{enumerate}
\item compute $s=\secret(c)$
\item pick a random $w\in\Z_q$
\item compute $A=g^w$
\item $\pklabel=g^s$
\item $\challenge=\Hash_\siglabel(\pklabel,A,\gamma_1,\dots,\gamma_l)\mod q$
\item $\response=w-s\times\challenge\mod q$
\end{enumerate}
In the above, $\Hash_\siglabel$ is computed as follows:
\[
\Hash_\siglabel(S,A,\gamma_1,\dots,\gamma_l)=\shatwo(\verb=sig|=S\verb=|=A\verb=|=\alphalabel(\gamma_1)\verb=,=\betalabel(\gamma_1)\verb=,=\dots\verb=,=\alphalabel(\gamma_l)\verb=,=\betalabel(\gamma_l))
\]
where \verb=sig=, the vertical bars and commas are verbatim and
numbers are written in base 10. The result is interpreted as a 256-bit
big-endian number.
Signatures are verified as follows:
\begin{enumerate}
\item compute $A=g^\response\times \pklabel^\challenge$
\item check that $\challenge=\Hash_\siglabel(\pklabel,A,\gamma_1,\dots,\gamma_l)\mod q$
\end{enumerate}
\subsection{Ballots}
\label{ballots}
\newcommand{\json}{\textsf{JSON}}
\begin{gather*}
\ballot=\left\{
\begin{array}{rcl}
\answers&:&\hyperref[answers]{\answer}^\ast\\
\textsf{election\_hash}&:&\jstring\\
\textsf{election\_uuid}&:&\uuid\\
\siglabel&:&\hyperref[signatures]{\signature}
\end{array}
\right\}
\end{gather*}
The so-called hash (or \emph{fingerprint}) of the election
is computed with the function $\Hash_\json$:
\[
\Hash_\json(J)=\basesixfour(\shatwo(J))
\]
Where $J$ is the serialization (done by the server) of the $\election$
structure.
The same hashing function is used on a serialization (done by the
voting client) of the $\ballot$ structure to produce a so-called
\emph{smart ballot tracker}.
\subsection{Tally}
\label{tally}
\begin{gather*}
\etally=\ciphertext^\ast{}^\ast
\end{gather*}
The encrypted tally is the pointwise product of the ciphertexts of all
accepted ballots:
\[
\begin{array}{rcl}
\alphalabel(\etally_{i,j})&=&\prod\alphalabel(\choices(\answers(\ballot)_i)_j)\\
\betalabel(\etally_{i,j})&=&\prod\betalabel(\choices(\answers(\ballot)_i)_j)
\end{array}
\]
\newcommand{\dfactors}{\textsf{decryption\_factors}}
\newcommand{\dproofs}{\textsf{decryption\_proofs}}
\newcommand{\decrypt}{\textsf{decrypt}}
\begin{gather*}
\pdecryption=\left\{
\begin{array}{rcl}
\dfactors&:&\G^\ast{}^\ast\\
\dproofs&:&\proof^\ast{}^\ast
\end{array}
\right\}
\end{gather*}
From the encrypted tally, each trustee computes a partial decryption
using the \hyperref[trustee-keys]{private key} $x$ (and the
corresponding public key $X=g^x$) he generated during election
setup. It consists of so-called decryption factors:
\[
\dfactors_{i,j}=\alphalabel(\etally_{i,j})^x
\]
and proofs that they were correctly computed. Each $\dproofs_{i,j}$ is
computed as follows:
\begin{enumerate}
\item pick a random $w\in\Z_q$
\item compute $A=g^w$ and $B=\alphalabel(\etally_{i,j})^w$
\item $\challenge=\Hash_\decrypt(X,A,B)$
\item $\response=w+x\times\challenge\mod q$
\end{enumerate}
In the above, $\Hash_\decrypt$ is computed as follows:
\[
\Hash_\decrypt(X,A,B)=\shatwo(\verb=decrypt|=X\verb=|=A\verb=,=B)\mod q
\]
where \verb=decrypt=, the vertical bars and the comma are verbatim and
numbers are written in base 10. The result is interpreted as a 256-bit
big-endian number.
These proofs are verified using the $\tpk$ structure $k$ that the
trustee sent to the administrator during the election setup:
\begin{enumerate}
\item compute
\[
A=\frac{g^\response}{\pklabel(k)^\challenge}
\quad\text{and}\quad
B=\frac{\alphalabel(\etally_{i,j})^\response}{\dfactors_{i,j}^\challenge}
\]
\item check that $\Hash_\decrypt(\pklabel(k),A,B)=\challenge$
\end{enumerate}
\subsection{Election result}
\label{election-result}
\newcommand{\ntallied}{\textsf{num\_tallied}}
\newcommand{\etallylabel}{\textsf{encrypted\_tally}}
\newcommand{\pdlabel}{\textsf{partial\_decryptions}}
\newcommand{\resultlabel}{\textsf{result}}
\begin{gather*}
\result=\left\{
\begin{array}{rcl}
\ntallied&:&\I\\
\etallylabel&:&\etally\\
\pdlabel&:&\pdecryption^\ast\\
\resultlabel&:&\I^\ast{}^\ast
\end{array}
\right\}
\end{gather*}
The decryption factors are combined for each ciphertext to build
synthetic ones:
\[
F_{i,j}=\prod_{z\in[1\dots m]}\pdlabel_{z,i,j}
\]
where $m$ is the number of trustees. The $\resultlabel$ field of the
$\result$ structure is then computed as follows:
\[
\resultlabel_{i,j}=\log_g\left(\frac{\betalabel(\etallylabel_{i,j})}{F_{i,j}}\right)
\]
Here, the discrete logarithm can be easily computed because it is
bounded by $\ntallied$.
After the election, the following data needs to be public in order to
verify the tally:
\begin{itemize}
\item the $\election$ structure;
\item all the $\tpk$s that were generated during the
\hyperref[election-setup]{setup phase};
\item the set of public credentials;
\item the set of ballots;
\item the $\result$ structure described above.
\end{itemize}
\section{Default group parameters}
\label{default-group}
These parameters have been generated by the \verb=fips.sage= script
(available in Belenios sources), which is itself based on FIPS 186-4.
\[
\begin{array}{lcr}
p&=&20694785691422546\\
&&401013643657505008064922989295751104097100884787057374219242\\
&&717401922237254497684338129066633138078958404960054389636289\\
&&796393038773905722803605973749427671376777618898589872735865\\
&&049081167099310535867780980030790491654063777173764198678527\\
&&273474476341835600035698305193144284561701911000786737307333\\
&&564123971732897913240474578834468260652327974647951137672658\\
&&693582180046317922073668860052627186363386088796882120769432\\
&&366149491002923444346373222145884100586421050242120365433561\\
&&201320481118852408731077014151666200162313177169372189248078\\
&&507711827842317498073276598828825169183103125680162072880719\\
g&=&2402352677501852\\
&&209227687703532399932712287657378364916510075318787663274146\\
&&353219320285676155269678799694668298749389095083896573425601\\
&&900601068477164491735474137283104610458681314511781646755400\\
&&527402889846139864532661215055797097162016168270312886432456\\
&&663834863635782106154918419982534315189740658186868651151358\\
&&576410138882215396016043228843603930989333662772848406593138\\
&&406010231675095763777982665103606822406635076697764025346253\\
&&773085133173495194248967754052573659049492477631475991575198\\
&&775177711481490920456600205478127054728238140972518639858334\\
&&115700568353695553423781475582491896050296680037745308460627\\
q&=&78571733251071885\\
&&079927659812671450121821421258408794611510081919805623223441
\end{array}
\]
The additional output of the generation algorithm is:
\[
\begin{array}{lcr}
\texttt{domain\_parameter\_seed}&=&478953892617249466\\
&&166106476098847626563138168027\\
&&716882488732447198349000396592\\
&&020632875172724552145560167746\\
\texttt{counter}&=&109
\end{array}
\]
\end{document}
belenios-1.4+dfsg/doc/tool.md 0000664 0000000 0000000 00000014244 13071403144 0016143 0 ustar 00root root 0000000 0000000 Belenios Tool
=============
Introduction
------------
`belenios-tool` is a command-line tool that can be used to perform
administrative tasks related to elections, as well as verifications.
If you do not wish to use the provided web server, a whole election
can be organized using this tool. As an illustration of that, you can
have a look at the `demo/demo.sh` script that simulates an election.
This file documents how to use `belenios-tool`, from the point of view
of the various roles involved in an election. You can also run it with
the `--help` option to get more information.
Auditor's guide
---------------
Note that anyone can be an auditor. Everyone who plays a specific role
in an election should start by auditing the election data.
During an election, you should have access to the following files:
* `election.json`: election parameters
* `public_keys.jsons`: trustees' public keys
* `public_creds.txt`: the public keys associated to valid credentials
* `ballots.jsons`: accepted ballots
Note that the last one is dynamic, and evolve during the election. At
the end of the election, it is frozen and a `result.json` file will be
published.
If you put these files in a directory `/path/to/election`, the following
command will perform all possible verifications, depending on existing
files:
belenios-tool verify --dir /path/to/election
For example, during the election, you can check if some candidate
ballot is acceptable by putting it alone in `ballots.jsons`, and
running the command above.
Voter's guide
-------------
If you put your secret credential in a file `/path/to/credential` and
your choices in a file `/path/to/choices.json` (as an array of arrays
of 0/1 in JSON format), the following command will output a raw ballot
that can be sent to the administrator of the election:
belenios-tool vote --dir /path/to/election --privcred /path/to/credential --ballot /path/to/choices.json
In the case where the election is administered with the web interface,
a raw ballot prepared with the command-line tool can be uploaded directly
via the web interface.
Administrator's guide
---------------------
### Setup a new election
1. Generate an UUID with the `uuidgen` command. Let it be `$UUID`.
2. Go to an empty directory. In the following, we denote by `$DIR`
the full path to this directory and by `$BELENIOS` the full path
to the Belenios source tree.
4. Ask the credential authority to generate credentials. Note that
`$UUID` is needed for that. Save the file with public
credentials into `$DIR/public_creds.txt`.
5. Ask each trustee to generate a keypair. Concatenate all trustee
public keys into a `$DIR/public_keys.jsons` file.
6. Edit `$BELENIOS/demo/templates/questions.json`.
7. Go to `$DIR` and run: `belenios-tool mkelection --uuid $UUID
--group $BELENIOS/demo/groups/default.json --template
$BELENIOS/demo/templates/questions.json`. It should generate
`election.json`.
8. Create an empty `ballots.jsons` file in `$DIR`.
### Running the election
The contents of `$DIR` must be public.
For each received ballot, append it to `ballots.jsons` and run:
belenios-tool verify --dir $DIR
If no error is reported, publish the new `ballots.jsons`; otherwise,
the new ballot is incorrect and you must revert `ballots.jsons` to its
previous state.
Note that each ballot must be authenticated in order to prevent the
credential authority from stuffing the ballot box. This issue is not
addressed by the command-line tool, but the web server provides
several authentication mechanisms.
### Tallying the election
1. Go to the election directory, which must contain `election.json`,
`public_keys.jsons`, `public_creds.txt` and `ballots.jsons`.
2. Concatenate the `partial_decryption.json` received from each
trustee into a `partial_decryptions.jsons`, in the same order as in
`public_keys.jsons`.
3. Run `belenios-tool finalize`. It will create
`result.json`. Publish this file, along with the files listed in
the first step above. The whole set will enable universal
verifiability.
Note: `partial_decryptions.jsons` is a temporary file whose contents
is embedded in `result.json`, so it can be discarded.
Credential authority's guide
----------------------------
### Credential generation
If you have a list of identities in a file `F` with `N` lines, one
identity per line, run:
belenios-tool credgen --uuid XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX --file F
where `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX` is the UUID of the
election given by the administrator. It will generate three files with
`N` lines:
* `T.privcreds`: each line of this file contains an identity and a
private credential. Send each voter the associated credential. Keep
this file secret, and secure if you want to be able to re-send a
credential later (e.g. if a voter lost or did not receive it).
* `T.pubcreds`: each line of this file contains a public credential.
Send the whole file to the election administrator; it will be the
`public_creds.txt` for the election (and you must check that);
* `T.hashcreds`: each line of this file contains, for each id in
`T.privcreds`, the hash of the corresponding public key. At the
moment, this file has no practical purpose (but this might change in
the future). Destroy it.
You can optionally add a `--dir` option to specify the directory where
these files will be written.
Trustee's guide
---------------
### Key generation
To generate a keypair, run:
belenios-tool trustee-keygen
It will generate two files, `XXXXXXXX.public` and `XXXXXXXX.private`,
containing respectively the public and the private key. Send the
public key file to the server administrator, and keep the private key
with extreme care. When the election is open, you must check that
your public key is present in the published `public_keys.jsons`.
### Partial decryption
To compute your decryption share, set `/path/to/election` up as
described in the _Voter's guide_ section above, and run:
belenios-tool decrypt --dir /path/to/election --privkey /path/to/privkey > partial_decryption.json
and send `partial_decryption.json` to the election administrator.
Note: be sure to authenticate all your input files when you use your
private key!
belenios-1.4+dfsg/doc/web.md 0000664 0000000 0000000 00000014435 13071403144 0015745 0 ustar 00root root 0000000 0000000 Belenios Web Server
===================
Election administrator's guide
------------------------------
### Setup a new election
Once the server is up and running (see below), anyone who can log into
the server as an administrator can create an election. First, the
administrator has to choose how credentials will be handled:
* in the automatic mode, the server will generate credentials and
mail the private parts to each voter. Credential recovery (i.e. one
voter loses his/her credential or does not receive it) is not
possible in this case;
* in the manual mode, a third party will generate credentials using
a web interface or the command-line tool, and upload the public
credentials to the server. It's up to this third party to send
private credentials to each voter, and to implement credential
recovery.
Moreover, the administrator has to choose the authentication mode for
voters:
* with the password mode, the server will generate passwords and
mail them to the voters, this is the most common mode;
* the other one uses a [CAS](https://www.apereo.org/projects/cas)
server.
Then, the administrator must:
* set the name and description of the election;
* edit questions;
* edit voters, and have the server send them their password if this
authentication mode has been chosen;
* have the credential authority generate credentials and send
e-mails; in the automatic mode, this is done simply by clicking
on a button; in the manual mode, a link is generated for the
credential authority;
* (optionally) edit trustees. For good security there should be at
least two trustees; a link is generated for each trustee;
* finalize the election.
Each "link" above must be sent by the administrator to their intended
recipient. Each link leads to an interface that will help its
recipient accomplish his or her task.
The *election fingerprint*, which is shown on the election page and in
the booth, is the compact Base64 encoding of the SHA256 of
`election.json`. It can be computed from a POSIX shell by piping it
into:
sha256sum | xxd -r -p | base64
### Election life cycle
An election starts by being in preparation (or "setup mode"), then
becomes finalized. Then, it is immediately opened and can be closed
and re-opened at will. When it is closed, the election administrator
can initiate the tallying process. The encrypted tally is then
computed and published. After each trustee has computed his/her share
of the decryption, the administrator triggers the release of the
result.
At any moment, a finalized election can be archived. This releases
some resources on the server and makes the election read-only. In
particular, it is no longer possible to vote in or to tally an
archived election. Be careful, this operation is not revertible.
### Auditing an election
During the election, the following files are published:
* `election.json`: election parameters
* `public_keys.jsons`: trustees' public keys
* `public_creds.txt`: the public keys associated to valid credentials
* `ballots.jsons`: accepted ballots
They are accessible from the bottom of the election page. Together,
they enable anyone to audit the election. At the end of the election,
an additional `result.json` file is published with the result and
other cryptographic proofs that everything went well.
Please refer to the auditor's guide in the documentation of the
command-line tool for more information.
Server administrator's guide
----------------------------
A sample web server can be run with the `demo/run-server.sh` script,
from the compiled source tree.
Here is an excerpt of the sample configuration file:
`` elements configure authentication for the whole
site. Available authentication methods:
* ``: just asks for a name. No security is intended. This is
useful for debugging or demonstration purposes but obviously not
suitable for production
* ``: password-based authentication. It takes as parameter
a file, in CSV format, where each line consists of:
+ a user name
+ a salt
+ SHA256(salt concatenated with password)
Additional fields are ignored. In the sample `password_db.csv`
file, a fourth field with the plaintext password is included. The
sample file has been generated with the following shell command:
`for u in $(seq 1 5); do SALT=$(pwgen); PASS=$(pwgen); echo "user$u,$SALT,$(echo -n "$SALT$PASS" | sha256sum | read a b; echo $a),$PASS"; done`
* ``: authenticate with a [CAS](https://www.apereo.org/projects/cas)
server. For example:
``
If the web server is behind a reverse-proxy, it might be needed to
rewrite URLs passed to the CAS server. This can be done with the
following directive:
``
* ``: authenticate with an [OpenID Connect](http://openid.net/connect/)
server. For example:
``
In the above, `client-id` and `client-secret` must be replaced by
valid credentials issued by the OpenID Connect provider.
The `` directive also applies to this authentication
scheme.
The `` element gives the path to the source tarball. Note that
this is a path on the local filesystem and not a URL. If you made
local changes, an easy way to comply with the AGPL license is to
commit them in a local git checkout, and put in the `source` element
the path to the tarball generated by `make archive`.
The `` element indicates a file where some security-sensitive
events will be logged. It is optional.
The `` element indicates a directory with election data. This
directory should be empty when the server is launched for the first
time, and will be populated with election data. A typical location
would be `/var/lib/belenios`. Warning: it may contain sensitive data
(e.g. the private key when no external trustees are set).
belenios-1.4+dfsg/genversion.sh 0000775 0000000 0000000 00000000344 13071403144 0016611 0 ustar 00root root 0000000 0000000 #!/bin/sh
# the following is to be run from _build directory
if [ -d ../.git ] && which git >/dev/null 2>&1; then
BUILD=${BUILD:-$(git describe)}
else
BUILD=${BUILD:-$(date -u +%Y%m%d)}
fi
head -n1 VERSION
echo $BUILD
belenios-1.4+dfsg/minimal.itarget 0000664 0000000 0000000 00000000016 13071403144 0017076 0 ustar 00root root 0000000 0000000 belenios-tool
belenios-1.4+dfsg/myocamlbuild.ml 0000664 0000000 0000000 00000011524 13071403144 0017110 0 ustar 00root root 0000000 0000000 open Ocamlbuild_plugin
let debug =
try Sys.getenv "BELENIOS_DEBUG" <> ""
with Not_found -> false
let try_exec cmd =
Sys.command (cmd ^ " >/dev/null 2>&1") = 0
let has_ocamlopt = try_exec "which ocamlopt"
let native_compilation =
try Sys.getenv "OCAMLBEST" = "native"
with Not_found -> has_ocamlopt
let exe_suffix = if native_compilation then ".native" else ".byte"
let atdgen_action opts env build =
let x = env "%.atd" in
let d = Pathname.dirname x and f = Pathname.basename x in
Cmd (S [A"cd"; P d; Sh"&&"; A"atdgen"; S opts; P f])
let js_of_ocaml env build =
Cmd (S [A"js_of_ocaml"; P (env "%.byte")])
let ( / ) = Filename.concat
let platform_rules kind =
let lib = "src" / "lib" in
let platform_dir = "src" / "platform" in
let platform_mod = platform_dir / kind / "platform" in
let platform_lib = platform_dir / "platform-" ^ kind in
let ml = platform_mod ^ ".ml" in
let mli = platform_mod ^ ".mli" in
let mllib = platform_lib ^ ".mllib" in
rule mllib ~deps:[ml] ~prods:[mllib] (fun _ _ ->
(* technically, there is no dependency, but we need the directory to
exist for the following *)
Echo ([platform_dir / kind / "Belenios_version"; "\n";
platform_dir / kind / "Platform"; "\n"],
mllib)
);
dep ["file:" ^ ml] [mli];
copy_rule mli (lib / "platform.mli") mli;
ocaml_lib platform_lib
let build_rule () =
let genversion = "genversion.sh" in
let deps = ["VERSION"; genversion] in
let prod = "BUILD" in
let builder _ _ =
Cmd (S [A "sh"; P genversion; Sh ">"; P prod])
in
rule "BUILD" ~deps ~prod builder
let version_rules kind =
let file = "BUILD" in
let deps = [file; "src/platform/" ^ kind ^ "/belenios_version.mli"] in
let prod = "src/platform/" ^ kind ^ "/belenios_version.ml" in
let builder _ _ =
let version, build =
let ic = open_in file in
let version = input_line ic in
let build = input_line ic in
close_in ic;
version, build
in
let lines = Printf.([
sprintf "let version = \"%s\"" version;
sprintf "let build = \"%s\"" build;
sprintf "let debug = %b" debug;
]) in
Echo (lines, prod)
in
copy_rule
(kind / "belenios_tool.mli")
"src/lib/belenios_version.mli"
("src/platform/" ^ kind ^ "/belenios_version.mli");
rule ("BUILD -> " ^ kind ^ "/belenios_version.ml") ~deps ~prod builder
let copy_static f =
let base = Filename.basename f in
copy_rule base f ("src/static" / base)
let () = dispatch & function
| Before_options ->
Options.use_ocamlfind := true;
Options.make_links := false;
| After_rules ->
Pathname.define_context "src/web" ["src/lib"];
Pathname.define_context "src/tool" ["src/lib"];
Pathname.define_context "src/booth" ["src/lib"];
Pathname.define_context "demo" ["src/lib"];
Pathname.define_context "stuff" ["src/lib"];
Pathname.define_context "." ["src/lib"];
(* the following avoids an ocamlfind warning, it should be built-in *)
flag ["doc"; "thread"] (A"-thread");
rule "%.atd -> %_t.ml & %_t.mli" ~deps:["%.atd"] ~prods:["%_t.ml"; "%_t.mli"]
(atdgen_action [A"-t"]);
rule "%.atd -> %_j.ml & %_j.mli" ~deps:["%.atd"] ~prods:["%_j.ml"; "%_j.mli"]
(atdgen_action [A"-j"; A"-j-std"]);
rule "%.byte -> %.js" ~deps:["%.byte"] ~prods:["%.js"] js_of_ocaml;
rule "%.md -> %.html" ~deps:["%.md"] ~prods:["%.html"]
(fun env build ->
Cmd (S [A"markdown"; P (env "%.md"); Sh">"; P (env "%.html")])
);
build_rule ();
version_rules "native";
version_rules "js";
platform_rules "native";
platform_rules "js";
copy_rule "jsbn.js" "ext/booth/js/jsbn/jsbn.js" "src/static/jsbn.js";
copy_rule "jsbn2.js" "ext/booth/js/jsbn/jsbn2.js" "src/static/jsbn2.js";
copy_rule "sjcl.js" "ext/booth/js/sjcl/sjcl.js" "src/static/sjcl.js";
copy_rule "random.js" "src/platform/js/random.js" "src/static/random.js";
copy_rule "belenios-tool" ("src/tool/tool_cmdline" ^ exe_suffix) "belenios-tool";
copy_rule "belenios-tool.js" "src/tool/tool_js.js" "src/static/tool_js.js";
copy_rule "belenios-tool.html" "src/tool/belenios-tool.html" "src/static/belenios-tool.html";
copy_rule "encrypting.gif" "ext/booth/encrypting.gif" "src/static/encrypting.gif";
copy_rule "booth.js" "src/booth/booth.js" "src/static/booth.js";
copy_rule "tool_js_tkeygen.js" "src/tool/tool_js_tkeygen.js" "src/static/tool_js_tkeygen.js";
copy_rule "tool_js_credgen.js" "src/tool/tool_js_credgen.js" "src/static/tool_js_credgen.js";
copy_rule "tool_js_questions.js" "src/tool/tool_js_questions.js" "src/static/tool_js_questions.js";
copy_rule "tool_js_pd.js" "src/tool/tool_js_pd.js" "src/static/tool_js_pd.js";
List.iter
copy_static
[
"ext/css/reset.css";
"ext/css/styled-elements.css";
"ext/css/style.css";
"ext/css/superfish.css";
]
| _ -> ()
belenios-1.4+dfsg/opam-bootstrap.sh 0000775 0000000 0000000 00000006034 13071403144 0017403 0 ustar 00root root 0000000 0000000 #!/bin/sh
set -e
BELENIOS_SRC="${BELENIOS_SRC:-$PWD}"
# Check that OCamlDuce is not installed
if which ocamlduce >/dev/null; then
echo "Please uninstall OCamlDuce first, or remove it from your PATH."
exit 1
fi
echo
echo "=-=-= Download and check tarballs =-=-="
echo
# Look for wget or curl
if which wget >/dev/null; then
echo "wget was found and will be used"
elif which curl >/dev/null; then
wget () { curl "$1" > "${1##*/}"; }
echo "curl was found and will be used"
fi
export BELENIOS_SYSROOT="${BELENIOS_SYSROOT:-$HOME/.belenios}"
export OPAMROOT="$BELENIOS_SYSROOT/opam"
if [ -e "$BELENIOS_SYSROOT" ]; then
echo "$BELENIOS_SYSROOT already exists."
echo "Please remove it or set BELENIOS_SYSROOT to a non-existent directory first."
exit 1
fi
mkdir -p "$BELENIOS_SYSROOT/bootstrap/src"
cd "$BELENIOS_SYSROOT/bootstrap/src"
wget http://caml.inria.fr/pub/distrib/ocaml-4.02/ocaml-4.02.3.tar.gz
wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-full-1.2.2.tar.gz
if which sha256sum >/dev/null; then
sha256sum --check < $BELENIOS_SRC/env.sh <