예제 #1
0
        private BiometricData GetDemographics(ulong id, List <Face> Results)
        {
            if (TestMode)
            {
                var confidence = _rnd.NextDouble();
                var result     = new BiometricData()
                {
                    Age              = _rnd.Next(10, 90),
                    Gender           = (_rnd.NextDouble() <= 0.3) ? Gender.Male : Gender.Female,
                    GenderConfidence = (confidence < 0.5) ? 0.5 : confidence,
                    TrackingId       = id
                };

                return(result);
            }
            else
            {
                if (Results.Count() > 0)
                {
                    var demographic = new BiometricData();
                    demographic.TrackingId       = id;
                    demographic.Age              = Results[0].Age;
                    demographic.Gender           = Results[0].Gender.ToUpper().Contains("F") ? Gender.Female : Gender.Male;
                    demographic.GenderConfidence = Results[0].GenderConfidence;
                    demographic.FaceMatch        = Results[0].MatchResult;
                    demographic.FaceID           = Results[0].Name;

                    return(demographic);
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #2
0
        private void CheckValues(
            BiometricData bd,
            TypeOfBiometricData dataType,
            AlgorithmIdentifier algID,
            Asn1OctetString dataHash,
            DerIA5String sourceDataURI)
        {
            if (!bd.TypeOfBiometricData.Equals(dataType))
            {
                Fail("types don't match.");
            }

            if (!bd.HashAlgorithm.Equals(algID))
            {
                Fail("hash algorithms don't match.");
            }

            if (!bd.BiometricDataHash.Equals(dataHash))
            {
                Fail("hash algorithms don't match.");
            }

            if (sourceDataURI != null)
            {
                if (!bd.SourceDataUri.Equals(sourceDataURI))
                {
                    Fail("data uris don't match.");
                }
            }
            else if (bd.SourceDataUri != null)
            {
                Fail("data uri found when none expected.");
            }
        }
        private BiometricData GetBiometryData(PersonnelMachine machineperson)
        {
            var bio = new BiometricData();

            bio.Date             = DateTime.Now;
            bio.PersonnelMachine = machineperson;
            bio.BiometricDataTimes.Add(new BiometricDataTime
            {
                TimeIn  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 7, 30, 20),
                TimeOut = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 30, 10),
            });


            bio.BiometricDataTimes.Add(new BiometricDataTime
            {
                TimeIn  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 00, 20),
                TimeOut = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, 0, 0),
            });


            bio.BiometricDataTimes.Add(new BiometricDataTime
            {
                TimeIn  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 15, 20),
                TimeOut = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 45, 1),
            });

            bio.BiometricDataTimes.Add(new BiometricDataTime
            {
                TimeIn  = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, 59, 58),
                TimeOut = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.AddDays(1).Day, 1, 0, 0),
            });

            return(bio);
        }
예제 #4
0
        public override void PerformTest()
        {
            TypeOfBiometricData dataType      = new TypeOfBiometricData(TypeOfBiometricData.HandwrittenSignature);
            AlgorithmIdentifier hashAlgorithm = new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1, DerNull.Instance);
            Asn1OctetString     dataHash      = new DerOctetString(GenerateHash());
            BiometricData       bd            = new BiometricData(dataType, hashAlgorithm, dataHash);

            CheckConstruction(bd, dataType, hashAlgorithm, dataHash, null);

            DerIA5String dataUri = new DerIA5String("http://test");

            bd = new BiometricData(dataType, hashAlgorithm, dataHash, dataUri);

            CheckConstruction(bd, dataType, hashAlgorithm, dataHash, dataUri);

            bd = BiometricData.GetInstance(null);

            if (bd != null)
            {
                Fail("null GetInstance() failed.");
            }

            try
            {
                BiometricData.GetInstance(new object());

                Fail("GetInstance() failed to detect bad object.");
            }
            catch (ArgumentException)
            {
                // expected
            }
        }
예제 #5
0
 public PlayerBiometrics(BiometricData Data)
 {
     LastSeen              = DateTime.Now;
     this.ActivelyTracked  = true;
     _biometricDataSamples = new List <BiometricData>();
     _biometricDataSamples.Add(Data);
     TrackingID = Data.TrackingId;
 }
예제 #6
0
 protected virtual void OnPlayerIdentified(BiometricData e)
 {
     // Note the use of a temporary variable here to make the event raisin
     // thread-safe; may or may not be necessary in your case.
     var evt = this.PlayerIdentified;
     if (evt != null)
         evt(this, e);
 }
예제 #7
0
 void _demographicsService_DemographicsReceived(object sender, BiometricData e)
 {
     if (_missingDemographicData)
     {
         if (e.TrackingId == _missingUsersTrackingID)
         {
             SelectContentBasedOnDemographics(e);
         }
     }
 }
예제 #8
0
        protected virtual void OnPlayerIdentified(BiometricData e)
        {
            // Note the use of a temporary variable here to make the event raisin
            // thread-safe; may or may not be necessary in your case.
            var evt = this.PlayerIdentified;

            if (evt != null)
            {
                evt(this, e);
            }
        }
예제 #9
0
 public async Task <IActionResult> CreateBiometric([FromBody] BiometricData bioData)
 {
     try
     {
         await _BiometricService.CreateBiometric(bioData);
     }
     catch (Exception)
     {
         return(BadRequest());
     }
     return(NoContent());
 }
예제 #10
0
        internal byte[] Serialize()
        {
            int birsize = Marshal.SizeOf(typeof(bioapi_bir));

            byte[]   birBytes = new byte[birsize + BiometricData.Length];
            GCHandle gcheader = GCHandle.Alloc(birBytes, GCHandleType.Pinned);

            Marshal.StructureToPtr(bir_, gcheader.AddrOfPinnedObject(), false);
            gcheader.Free();
            BiometricData.CopyTo(birBytes, birsize);
            return(birBytes);
        }
예제 #11
0
 private void InitializeRecord()
 {
     Sharrief               = new BiometricData();
     Majid                  = new BiometricData();
     Sharrief.Name          = "Sharrief";
     Sharrief.TestSubject   = 1;
     Sharrief.SpeedOfBlinks = new List <List <List <double> > >();
     Sharrief.AccelOfBlinks = new List <List <List <double> > >();
     Majid.Name             = "Majid";
     Majid.TestSubject      = 2;
     Majid.SpeedOfBlinks    = new List <List <List <double> > >();
     Majid.AccelOfBlinks    = new List <List <List <double> > >();
     Record.Add(Sharrief, Majid);
 }
예제 #12
0
        public void BiometricService_CreateBiometric_Test()
        {
            //arrange
            var biometricData = new BiometricData()
            {
                username = "******",
                height   = "6.0",
                weight   = "152",
                sex      = "M",
                dob      = "1995/04/23"
            };
            //act
            var result = mockBiometricService.Object.CreateBiometric(biometricData);

            //assert
            Assert.True(result.IsCompletedSuccessfully);
        }
예제 #13
0
        static void DAnalyze(BiometricData Unknown, BiometricData Rec)
        {
            Process Analyze = new Process();

            Analyze.StartInfo.FileName               = "DataAnalyzer.exe";
            Analyze.StartInfo.Arguments              = "/c " + Unknown.ToString() + " " + Rec.ToString(); // Note the /c command (*)
            Analyze.StartInfo.UseShellExecute        = false;
            Analyze.StartInfo.RedirectStandardOutput = true;
            Analyze.StartInfo.RedirectStandardError  = true;
            Analyze.Start();
            //* Read the output (or the error)
            string output = Analyze.StandardOutput.ReadToEnd();
            ///// Returns True or False for if data mattches///
            string Err = Analyze.StandardError.ReadToEnd();

            TOPRINT += Err + Environment.NewLine;
            Analyze.WaitForExit();
        }
예제 #14
0
        void _interactionService_KioskStateChanged(object sender, KioskStateEventArgs e)
        {
            if (e.KioskState == "Tracking")
            {
                if (_currentZone != e.CurrentZone || _currentUserTrackingID != e.TrackingID)
                {
                    //remember the last state we had before selecting content.
                    MediaContentState      = "Normal";
                    _currentZone           = e.CurrentZone;
                    _currentUserTrackingID = e.TrackingID;

                    DisplayZoneName = _currentZone;
                    if (e.Demographics == null)
                    {
                        _missingDemographicData = true;
                        _missingUsersTrackingID = e.TrackingID;
                    }
                    else
                    {
                        _missingDemographicData = false;
                    }

                    if (e.Demographics != null)
                    {
                        Debug.Print("Demographics during Kiosk State Change " + e.Demographics.Gender.ToString());
                    }

                    _demographics = e.Demographics;
                    SelectContentBasedOnDemographics(e.Demographics);
                    OnActivated();
                }
            }
            else if (e.KioskState == NOTRACK)
            {
                _currentZone    = NOTRACK;
                DisplayZoneName = _currentZone;
                SelectContentBasedOnDemographics(null);
                OnActivated();
            }
            else
            {
                OnDeactivated();
            }
        }
        static void DAnalyze(BiometricData Unknown)
        {
            Process Analyze = new Process();

            Analyze.StartInfo.FileName               = "cmd.exe";
            Analyze.StartInfo.Arguments              = "/c DIR"; // Note the /c command (*)
            Analyze.StartInfo.UseShellExecute        = false;
            Analyze.StartInfo.RedirectStandardOutput = true;
            Analyze.StartInfo.RedirectStandardError  = true;
            Analyze.Start();
            //* Read the output (or the error)
            string output = Analyze.StandardOutput.ReadToEnd();

            Console.WriteLine(output);
            string err = Analyze.StandardError.ReadToEnd();

            Console.WriteLine(err);
            Analyze.WaitForExit();
        }
예제 #16
0
        private void CheckConstruction(
            BiometricData bd,
            TypeOfBiometricData dataType,
            AlgorithmIdentifier hashAlgorithm,
            Asn1OctetString dataHash,
            DerIA5String dataUri)
        {
            CheckValues(bd, dataType, hashAlgorithm, dataHash, dataUri);

            bd = BiometricData.GetInstance(bd);

            CheckValues(bd, dataType, hashAlgorithm, dataHash, dataUri);

            Asn1Sequence seq = (Asn1Sequence)Asn1Object.FromByteArray(bd.ToAsn1Object().GetEncoded());

            bd = BiometricData.GetInstance(seq);

            CheckValues(bd, dataType, hashAlgorithm, dataHash, dataUri);
        }
예제 #17
0
        public async Task CreateBiometric(BiometricData cbd)
        {
            var biometric = new Biometric()
            {
                height = double.Parse(cbd.height),
                weight = double.Parse(cbd.weight),
                Date   = DateTime.Now,
                sex    = char.Parse(cbd.sex),
                dob    = DateTime.Parse(cbd.dob),
            };

            try
            {
                await _bio.CreateBiometricData(biometric, cbd.username);
            }
            catch (Exception e)
            {
                throw new CustomException("Error at creating biometric service" + e);
            }
        }
예제 #18
0
        void _biometricSampling_PlayerIdentified(object sender, BiometricData e)
        {
            Dispatcher.Invoke(() =>
            {
                var output = string.Format("\r\n" + "{6} @ " + DateTime.Now.ToLongTimeString() + " > Gender: {0} - Age: {1} - Confidence: {2} - Id: {3} Match: {4} FaceID: {5}",
                                           e.Gender.ToString(),
                                           e.Age,
                                           e.GenderConfidence,
                                           e.TrackingId,
                                           e.FaceMatch,
                                           e.FaceID,
                                           e.TrackingState);
                textLog.Text += output;

                if (e.FaceImage != null)
                {
                    _currentPlayImage = e.FaceImage;
                    face.Source       = ToBitmapImage(e.FaceImage);
                }
            });
        }
예제 #19
0
        private void RaiseDemographicsEvent(BiometricData payload)
        {
            var handler = this.DemographicsReceived;

            if (handler != null && payload != null)
            {
                handler(this, payload);


                //This code is only for situations where you want the app to remember the user. It requires that we perform face recoginition
                UserExperienceContext uec = new UserExperienceContext();
                uec.Age    = payload.Age;
                uec.Gender = payload.Gender;
                uec.FaceID = payload.FaceID;

                uec.InteractionCount = 1;

                if (payload.FaceMatch)
                {
                    //Find out if we've already seen this person
                    var orginalUser = (from users in _userExperiences where users.FaceID == payload.FaceID select users).FirstOrDefault();

                    if (orginalUser == null)
                    {
                        uec.TrackingId = payload.TrackingId;
                        _userExperiences.Add(uec);
                    }
                    else
                    {
                        orginalUser.TrackingId = payload.TrackingId;
                        orginalUser.InteractionCount++;
                    }
                }
                else
                {
                    uec.TrackingId = payload.TrackingId;
                    _userExperiences.Add(uec);
                }
            }
        }
예제 #20
0
        private BiometricData GetDemographics(ulong id, List <NEC.MAFunc.Wrapper.Face> Results)
        {
            if (Properties.Settings.Default.TestMode)
            {
                var confidence = _rnd.NextDouble();
                var result     = new BiometricData()
                {
                    Age              = _rnd.Next(10, 90),
                    Gender           = (_rnd.NextDouble() <= 0.3) ? Gender.Male : Gender.Female,
                    GenderConfidence = (confidence < 0.5) ? 0.5 : confidence,
                    TrackingId       = id
                };

                return(result);
            }
            else
            {
                if (Results.Count() > 0)
                {
                    var demographic = new BiometricData();
                    demographic.TrackingId       = id;
                    demographic.Age              = Results[0].Age;
                    demographic.Gender           = Results[0].Gender.ToUpper().Contains("F") ? Gender.Female : Gender.Male;
                    demographic.GenderConfidence = Results[0].GenderConfidence;
                    demographic.FaceMatch        = Results[0].MatchResult;
                    demographic.FaceID           = Results[0].Name;
                    demographic.FaceConfidence   = Results[0].FaceExtractInfo.FaceConfidence;
                    demographic.FrontalFaceScore = Results[0].FaceExtractInfo.FrontalFaceScore;
                    demographic.HeadConfidence   = Results[0].FaceExtractInfo.HeadConfidence;
                    return(demographic);
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #21
0
파일: Program.cs 프로젝트: Arsslensoft/ALFX
        static void Main(string[] args)
        {
            PolicyInformation[] certPolicies = new PolicyInformation[2];
            certPolicies[0] = new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.2.1.11.5"));
            certPolicies[1] = new PolicyInformation(new DerObjectIdentifier("2.16.840.1.101.2.1.11.18"));

            var randomGenerator      = new CryptoApiRandomGenerator();
            var random               = new SecureRandom(randomGenerator);
            var certificateGenerator = new X509V3CertificateGenerator();
            //serial
            var serialNumber =
                BigIntegers.CreateRandomInRange(
                    BigInteger.One, BigInteger.ValueOf(Int64.MaxValue), random);

            certificateGenerator.SetSerialNumber(serialNumber);
            // sig alg

            const string signatureAlgorithm = "SHA1WithRSA";

            certificateGenerator.SetSignatureAlgorithm(signatureAlgorithm);

            // Subjects
            //   Time x = new Time();
            var subjectDN = new X509Name("CN=localhost, O=Arsslensoft, C=TN,surname=Idadi,givenname=Arsslen, uniqueidentifier=15002060,businesscategory=Production,initials=Hello, gender=male, placeofbirth=El Manar, pseudonym=Arsslinko, postaladdress=2076, countryofcitizenship=TN, countryofresidence=TN,telephonenumber=53299093");
            var issuerDN  = subjectDN;

            certificateGenerator.SetIssuerDN(issuerDN);
            certificateGenerator.SetSubjectDN(subjectDN);

            // Validity
            var notBefore = DateTime.UtcNow.Date.Subtract(new TimeSpan(5, 0, 0));
            var notAfter  = notBefore.AddYears(2);

            certificateGenerator.SetNotBefore(notBefore);
            certificateGenerator.SetNotAfter(notAfter);

            // PKEY
            const int strength = 512;
            var       keyGenerationParameters = new KeyGenerationParameters(random, strength);

            //  var x=    new Al.Security.Crypto.Generators.DsaKeyPairGenerator();
            // X9ECParameters ecP = NistNamedCurves.GetByName("B-571");
            // ECDomainParameters ecSpec = new ECDomainParameters(ecP.Curve, ecP.G, ecP.N, ecP.H, ecP.GetSeed());
            // ECKeyPairGenerator keyPairGenerator = new ECKeyPairGenerator("ECDSA");
            // //ECPA par = new DsaParametersGenerator();
            // //par.Init(2048, 100, random);
            // //ECKeyGenerationParameters pa = new ECKeyGenerationParameters(random, par.GenerateParameters());
            ////  var keyPairGenerator = new DHKeyPairGenerator();
            //  //DsaParametersGenerator par = new DsaParametersGenerator();
            //  //par.Init(2048, 100, random);
            //  //DsaKeyGenerationParameters pa = new DsaKeyGenerationParameters(random, par.GenerateParameters());
            // // keyPairGenerator.Init(pa);
            // keyPairGenerator.Init(new ECKeyGenerationParameters(ecSpec, new SecureRandom()));
            //var keyPairGenerator = new DsaKeyPairGenerator();
            //DsaParametersGenerator par = new DsaParametersGenerator();
            //par.Init(1024, 100, random);
            //DsaKeyGenerationParameters pa = new DsaKeyGenerationParameters(random, par.GenerateParameters());
            //keyPairGenerator.Init(pa);
            //   KeyPair = keyPairGenerator.GenerateKeyPair();

            var keyPairGenerator = new RsaKeyPairGenerator();

            keyPairGenerator.Init(keyGenerationParameters);
            StreamReader            str     = new StreamReader("D:\\test.key");
            PemReader               pem     = new PemReader(str);
            AsymmetricCipherKeyPair keypair = (AsymmetricCipherKeyPair)pem.ReadObject();
            var subjectKeyPair = keypair;

            str.Close();
            certificateGenerator.SetPublicKey(subjectKeyPair.Public);

            // ext
            X509Extensions

            certificateGenerator.AddExtension(X509Extensions.SubjectKeyIdentifier, false,
                                              new SubjectKeyIdentifierStructure(subjectKeyPair.Public));

            certificateGenerator.AddExtension(X509Extensions.AuthorityKeyIdentifier, false, new AuthorityKeyIdentifierStructure(subjectKeyPair.Public));
            certificateGenerator.AddExtension(X509Extensions.BasicConstraints, false, new BasicConstraints(false));
            // key usage
            certificateGenerator.AddExtension(
                X509Extensions.KeyUsage,
                true,
                new KeyUsage(KeyUsage.KeyAgreement | KeyUsage.DataEncipherment | KeyUsage.DigitalSignature));
            // extended key usage
            var usages = new[] { KeyPurposeID.IdKPServerAuth, KeyPurposeID.IdKPClientAuth };
            ExtendedKeyUsage extendedKeyUsage = new ExtendedKeyUsage(usages);

            certificateGenerator.AddExtension(X509Extensions.ExtendedKeyUsage, false, extendedKeyUsage);
            // Test Policy

            DerSequence seq = CreatePolicyInformationsSequence("http://www.arsslensoft.com", "Arsslensoft", "1.3.6.1.4.1.23823.1.1.1", "Test Notice");

            //  certificateGenerator.AddExtension(X509Extensions.CertificatePolicies, false, new DerSequence(certPolicies));

            // Authority access
            List <GeneralSubtree> ees = new List <GeneralSubtree>();

            ees.Add(new GeneralSubtree(new GeneralName(GeneralName.UniformResourceIdentifier, "http://www.google.com")));
            certificateGenerator.AddExtension(X509Extensions.NameConstraints, true, new NameConstraints(null, ees));

            certificateGenerator.AddExtension(X509Extensions.NetscapeComment, true, new DerVisibleString("NS COMMENT"));
            certificateGenerator.AddExtension(X509Extensions.NetscapeBaseUrl, true, new DerIA5String("http://www.google.com"));
            certificateGenerator.AddExtension(X509Extensions.InhibitAnyPolicy, true, new DerInteger(12));
// Policy constraints
            byte inhibit   = 12;
            byte explicitc = 12;

            //   certificateGenerator.AddExtension(X509Extensions.PolicyConstraints, false, new DerOctetSequence(new byte[] { 128, 1, explicitc, 129, 1, inhibit }));
            certificateGenerator.AddExtension(X509Extensions.NetscapeCertUsage, false, new KeyUsage(KeyUsage.KeyAgreement));

            certificateGenerator.AddExtension(X509Extensions.AuthorityInfoAccess, false, CreateAuthorityAccessInformationSequence("http://www.arsslensoft.com", null));
            // Subhect Issuer Alternative name
            GeneralName  altName        = new GeneralName(GeneralName.DnsName, "localhost");
            GeneralNames subjectAltName = new GeneralNames(altName);

            certificateGenerator.AddExtension(X509Extensions.IssuerAlternativeName, false, subjectAltName);
            certificateGenerator.AddExtension(X509Extensions.SubjectAlternativeName, false, subjectAltName);
            //   certificateGenerator.AddExtension(new DerObjectIdentifier("2.16.840.1.11730.29.53"), false, subjectAltName);
            //

            GeneralNames s;

            //CRL Distribution Points
            DistributionPointName distPointOne = new DistributionPointName(new GeneralNames(
                                                                               new GeneralName(GeneralName.UniformResourceIdentifier, "http://crl.somewebsite.com/master.crl")));
            GeneralNames gns = new GeneralNames(new GeneralName[] {
                new GeneralName(GeneralName.UniformResourceIdentifier, "ldap://crl.somewebsite.com/cn%3dSecureCA%2cou%3dPKI%2co%3dCyberdyne%2cc%3dUS?certificaterevocationlist;binary"), new GeneralName(GeneralName.Rfc822Name, "Arslen")
            });
            DistributionPointName distPointTwo = new DistributionPointName(gns);

            DistributionPoint[] distPoints = new DistributionPoint[2];
            distPoints[0] = new DistributionPoint(distPointOne, null, null);
            distPoints[1] = new DistributionPoint(distPointTwo, null, gns);

            IssuingDistributionPoint iss = new IssuingDistributionPoint(distPointOne, false, true, null, false, false);

            certificateGenerator.AddExtension(X509Extensions.IssuingDistributionPoint, false, iss);

            certificateGenerator.AddExtension(X509Extensions.CrlDistributionPoints, false, new CrlDistPoint(distPoints));

            // Biometric
            Asn1EncodableVector v = new Asn1EncodableVector();

            BiometricData bdat = new BiometricData(new TypeOfBiometricData(TypeOfBiometricData.HandwrittenSignature), new AlgorithmIdentifier(new DerObjectIdentifier("1.3.14.3.2.26")), new DerOctetString(new byte[] { 169, 74, 143, 229, 204, 177, 155, 166, 28, 76, 8, 115, 211, 145, 233, 135, 152, 47, 187, 211 }), new DerIA5String("http://www.google.com"));

            v.Add(bdat);
            v.Add(new BiometricData(new TypeOfBiometricData(TypeOfBiometricData.HandwrittenSignature), new AlgorithmIdentifier(new DerObjectIdentifier("1.3.14.3.2.26")), new DerOctetString(new byte[] { 169, 74, 143, 229, 204, 177, 155, 166, 28, 76, 8, 115, 211, 145, 233, 135, 152, 47, 187, 211 }), new DerIA5String("http://www.google.co")));
            certificateGenerator.AddExtension(X509Extensions.BiometricInfo, false, new DerSequenceOf(v));

            QCStatement st = new QCStatement(Rfc3739QCObjectIdentifiers.IdQcs);

            certificateGenerator.AddExtension(X509Extensions.QCStatements, false, st);
            //Al.Security.Pkcs.Pkcs10CertificationRequest c = new Al.Security.Pkcs.Pkcs10CertificationRequest(
            //certificateGenerator.AddExtension(X509Extensions.ReasonCode, false, ce);
            // test done
            certificateGenerator.AddExtension(X509Extensions.SubjectInfoAccess, false, CreateAuthorityAccessInformationSequence("http://www.arsslensoft.com", null));
            //// 2
            //TargetInformation ti = new Al.Security.Asn1.X509.TargetInformation(new Target[] { new Target(Target.Choice.Name, new GeneralName(GeneralName.UniformResourceIdentifier, "http://www.go.com")) });
            //certificateGenerator.AddExtension(X509Extensions.TargetInformation, false, new DerSequence(ti));
            // 3
            PrivateKeyUsagePeriod kup = new PrivateKeyUsagePeriod(DateTime.Now, DateTime.Now.AddYears(2));

            certificateGenerator.AddExtension(X509Extensions.PrivateKeyUsagePeriod, false, new DerSequence(kup));


            //generate
            var issuerKeyPair = subjectKeyPair;
            var certificate   = certificateGenerator.Generate(issuerKeyPair.Private, random);


            StreamWriter wstr      = new StreamWriter(Path.ChangeExtension("D:\\test.crt", ".pem"), false);
            PemWriter    pemWriter = new PemWriter(wstr);

            pemWriter.WriteObject(certificate);
            pemWriter.WriteObject(issuerKeyPair.Private);

            wstr.Flush();
            wstr.Close();

            //   System.Security.Cryptography.X509Certificates.X509Certificate x509_ = DotNetUtilities.ToX509Certificate(certificate.CertificateStructure);

            //File.WriteAllBytes(@"D:\\test.crt",   x509_.Export(System.Security.Cryptography.X509Certificates.X509ContentType.Pkcs12));
        }
예제 #22
0
        private void SelectContentBasedOnDemographics(BiometricData currentUser, string itemSelected = null)
        {
            bool hasContent = false;

            if (string.IsNullOrEmpty(itemSelected))
            {
                if (currentUser == null)
                {
                    hasContent = _contentManagement.LoadContents(_currentZone);
                }
                else
                {
                    hasContent = _contentManagement.LoadContents(_currentZone, (m) => { return((currentUser.Age >= m.Age && currentUser.Age < m.MaxAge) && m.Gender.ToString().ToLower() == currentUser.Gender.ToString().ToLower()); });
                }
            }
            else
            {
                if (currentUser == null)
                {
                    hasContent = _contentManagement.LoadContents(itemSelected);
                }
                else
                {
                    hasContent = _contentManagement.LoadContents(itemSelected, (m) => { return((currentUser.Age >= m.Age && currentUser.Age < m.MaxAge) && m.Gender.ToString().ToLower() == currentUser.Gender.ToString().ToLower()); });
                }
            }

            if (hasContent)
            {
                if (!IsVideoPlaying)
                {
                    MediaSource = _contentManagement.MoveNext().ContentPath;
                }
            }
            else
            {
                ConfigurationProvider cp = new ConfigurationProvider();
                IConfigSettings       cs = cp.Load();
                if (string.IsNullOrEmpty(itemSelected))
                {
                    if (currentUser == null)
                    {
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1}", cs.RootContentDirectory, _currentZone);
                    }
                    else
                    {
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1} for {2}yo {3}", cs.RootContentDirectory, _currentZone, currentUser.Age.ToString(), currentUser.Gender.ToString());
                    }
                }
                else
                {
                    if (currentUser == null)
                    {
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1}", cs.RootContentDirectory, itemSelected);
                    }
                    else
                    {
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1} for {2}yo {3}", cs.RootContentDirectory, itemSelected, currentUser.Age.ToString(), currentUser.Gender.ToString());
                    }
                }
            }
        }
예제 #23
0
 public void Add(BiometricData BiometricSample)
 {
     LastSeen = DateTime.Now;
     this.ActivelyTracked = true;
     _biometricDataSamples.Add(BiometricSample);
 }
예제 #24
0
 public PlayerBiometrics(BiometricData Data)
 {
     LastSeen = DateTime.Now;
     this.ActivelyTracked = true;
     _biometricDataSamples = new List<BiometricData>();
     _biometricDataSamples.Add(Data);
     TrackingID = Data.TrackingId;
 }
예제 #25
0
        private BiometricData GetDemographics(ulong id, List<NEC.MAFunc.Wrapper.Face> Results)
        {
            if (Properties.Settings.Default.TestMode)
            {
                var confidence = _rnd.NextDouble();
                var result = new BiometricData()
                {
                    Age = _rnd.Next(10, 90),
                    Gender = (_rnd.NextDouble() <= 0.3) ? Gender.Male : Gender.Female,
                    GenderConfidence = (confidence < 0.5) ? 0.5 : confidence,
                    TrackingId = id
                };

                return result;
            }
            else
            {

                if (Results.Count() > 0)
                {
                    var demographic = new BiometricData();
                    demographic.TrackingId = id;
                    demographic.Age = Results[0].Age;
                    demographic.Gender = Results[0].Gender.ToUpper().Contains("F") ? Gender.Female : Gender.Male;
                    demographic.GenderConfidence = Results[0].GenderConfidence;
                    demographic.FaceMatch = Results[0].MatchResult;
                    demographic.FaceID = Results[0].Name;
                    demographic.FaceConfidence = Results[0].FaceExtractInfo.FaceConfidence;
                    demographic.FrontalFaceScore = Results[0].FaceExtractInfo.FrontalFaceScore;
                    demographic.HeadConfidence = Results[0].FaceExtractInfo.HeadConfidence;
                    return demographic;
                }
                else
                {
                    return null;
                }
            }

        }
예제 #26
0
 public void Add(BiometricData BiometricSample)
 {
     LastSeen             = DateTime.Now;
     this.ActivelyTracked = true;
     _biometricDataSamples.Add(BiometricSample);
 }