Пример #1
0
        public static void TestSignatureRequestDocument()
        {
            VoterCertificate voterCert = new VoterCertificate(Language.English, null, 0);
              voterCert.CreateSelfSignature();
              SignatureRequest request = new SignatureRequest("Hans", "Müller", "*****@*****.**");
              SignatureRequestInfo requestInfo = new SignatureRequestInfo("*****@*****.**", request.Encrypt());

              SignatureRequestDocument document = new SignatureRequestDocument(request, voterCert, GetGroupName);

              ////PrintDialog dialog = new PrintDialog();
              ////dialog.Document = document;

              ////if (dialog.ShowDialog() == DialogResult.OK)
              ////{
              ////  document.Print();
              ////}
        }
Пример #2
0
        private void sendButton_Click(object sender, EventArgs e)
        {
            SetEnable(false);
              this.run = true;
              OnUpdateWizard();

              SignatureRequest signatureRequest
            = new SignatureRequest(
              this.firstNameTextBox.Text,
              this.familyNameTextBox.Text,
              this.emailAddressTextBox.Text);

              SignatureRequestInfo signatureRequestInfo
            = new SignatureRequestInfo(
              this.emailAddressTextBox.Text,
              signatureRequest.Encrypt());

              SignatureRequestDocument document = new SignatureRequestDocument(
            signatureRequest,
            Status.Certificate,
            Status.GetGroupName);

              SaveFileDialog dialog = new SaveFileDialog();
              dialog.Title = GuiResources.SaveDocumentDialogTitle;
              dialog.Filter = Files.PdfFileFilter;

              if (dialog.ShowDialog() == DialogResult.OK)
              {
            document.Create(dialog.FileName);

            Secure<SignatureRequest> secureSignatureRequest =
              new Secure<SignatureRequest>(signatureRequest, Status.CaCertificate, Status.Certificate);
            Secure<SignatureRequestInfo> secureSignatureRequestInfo =
              new Secure<SignatureRequestInfo>(signatureRequestInfo, Status.ServerCertificate, Status.Certificate);

            Status.VotingClient.SetSignatureRequest(secureSignatureRequest, secureSignatureRequestInfo, SetSignatureRequestComplete);

            while (this.run)
            {
              Status.UpdateProgress();
              Thread.Sleep(10);
            }

            Status.UpdateProgress();

            if (this.exception == null)
            {
              Status.SetMessage(Resources.CreateCertificateDone, MessageType.Success);
            }
            else
            {
              Status.SetMessage(this.exception.Message, MessageType.Error);
            }
              }
              else
              {
            SetEnable(true);
            this.run = false;
              }

              OnUpdateWizard();
        }