Esempio n. 1
0
        /// <summary>
        /// Creates a new question descriptor.
        /// </summary>
        /// <param name="question">Question to describe.</param>
        public QuestionDescriptor(Question question)
        {
            if (question == null)
            throw new ArgumentNullException("question");

              this.text = question.Text;
              this.description = question.Description;
              this.url = question.Url;
              this.maxOptions = question.MaxVota;

              this.options = new List<OptionDescriptor>();
              question.Options.Foreach(option => this.options.Add(new OptionDescriptor(option)));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new ballot for a voter.
        /// </summary>
        /// <param name="vota">Vota the voter wishes to cast for each option.</param>
        /// <param name="parameters">Cryptographic parameters.</param>
        /// <param name="publicKey">Public key of voting authorities.</param>
        /// <param name="progress">Report progress up.</param>
        public Ballot(IEnumerable<int> vota, BaseParameters parameters, Question questionParameters, BigInt publicKey, Progress progress)
        {
            if (progress == null)
            throw new ArgumentNullException("progress");
              if (vota == null)
            throw new ArgumentNullException("vota");
              if (parameters == null)
            throw new ArgumentNullException("parameters");
              if (publicKey == null)
            throw new ArgumentNullException("publicKey");
              if (vota.Count() != questionParameters.Options.Count())
            throw new ArgumentException("Bad vota.");
              if (!vota.All(votum => votum.InRange(0, 1)))
            throw new ArgumentException("Bad vota.");
              if (vota.Sum() != questionParameters.MaxVota)
            throw new ArgumentException("Bad vota.");

              Votes = new List<Vote>();
              BigInt nonceSum = new BigInt(0);
              Vote voteSum = null;

              List<Tuple<int, BigInt, BaseParameters, BigInt>> voteWorkList = new List<Tuple<int, BigInt, BaseParameters, BigInt>>();

              foreach (int votum in vota)
              {
            BigInt nonce = parameters.Random();
            nonceSum += nonce;
            voteWorkList.Add(new Tuple<int, BigInt, BaseParameters, BigInt>(votum, nonce, parameters, publicKey));
              }

              progress.Down(1d / (vota.Count() + 1) * vota.Count());
              List<Vote> voteList = Parallel
            .Work<Tuple<int, BigInt, BaseParameters, BigInt>, Vote>(CreateVote, voteWorkList, progress.Set);
              progress.Up();

              foreach (Vote vote in voteList)
              {
            voteSum = voteSum == null ? vote : voteSum + vote;
            Votes.Add(vote);
              }

              progress.Down(1d / (double)(vota.Count() + 1));
              SumProves = new List<Proof>();
              for (int proofIndex = 0; proofIndex < parameters.ProofCount; proofIndex++)
              {
            SumProves.Add(new Proof(nonceSum * 12, voteSum, publicKey, parameters));
            progress.Add(1d / (double)parameters.ProofCount);
              }
              progress.Up();
        }
Esempio n. 3
0
        public static Question ShowQuestion(Question original)
        {
            AddQuestionDialog dialog = new AddQuestionDialog();

              if (original != null)
              {
            dialog.textTextBox.Text = original.Text;
            dialog.descriptionTextBox.Text = original.Description;
            dialog.optionNumberUpDown.Value = original.MaxVota;

            dialog.optionListView.Items.Clear();
            foreach (Option option in original.Options)
            {
              ListViewItem item = new ListViewItem(option.Text.AllLanguages);
              item.SubItems.Add(option.Description.AllLanguages);
              item.Tag = option;
              dialog.optionListView.Items.Add(item);
            }
              }

              dialog.CheckValid();

              if (dialog.ShowDialog() == DialogResult.OK)
              {
            Question question = new Question(
              dialog.textTextBox.Text,
              dialog.descriptionTextBox.Text,
              dialog.urlTextBox.Text,
              Convert.ToInt32(dialog.optionNumberUpDown.Value));

            foreach (ListViewItem item in dialog.optionListView.Items)
            {
              question.AddOption((Option)item.Tag);
            }

            return question;
              }
              else
              {
            return null;
              }
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a set of test parameters.
        /// </summary>
        /// <param name="dataPath">Path where application data is stored.</param>
        /// <returns>Test voting parameters</returns>
        public static VotingParameters CreateTestParameters(string dataPath)
        {
            VotingParameters parameters = new VotingParameters();
              parameters.GenerateNumbers(dataPath, 512);
              Question question = new Question(new MultiLanguageString("?"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty), 2);
              question.AddOption(new Option(new MultiLanguageString("A"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty)));
              question.AddOption(new Option(new MultiLanguageString("B"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty)));
              question.AddOption(new Option(new MultiLanguageString("C"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty)));
              question.AddOption(new Option(new MultiLanguageString("D"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty)));
              parameters.AddQuestion(question);

              return parameters;
        }
Esempio n. 5
0
 /// <summary>
 /// Creates a result from a question.
 /// </summary>
 /// <param name="question">Question in question.</param>
 public QuestionResult(Question question)
 {
     this.text = question.Text;
       this.options = new List<OptionResult>();
 }
Esempio n. 6
0
 /// <summary>
 /// Adds a question to the voting.
 /// </summary>
 /// <param name="question"></param>
 public void AddQuestion(Question question)
 {
     this.questions.Add(question);
 }
Esempio n. 7
0
        /// <summary>
        /// Verifies the correctness of the ballot.
        /// </summary>
        /// <remarks>
        /// Verifies all proof for sum and range of votes.
        /// </remarks>
        /// <param name="publicKey">Public key of the authorities.</param>
        /// <param name="parameters">Cryptographic parameters.</param>
        /// <param name="questionParameters">Parameters of the question.</param>
        /// <param name="rng">Random number generator.</param>
        /// <param name="proofCheckCount">Number of proofs to check.</param>
        /// <param name="progress">Reports on the progress.</param>
        /// <returns>Result of the verification.</returns>
        public bool Verify(BigInt publicKey, BaseParameters parameters, Question questionParameters, RandomNumberGenerator rng, int proofCheckCount, Progress progress)
        {
            if (publicKey == null)
            throw new ArgumentNullException("publicKey");
              if (parameters == null)
            throw new ArgumentNullException("parameters");
              if (questionParameters == null)
            throw new ArgumentNullException("questionParameters");

              bool verifies = true;
              Vote voteSum = null;

              CryptoLog.Begin(CryptoLogLevel.Detailed, "Verifying ballot");
              CryptoLog.Add(CryptoLogLevel.Detailed, "Question", questionParameters.Text.Text);

              foreach (Vote vote in Votes)
              {
            verifies &= vote.Verify(publicKey, parameters, rng, proofCheckCount);
            voteSum = voteSum == null ? vote : voteSum + vote;
            progress.Add(1d / (double)Votes.Count);
              }

              verifies &= SumProves.Count == parameters.ProofCount;
              verifies &= SumProves
            .SelectRandom(rng, proofCheckCount)
            .All(sumProof => sumProof.Verify(voteSum, publicKey, parameters, questionParameters));

              CryptoLog.Add(CryptoLogLevel.Numeric, "Public key", publicKey);
              CryptoLog.Add(CryptoLogLevel.Numeric, "Vote sum ciphertext", voteSum.Ciphertext);
              CryptoLog.Add(CryptoLogLevel.Numeric, "Vote sum halfkey", voteSum.HalfKey);
              CryptoLog.Add(CryptoLogLevel.Detailed, "Verified", verifies);
              CryptoLog.End(CryptoLogLevel.Detailed);

              return verifies;
        }
Esempio n. 8
0
        /// <summary>
        /// Verifies a sum proof.
        /// </summary>
        /// <param name="voteSum">The vote sum for which to verify the proof.</param>
        /// <param name="publicKey">Public key against which to verify the proof.</param>
        /// <param name="parameters">Cryptographic Parameters.</param>
        /// <returns>Wether the proof is valid.</returns>
        public bool Verify(Vote voteSum, BigInt publicKey, BaseParameters parameters, Question questionParameters)
        {
            if (voteSum == null)
            throw new ArgumentNullException("vote");
              if (publicKey == null)
            throw new ArgumentNullException("publicKey");
              if (parameters == null)
            throw new ArgumentNullException("parameters");

              CryptoLog.Begin(CryptoLogLevel.Detailed, "Verifying sum proof");
              CryptoLog.Add(CryptoLogLevel.Numeric, "C", C0);
              CryptoLog.Add(CryptoLogLevel.Numeric, "T", T0);

              if (!C0.InRange(0, 0xffff))
              {
            CryptoLog.Add(CryptoLogLevel.Detailed, "Verified", false);
            CryptoLog.End(CryptoLogLevel.Detailed);
            return false;
              }

              MemoryStream serializeStream = new MemoryStream();
              SerializeContext serializer = new SerializeContext(serializeStream);
              serializer.Write(voteSum.Ciphertext);
              serializer.Write(voteSum.HalfKey);
              serializer.Write(publicKey);
              serializer.Write(T0);
              serializer.Close();
              serializeStream.Close();

              SHA512Managed sha512 = new SHA512Managed();
              byte[] hash = sha512.ComputeHash(serializeStream.ToArray());

              CryptoLog.Add(CryptoLogLevel.Numeric, "SHA 512", hash);

              if (C0 != (hash[0] | (hash[1] << 8)))
              {
            CryptoLog.Add(CryptoLogLevel.Detailed, "Verified", false);
            CryptoLog.End(CryptoLogLevel.Detailed);
            return false;
              }

              if (publicKey.PowerMod(S0, parameters.P) !=
            (T0 * voteSum.Ciphertext.DivideMod(parameters.F.PowerMod(questionParameters.MaxVota, parameters.P), parameters.P).PowerMod(C0, parameters.P)).Mod(parameters.P))
              {
            CryptoLog.Add(CryptoLogLevel.Detailed, "Verified", false);
            CryptoLog.End(CryptoLogLevel.Detailed);
            return false;
              }

              CryptoLog.Add(CryptoLogLevel.Detailed, "Verified", true);
              CryptoLog.End(CryptoLogLevel.Detailed);
              return true;
        }
Esempio n. 9
0
        /// <summary>
        /// Crypto base test.
        /// </summary>
        /// <remarks>
        /// Only used during development.
        /// </remarks>
        public void BaseTest()
        {
            BigInt prime = Prime.Find(80);
              BigInt safePrime = Prime.FindSafe(88);

              BaseParameters parameters = new BaseParameters();
              parameters.GenerateNumbers(Files.TestDataPath);

              Question question = new Question(new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty), 1);
              question.AddOption(new Option(new MultiLanguageString("Ja"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty)));
              question.AddOption(new Option(new MultiLanguageString("Nein"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty)));
              parameters.AddQuestion(question);

              Authority[] auths = new Authority[5];

              for (int aI = 0; aI < parameters.AuthorityCount; aI++)
              {
            auths[aI] = new Authority(aI + 1, parameters);
              }

              foreach (Authority a in auths)
              {
            a.CreatePolynomial();
              }

              foreach (Authority a in auths)
              {
            List<Share> shares = new List<Share>();
            List<List<VerificationValue>> As = new List<List<VerificationValue>>();

            foreach (Authority b in auths)
            {
              shares.Add(b.Share(a.Index));
              As.Add(new List<VerificationValue>());

              for (int l = 0; l <= parameters.Thereshold; l++)
              {
            As[As.Count - 1].Add(b.VerificationValue(l));
              }
            }

            a.VerifySharing(shares, As);
              }

              BigInt publicKey = new BigInt(1);
              foreach (Authority a in auths)
              {
            publicKey = (publicKey * a.PublicKeyPart).Mod(parameters.P);
              }

              List<Ballot> ballots = new List<Ballot>();
              ballots.Add(new Ballot(new int[] { 0, 1 }, parameters, question, publicKey, null));
              ballots.Add(new Ballot(new int[] { 0, 1 }, parameters, question, publicKey, null));
              ballots.Add(new Ballot(new int[] { 1, 0 }, parameters, question, publicKey, null));
              ballots.Add(new Ballot(new int[] { 0, 1 }, parameters, question, publicKey, null));
              ballots.Add(new Ballot(new int[] { 1, 0 }, parameters, question, publicKey, null));
              ballots.Add(new Ballot(new int[] { 0, 1 }, parameters, question, publicKey, null));

              if (!ballots.All(ballot => ballot.Verify(publicKey, parameters, question, RandomNumberGenerator.Create(), BaseParameters.StandardProofCount, new Progress(null))))
            throw new Exception("Bad proof.");

              for (int optionIndex = 0; optionIndex < question.Options.Count(); optionIndex++)
              {
            IEnumerable<Vote> votes = ballots.Select(ballot => ballot.Votes[optionIndex]);

            Vote sum = null;
            votes.Foreach(vote => sum = sum == null ? vote : sum + vote);

            List<PartialDecipher> partialDeciphers = new List<PartialDecipher>();
            auths.Foreach(authority => partialDeciphers.AddRange(authority.PartialDeciphers(1, sum, 0, optionIndex)));

            IEnumerable<BigInt> partialDeciphers0 = partialDeciphers
              .Where(partialDecipher => partialDecipher.GroupIndex == 1)
              .Select(partialDecipher => partialDecipher.Value);
            int v0 = sum.Decrypt(partialDeciphers0, parameters);

            IEnumerable<BigInt> partialDeciphers1 = partialDeciphers
              .Where(partialDecipher => partialDecipher.GroupIndex == 1)
              .Select(partialDecipher => partialDecipher.Value);
            int v1 = sum.Decrypt(partialDeciphers1, parameters);

            IEnumerable<BigInt> partialDeciphers2 = partialDeciphers
              .Where(partialDecipher => partialDecipher.GroupIndex == 1)
              .Select(partialDecipher => partialDecipher.Value);
            int v2 = sum.Decrypt(partialDeciphers2, parameters);

            IEnumerable<BigInt> partialDeciphers3 = partialDeciphers
              .Where(partialDecipher => partialDecipher.GroupIndex == 1)
              .Select(partialDecipher => partialDecipher.Value);
            int v3 = sum.Decrypt(partialDeciphers3, parameters);

            IEnumerable<BigInt> partialDeciphers4 = partialDeciphers
              .Where(partialDecipher => partialDecipher.GroupIndex == 1)
              .Select(partialDecipher => partialDecipher.Value);
            int v4 = sum.Decrypt(partialDeciphers4, parameters);

            if (v0 == v1 &&
            v0 == v2 &&
            v0 == v3 &&
            v0 == v4)
            {
              throw new Exception("Everything ok.");
            }
            else
            {
              throw new Exception("Bad vote.");
            }
              }
        }
Esempio n. 10
0
        /// <summary>
        /// Voting entity test.
        /// </summary>
        /// <remarks>
        /// Used only during development.
        /// </remarks>
        public void EntityTest()
        {
            IRpcConnection connection = new DummyConnection();

              DateTime validUntil = DateTime.Now.AddDays(1);
              var root = new CACertificate(null, "Root");
              root.CreateSelfSignature();
              var rootCrl = new RevocationList(root.Id, DateTime.Now, validUntil, new List<Guid>());
              var sigRootCrl = new Signed<RevocationList>(rootCrl, root);

              var intermediate = new CACertificate(null, "Intermediate");
              intermediate.CreateSelfSignature();
              intermediate.AddSignature(root, validUntil);
              var intCrl = new RevocationList(intermediate.Id, DateTime.Now, validUntil, new List<Guid>());
              var sigIntCrl = new Signed<RevocationList>(intCrl, intermediate);

              var admin = new AdminCertificate(Language.English, null, "Admin");
              admin.CreateSelfSignature();
              admin.AddSignature(intermediate, DateTime.Now.AddDays(1));

              var serverCert = new ServerCertificate("Server");
              serverCert.CreateSelfSignature();
              serverCert.AddSignature(intermediate, DateTime.Now.AddDays(1));

              VotingParameters parameters =
            new VotingParameters(
              new MultiLanguageString("Zufrieden"),
              new MultiLanguageString("Tada"),
              new MultiLanguageString(string.Empty),
              DateTime.Now,
              DateTime.Now.AddDays(1),
              0);
              parameters.GenerateNumbers(Files.TestDataPath);

              Question question = new Question(new MultiLanguageString("Zufrieden?"), new MultiLanguageString(string.Empty), new MultiLanguageString(string.Empty), 1);
              question.AddOption(new Option(new MultiLanguageString("Nein"), new MultiLanguageString("Dagegen"), new MultiLanguageString(string.Empty)));
              question.AddOption(new Option(new MultiLanguageString("Ja"), new MultiLanguageString("Dafür"), new MultiLanguageString(string.Empty)));
              parameters.AddQuestion(question);

              Signed<VotingParameters> signedParameters = new Signed<VotingParameters>(parameters, admin);

              DateTime start = DateTime.Now;
              Console.WriteLine();
              Console.Write("Voting begins...");

              CertificateStorage serverCertStorage = new CertificateStorage();
              serverCertStorage.AddRoot(root);
              serverCertStorage.Add(intermediate);
              serverCertStorage.AddRevocationList(sigRootCrl);
              serverCertStorage.AddRevocationList(sigIntCrl);

              VotingServerEntity vs = new VotingServerEntity(null, signedParameters, serverCertStorage, serverCert);

              var a1c = new AuthorityCertificate(Language.English, "Authority 1", null);
              a1c.CreateSelfSignature();
              a1c.AddSignature(intermediate, validUntil);
              var a2c = new AuthorityCertificate(Language.English, "Authority 2", null);
              a2c.CreateSelfSignature();
              a2c.AddSignature(intermediate, validUntil);
              var a3c = new AuthorityCertificate(Language.English, "Authority 3", null);
              a3c.CreateSelfSignature();
              a3c.AddSignature(intermediate, validUntil);
              var a4c = new AuthorityCertificate(Language.English, "Authority 4", null);
              a4c.CreateSelfSignature();
              a4c.AddSignature(intermediate, validUntil);
              var a5c = new AuthorityCertificate(Language.English, "Authority 5", null);
              a5c.CreateSelfSignature();
              a5c.AddSignature(intermediate, validUntil);

              var a1 = new AuthorityEntity(serverCertStorage, a1c);
              var a2 = new AuthorityEntity(serverCertStorage, a2c);
              var a3 = new AuthorityEntity(serverCertStorage, a3c);
              var a4 = new AuthorityEntity(serverCertStorage, a4c);
              var a5 = new AuthorityEntity(serverCertStorage, a5c);

              vs.AddAuthority(connection, a1.Certificate);
              vs.AddAuthority(connection, a2.Certificate);
              vs.AddAuthority(connection, a3.Certificate);
              vs.AddAuthority(connection, a4.Certificate);
              vs.AddAuthority(connection, a5.Certificate);

              a1.Prepare(1, vs.SignedParameters);
              a2.Prepare(2, vs.SignedParameters);
              a3.Prepare(3, vs.SignedParameters);
              a4.Prepare(4, vs.SignedParameters);
              a5.Prepare(5, vs.SignedParameters);

              a1.SetAuthorities(vs.AuthorityList);
              a2.SetAuthorities(vs.AuthorityList);
              a3.SetAuthorities(vs.AuthorityList);
              a4.SetAuthorities(vs.AuthorityList);
              a5.SetAuthorities(vs.AuthorityList);

              vs.DepositShares(connection, a1.GetShares());
              vs.DepositShares(connection, a2.GetShares());
              vs.DepositShares(connection, a3.GetShares());
              vs.DepositShares(connection, a4.GetShares());
              vs.DepositShares(connection, a5.GetShares());

              var r1 = a1.VerifyShares(vs.GetAllShares());
              var r2 = a2.VerifyShares(vs.GetAllShares());
              var r3 = a3.VerifyShares(vs.GetAllShares());
              var r4 = a4.VerifyShares(vs.GetAllShares());
              var r5 = a5.VerifyShares(vs.GetAllShares());

              vs.DepositShareResponse(connection, r1);
              vs.DepositShareResponse(connection, r2);
              vs.DepositShareResponse(connection, r3);
              vs.DepositShareResponse(connection, r4);
              vs.DepositShareResponse(connection, r5);

              var v1c = new VoterCertificate(Language.English, null, 0);
              v1c.CreateSelfSignature();
              v1c.AddSignature(intermediate, validUntil);

              var cs = new CertificateStorage();
              cs.AddRoot(root);
              var v1 = new VoterEntity(cs);

              IEnumerable<int> questionVota = new int[] { 0, 1 };

              var vote1 = v1.Vote(vs.GetVotingMaterial(), v1c, new IEnumerable<int>[] { questionVota }, null);

              vs.Vote(connection, vote1);

              int voters = 10;

              for (int i = 1000; i < 1000 + voters; i++)
              {
            var vc = new VoterCertificate(Language.English, null, 0);
            vc.CreateSelfSignature();
            vc.AddSignature(intermediate, validUntil);

            var vx = new VoterEntity(cs);

            IEnumerable<int> questionVota2 = new int[] { 0, 1 };
            var votex = vx.Vote(vs.GetVotingMaterial(), vc, new IEnumerable<int>[] { questionVota2 }, null);

            vs.Vote(connection, votex);
              }

              for (int i = 2000; i < 2000 + voters; i++)
              {
            var vc = new VoterCertificate(Language.English, null, 0);
            vc.CreateSelfSignature();
            vc.AddSignature(intermediate, validUntil);

            var vx = new VoterEntity(cs);

            IEnumerable<int> questionVota3 = new int[] { 1, 0 };
            var votex = vx.Vote(vs.GetVotingMaterial(), vc, new IEnumerable<int>[] { questionVota3 }, null);

            vs.Vote(connection, votex);
              }

              vs.EndVote();

              a1.TallyBegin(vs.GetVotingMaterial());
              a2.TallyBegin(vs.GetVotingMaterial());
              a3.TallyBegin(vs.GetVotingMaterial());
              a4.TallyBegin(vs.GetVotingMaterial());
              a5.TallyBegin(vs.GetVotingMaterial());

              for (int envelopeIndex = 0; envelopeIndex < vs.GetEnvelopeCount(); envelopeIndex++)
              {
            a1.TallyAdd(envelopeIndex, vs.GetEnvelope(envelopeIndex), new Progress(null));
            a2.TallyAdd(envelopeIndex, vs.GetEnvelope(envelopeIndex), new Progress(null));
            a3.TallyAdd(envelopeIndex, vs.GetEnvelope(envelopeIndex), new Progress(null));
            a4.TallyAdd(envelopeIndex, vs.GetEnvelope(envelopeIndex), new Progress(null));
            a5.TallyAdd(envelopeIndex, vs.GetEnvelope(envelopeIndex), new Progress(null));
              }

              var pd1 = a1.PartiallyDecipher();
              var pd2 = a2.PartiallyDecipher();
              var pd3 = a3.PartiallyDecipher();
              var pd4 = a4.PartiallyDecipher();
              var pd5 = a5.PartiallyDecipher();

              vs.DepositPartialDecipher(connection, pd1);
              vs.DepositPartialDecipher(connection, pd2);
              vs.DepositPartialDecipher(connection, pd3);
              vs.DepositPartialDecipher(connection, pd4);
              vs.DepositPartialDecipher(connection, pd5);

              v1.TallyBegin(vs.GetVotingMaterial(), BaseParameters.StandardProofCount);

              for (int envelopeIndex = 0; envelopeIndex < vs.GetEnvelopeCount(); envelopeIndex++)
              {
            v1.TallyAdd(envelopeIndex, vs.GetEnvelope(envelopeIndex), new Progress(null));
              }

              for (int authorityIndex = 1; authorityIndex < vs.Parameters.AuthorityCount + 1; authorityIndex++)
              {
            v1.TallyAddPartialDecipher(vs.GetPartialDecipher(authorityIndex));
              }

              var res1 = v1.TallyResult;

              TimeSpan duration = DateTime.Now.Subtract(start);
              Console.WriteLine("Succeded {0}", duration.ToString());
        }
Esempio n. 11
0
        private void TryLoadVoting()
        {
            string fileNameParameters = Path.Combine(Status.DataPath, SavedVotingParametersFileName);
              string fileNameAuthorities = Path.Combine(Status.DataPath, SavedVotingAuthoritiesFileName);

              if (File.Exists(fileNameParameters))
              {
            this.votingParameters = Serializable.Load<VotingParameters>(fileNameParameters);

            this.titleBox.Text = this.votingParameters.Title;
            this.descriptionBox.Text = this.votingParameters.Description;
            this.urlTextBox.Text = this.votingParameters.Url;
            this.votingFromPicker.Value = this.votingParameters.VotingBeginDate;
            this.votingUntilPicker.Value = this.votingParameters.VotingEndDate;
            this.groupComboBox.Value = Status.Groups.Where(group => group.Id == this.votingParameters.GroupId).FirstOrDefault();

            foreach (Question question in this.votingParameters.Questions)
            {
              Question newQuestion = new Question(question.Text, question.Description, question.Url, question.MaxVota);
              question.Options
            .Where(option => option.Text.Get(Language.English) != LibraryResources.OptionAbstainEnglish &&
                             option.Text.Get(Language.English) != LibraryResources.OptionAbstainSpecial)
            .Foreach(option => newQuestion.AddOption(option));

              ListViewItem item = new ListViewItem(question.Text.AllLanguages);
              item.SubItems.Add(question.Description.AllLanguages);
              item.Tag = newQuestion;
              this.questionListView.Items.Add(item);
            }
              }

              if (File.Exists(fileNameAuthorities))
              {
            VotingAuthoritiesFile authoritiesFile = Serializable.Load<VotingAuthoritiesFile>(fileNameAuthorities);

            if (this.authorityIndices[this.authority0List].ContainsKey(authoritiesFile.AuthorityIds.ElementAt(0)))
            {
              this.authority0List.SelectedIndex = this.authorityIndices[this.authority0List][authoritiesFile.AuthorityIds.ElementAt(0)];
            }

            if (this.authorityIndices[this.authority1List].ContainsKey(authoritiesFile.AuthorityIds.ElementAt(1)))
            {
              this.authority1List.SelectedIndex = this.authorityIndices[this.authority1List][authoritiesFile.AuthorityIds.ElementAt(1)];
            }

            if (this.authorityIndices[this.authority2List].ContainsKey(authoritiesFile.AuthorityIds.ElementAt(2)))
            {
              this.authority2List.SelectedIndex = this.authorityIndices[this.authority2List][authoritiesFile.AuthorityIds.ElementAt(2)];
            }

            if (this.authorityIndices[this.authority3List].ContainsKey(authoritiesFile.AuthorityIds.ElementAt(3)))
            {
              this.authority3List.SelectedIndex = this.authorityIndices[this.authority3List][authoritiesFile.AuthorityIds.ElementAt(3)];
            }

            if (this.authorityIndices[this.authority4List].ContainsKey(authoritiesFile.AuthorityIds.ElementAt(4)))
            {
              this.authority4List.SelectedIndex = this.authorityIndices[this.authority4List][authoritiesFile.AuthorityIds.ElementAt(4)];
            }
              }

              SetEnable(true);
        }