private void nextButton_Click(object sender, EventArgs e) { string fullName = string.Format("{0} {1}", this.firstNameTextBox.Text, this.familyNameTextBox.Text); var encryptResult = EncryptPrivateKeyDialog.ShowSetPassphrase(); if (encryptResult.First == DialogResult.OK) { string passphrase = encryptResult.Second; Status.Certificate = new VoterCertificate(Resources.Culture.ToLanguage(), passphrase, 0); Status.Certificate.CreateSelfSignature(); Status.Controller.AddAndSaveCertificate(Status.Certificate); Status.SignatureRequest = new SignatureRequest( this.firstNameTextBox.Text, this.familyNameTextBox.Text, this.emailAddressTextBox.Text); Status.SignatureRequestInfo = new SignatureRequestInfo (this.emailAddressTextBox.Text, Status.SignatureRequest.Encrypt()); Status.SignatureRequestFileName = Path.Combine(Status.Controller.Status.DataPath, Status.Certificate.Id.ToString() + Files.SignatureRequestDataExtension); Status.SignatureRequest.Save(Status.SignatureRequestFileName); Status.SignatureRequestInfoFileName = Path.Combine(Status.Controller.Status.DataPath, Status.Certificate.Id.ToString() + Files.SignatureRequestInfoExtension); Status.SignatureRequestInfo.Save(Status.SignatureRequestInfoFileName); var nextControl = new PrintAndUploadCertificateControl(); nextControl.Status = Status; OnShowNextControl(nextControl); } }
private void nextButton_Click(object sender, EventArgs e) { string fullName = string.Format("{0} {1}", this.firstNameTextBox.Text, this.familyNameTextBox.Text); VoterCertificate baseCertificate = this.baseCertificates[this.baseCertificateComboBox.SelectedIndex]; var encryptResult = EncryptPrivateKeyDialog.ShowSetPassphrase(); if (encryptResult.First == DialogResult.OK) { string passphrase = encryptResult.Second; Status.Certificate = new VoterCertificate(Resources.Culture.ToLanguage(), passphrase, this.groupComboBox.Value.Id); Status.Certificate.CreateSelfSignature(); if (DecryptPrivateKeyDialog.TryDecryptIfNessecary(baseCertificate, GuiResources.UnlockActionSignRequest)) { try { Status.Controller.AddAndSaveCertificate(Status.Certificate); Status.SignatureRequest = new SignatureRequest2( this.firstNameTextBox.Text, this.familyNameTextBox.Text, this.emailAddressTextBox.Text, baseCertificate); Status.SignatureRequestInfo = new SignatureRequestInfo( this.emailAddressTextBox.Text, Status.SignatureRequest.Encrypt()); Status.SignatureRequestFileName = Path.Combine(Status.Controller.Status.DataPath, Status.Certificate.Id.ToString() + Files.SignatureRequestDataExtension); Status.SignatureRequest.Save(Status.SignatureRequestFileName); Status.SignatureRequestInfoFileName = Path.Combine(Status.Controller.Status.DataPath, Status.Certificate.Id.ToString() + Files.SignatureRequestInfoExtension); Status.SignatureRequestInfo.Save(Status.SignatureRequestInfoFileName); } finally { baseCertificate.Lock(); } var nextControl = new PrintAndUploadCertificateControl(); nextControl.Status = Status; OnShowNextControl(nextControl); } } }