Пример #1
0
        private EnrollmentResult Capturarimagen()
        {
            EnrollmentResult enrollmentResults = new EnrollmentResult();

            enrollmentResults.engineUser = _engine.Enroll(20000, out enrollmentResults.engineStatus);
            return(enrollmentResults);
        }
Пример #2
0
        private void doEnroll(object sender, DoWorkEventArgs args)
        {
            EnrollmentResult enrollmentResults = new EnrollmentResult();

            enrollmentResults.engineUser = _engine.Enroll(20000, out enrollmentResults.engineStatus);
            args.Result = enrollmentResults;
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         cleardatabase();
         RunWorkerCompletedEventArgs taskResult = BusyForm.RunLongTask("Waiting for fingerprint ...", new DoWorkEventHandler(doEnroll),
                                                                       false, null, new EventHandler(CancelScanningHandler));
         EnrollmentResult enrollmentResult = (EnrollmentResult)taskResult.Result;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
        async void OnAddUser(object sender, RoutedEventArgs args)
        {
            var securityPhrase = await this.oxfordClient.GetVerificationPhraseForUserAsync(
                this.UserToAdd);

            await this.ShowMessageDialogAsync(
                $"Please hit 'Close' and then repeat the phrase below{Environment.NewLine}" +
                $"\"{securityPhrase}\"",
                "Verification Needed");

            var enrollmentResult = new EnrollmentResult()
            {
                EnrollmentStatus = EnrollmentStatus.None
            };

            while (enrollmentResult.EnrollmentStatus != EnrollmentStatus.Enrolled)
            {
                try
                {
                    enrollmentResult = await this.oxfordClient.RecordAndEnrollUserAsync(
                        this.UserToAdd, TimeSpan.FromSeconds(10));
                }
                catch
                {
                }
                if (enrollmentResult.EnrollmentStatus != EnrollmentStatus.Enrolled)
                {
                    await this.ShowMessageDialogAsync(
                        "Can you please close the dialog and repeat it again for me?",
                        "More Training Needed");
                }
            }
            await this.ShowMessageDialogAsync(
                $"Ok {this.UserToAdd} you are registered",
                "registered");

            this.UserToAdd = string.Empty;
            this.BuildLaunchUsersAsync();
        }
Пример #5
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            RunWorkerCompletedEventArgs taskResult       = BusyForm.RunLongTask("Waiting for fingerprint ...", new DoWorkEventHandler(doEnroll), false, null, new EventHandler(CancelScanningHandler));
            EnrollmentResult            enrollmentResult = (EnrollmentResult)taskResult.Result;

            if (enrollmentResult.engineStatus == NffvStatus.TemplateCreated)
            {
                NffvUser engineUser = enrollmentResult.engineUser;
                string   userName   = "******";
                if (userName.Length <= 0)
                {
                    userName = engineUser.Id.ToString();
                }

                //_userDB.Add(new UserRecord(engineUser.Id, userName));
                try
                {
                    //_userDB.WriteToFile(_userDatabaseFile);
                }
                catch { }

                System.IntPtr a1;
                System.Windows.Forms.PictureBox po = new PictureBox();
                a1 = engineUser.GetHBitmap();


                //pbExtractedImage.Image = engineUser.GetBitmap();

                //lbDatabase.Items.Add(new CData(engineUser, userName));
                //lbDatabase.SelectedIndex = lbDatabase.Items.Count - 1;
            }
            else
            {
                NffvStatus engineStatus = enrollmentResult.engineStatus;
                //MessageBox.Show(string.Format("Enrollment was not finished. Reason: {0}", engineStatus));
            }
        }
Пример #6
0
        private void buttonEnroll_Click(object sender, EventArgs e)
        {
            try
            {
                //Init Acquisition Component
                InitAcquisition(ref GenericAcqComponent);

                //verify the checkbox of consolidation
                try
                {
                    GenericAcqComponent.Consolidation = checkBoxConsolidate.Checked;
                }
                catch (MethodNotImplementedException) { }
                catch (NullReferenceException) { }

                //Run Acquisition
                EnrollmentResult result = GenericAcqComponent.RunEnroll();

                if (result == null)
                {
                    return;
                }

                if ((result.Status != ErrorCodes.IED_NO_ERROR) && (result.Status != ErrorCodes.WARNING_BAD_QUALITY_ACCEPTED))
                {
                    return;
                }
                string info = "Quality Score: " + result.TemplateQuality + "." + Environment.NewLine;
                if (CurrentDeviceLayoutConfig.SecurityLevelSupported)
                {
                    string str = result.IsAdvancedSecurityLevelsCompatible ? "Yes" : "No";
                    info = info + "Advanced Security Level Compatible: " + str + ".";
                }
                MessageBox.Show(info,
                                "Acquisition info",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                if ((result.ImageList != null) && (checkBoxSaveBitmap.Checked))
                {
                    int index = 0;
                    if (checkBoxConsolidate.Checked)
                    {
                        index = result.BestImageIndex - 1;
                    }

                    SaveFingerPrint(
                        result.ImageList[index].Image as byte[],
                        result.ImageList[index].Width,
                        result.ImageList[index].Height);
                }

                if (checkBoxSaveTemplate.Checked)
                {
                    SaveTemplate(result.Template, result.TemplateFormat);
                    SaveTemplate(result.AdditionalFPTemplate, result.AdditionalFPTemplateFormat);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message,
                                exc.GetType().Name,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Пример #7
0
 private void timer1_Tick2()
 {
     enrollmentResult = Capturarimagen();
     clsNeur.Cerrar   = true;
 }
Пример #8
0
        public override EnrollmentResult Enroll(ICertificateDataReader certificateDataReader, string csr, string subject, Dictionary <string, string[]> san, EnrollmentProductInfo productInfo, CSS.PKI.PKIConstants.X509.RequestFormat requestFormat, RequestUtilities.EnrollmentType enrollmentType)
        {
            Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug);

            foreach (KeyValuePair <string, string> configEntry in productInfo.ProductParameters)
            {
                Logger.Trace($"{configEntry.Key}: {configEntry.Value}");
            }

            string[][] parameterKeys = new string[][] { };
            if (enrollmentType == RequestUtilities.EnrollmentType.New)
            {
                parameterKeys = new string[][] { new string[] { "Email", "string" },
                                                 new string[] { "FirstName", "string" },
                                                 new string[] { "LastName", "string" },
                                                 new string[] { "Phone", "string" },
                                                 new string[] { "CertificatePeriodInYears", "int" } }
            }
            ;
            else
            {
                parameterKeys = new string[][] { new string[] { "PriorCertSN", "string" } }
            };

            ValidateParameters <string>(productInfo.ProductParameters, parameterKeys);

            POSTCertificateEnrollmentResponse enrollmentResponse = new POSTCertificateEnrollmentResponse();

            try
            {
                switch (enrollmentType)
                {
                case RequestUtilities.EnrollmentType.New:
                    switch (productInfo.ProductID)
                    {
                    case "DV_SSL":
                    case "DV_WILDCARD_SSL":
                    case "UCC_DV_SSL":
                        enrollmentResponse = EnrollDV(productInfo, csr, san);
                        break;

                    case "OV_SSL":
                    case "OV_CS":
                    case "OV_DS":
                    case "OV_WILDCARD_SSL":
                    case "UCC_OV_SSL":
                        enrollmentResponse = EnrollOV(productInfo, csr, san);
                        break;

                    case "EV_SSL":
                    case "UCC_EV_SSL":
                        enrollmentResponse = EnrollEV(productInfo, csr, san);
                        break;

                    default:
                        return(new EnrollmentResult {
                            Status = 30, StatusMessage = $"Error attempting to enroll certificate {subject}: Invalid Product ID - {productInfo.ProductID}."
                        });
                    }

                    break;

                case RequestUtilities.EnrollmentType.Renew:
                case RequestUtilities.EnrollmentType.Reissue:
                    CAConnectorCertificate certificate = certificateDataReader.GetCertificateRecord(DataConversion.HexToBytes(productInfo.ProductParameters["PriorCertSN"]));
                    enrollmentResponse = RenewReissue(certificate.CARequestID, productInfo, csr, san, enrollmentType == RequestUtilities.EnrollmentType.Renew);
                    break;

                default:
                    return(new EnrollmentResult {
                        Status = 30, StatusMessage = $"Unsupported EnrollmentType: {enrollmentType}"
                    });
                }
            }
            catch (Exception ex)
            {
                return(new EnrollmentResult {
                    Status = 30, StatusMessage = $"Error attempting to enroll certificate {subject}: {ex.Message}."
                });
            }

            EnrollmentResult result = new EnrollmentResult();

            CertificateStatusEnum certStatus = CertificateStatusEnum.PENDING_ISSUANCE;

            for (int i = 0; i < _enrollmentRetries; i++)
            {
                try
                {
                    GETCertificateDetailsResponse certResponse = JsonConvert.DeserializeObject <GETCertificateDetailsResponse>(_api.GetCertificate(enrollmentResponse.certificateId));
                    Enum.TryParse(certResponse.status, out certStatus);
                    if (certStatus == CertificateStatusEnum.ISSUED)
                    {
                        break;
                    }
                }
                catch (Exception) { }

                Thread.Sleep(_secondsBetweenEnrollmentRetries * 1000);
            }

            string pemCertificate = certStatus == CertificateStatusEnum.ISSUED ? RemovePEMHeader(JsonConvert.DeserializeObject <GETCertificateResponse>(_api.DownloadCertificate(enrollmentResponse.certificateId)).pems.certificate) : string.Empty;

            Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug);

            return(new EnrollmentResult {
                CARequestID = enrollmentResponse.certificateId,
                Certificate = pemCertificate,
                Status = APIProcessor.MapReturnStatus(certStatus),
                StatusMessage = $"GoDaddy Status = {certStatus.ToString()}"
            });
        }