Пример #1
0
 public global::System.Collections.ICollection GetMatches(IX509Selector selector)
 {
     if (selector == null)
     {
         return((global::System.Collections.ICollection)Platform.CreateArrayList(_local));
     }
     global::System.Collections.IList       list       = Platform.CreateArrayList();
     global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)_local).GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             object current = enumerator.get_Current();
             if (selector.Match(current))
             {
                 list.Add(current);
             }
         }
         return((global::System.Collections.ICollection)list);
     }
     finally
     {
         global::System.IDisposable disposable = enumerator as global::System.IDisposable;
         if (disposable != null)
         {
             disposable.Dispose();
         }
     }
 }
Пример #2
0
        /// <summary>
        /// Finds the private keys matching the specified selector.
        /// </summary>
        /// <remarks>
        /// Searches the database for certificate records matching the selector, returning the
        /// private keys for each matching record.
        /// </remarks>
        /// <returns>The matching certificates.</returns>
        /// <param name="selector">The match selector or <c>null</c> to return all private keys.</param>
        public IEnumerable <AsymmetricKeyParameter> FindPrivateKeys(IX509Selector selector)
        {
            using (var command = GetSelectCommand(selector, false, true, PrivateKeyFields)) {
                var reader = command.ExecuteReader();

                try {
                    var parser = new X509CertificateParser();
                    var buffer = new byte[4096];

                    while (reader.Read())
                    {
                        var record = LoadCertificateRecord(reader, parser, ref buffer);

                        if (selector == null || selector.Match(record.Certificate))
                        {
                            yield return(record.PrivateKey);
                        }
                    }
                } finally {
#if COREFX
                    reader.Dispose();
#else
                    reader.Close();
#endif
                }
            }

            yield break;
        }
Пример #3
0
        /// <summary>
        /// Gets the private key based on the provided selector.
        /// </summary>
        /// <remarks>
        /// Gets the private key based on the provided selector.
        /// </remarks>
        /// <returns>The private key on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the private key.</param>
        protected override AsymmetricKeyParameter GetPrivateKey(IX509Selector selector)
        {
#if false
            // Note: GetPrivateKey() is only used by the base class implementations of Decrypt() and DecryptTo().
            // Since we override those methods, there is no use for this method.
            var store = new X509Store(StoreName.My, StoreLocation);

            store.Open(OpenFlags.ReadOnly);

            try {
                foreach (var certificate in store.Certificates)
                {
                    if (!certificate.HasPrivateKey)
                    {
                        continue;
                    }

                    var cert = GetBouncyCastleCertificate(certificate);

                    if (selector == null || selector.Match(cert))
                    {
                        var pair = CmsSigner.GetBouncyCastleKeyPair(certificate.PrivateKey);
                        return(pair.Private);
                    }
                }
            } finally {
                store.Close();
            }
#endif
            return(null);
        }
Пример #4
0
        /// <summary>
        /// Finds the certificate records matching the specified selector.
        /// </summary>
        /// <remarks>
        /// Searches the database for certificate records matching the selector, returning all
        /// of the matching records populated with the desired fields.
        /// </remarks>
        /// <returns>The matching certificate records populated with the desired fields.</returns>
        /// <param name="selector">The match selector or <c>null</c> to match all certificates.</param>
        /// <param name="trustedOnly"><c>true</c> if only trusted certificates should be returned.</param>
        /// <param name="fields">The desired fields.</param>
        public IEnumerable <X509CertificateRecord> Find(IX509Selector selector, bool trustedOnly, X509CertificateRecordFields fields)
        {
            using (var command = GetSelectCommand(selector, trustedOnly, false, fields | X509CertificateRecordFields.Certificate)) {
                var reader = command.ExecuteReader();

                try {
                    var parser = new X509CertificateParser();
                    var buffer = new byte[4096];

                    while (reader.Read())
                    {
                        var record = LoadCertificateRecord(reader, parser, ref buffer);

                        if (selector == null || selector.Match(record.Certificate))
                        {
                            yield return(record);
                        }
                    }
                } finally {
#if COREFX
                    reader.Dispose();
#else
                    reader.Close();
#endif
                }
            }

            yield break;
        }
Пример #5
0
        /// <summary>
        /// Gets the X.509 certificate based on the selector.
        /// </summary>
        /// <remarks>
        /// Gets the X.509 certificate based on the selector.
        /// </remarks>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override Org.BouncyCastle.X509.X509Certificate GetCertificate(IX509Selector selector)
        {
            foreach (StoreName storeName in Enum.GetValues(typeof(StoreName)))
            {
                if (storeName == StoreName.Disallowed)
                {
                    continue;
                }

                var store = new X509Store(storeName, StoreLocation);

                store.Open(OpenFlags.ReadOnly);

                try {
                    foreach (var certificate in store.Certificates)
                    {
                        var cert = GetBouncyCastleCertificate(certificate);
                        if (selector == null || selector.Match(cert))
                        {
                            return(cert);
                        }
                    }
                } finally {
                    store.Close();
                }
            }

            return(null);
        }
Пример #6
0
        /// <summary>
        /// Gets the private key based on the provided selector.
        /// </summary>
        /// <returns>The private key on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the private key.</param>
        protected override AsymmetricKeyParameter GetPrivateKey(IX509Selector selector)
        {
            var store = new X509Store(StoreName.My, StoreLocation);

            store.Open(OpenFlags.ReadOnly);

            try {
                foreach (var certificate in store.Certificates)
                {
                    if (!certificate.HasPrivateKey)
                    {
                        continue;
                    }

                    var cert = DotNetUtilities.FromX509Certificate(certificate);

                    if (selector == null || selector.Match(cert))
                    {
                        var pair = DotNetUtilities.GetKeyPair(certificate.PrivateKey);
                        return(pair.Private);
                    }
                }
            } finally {
                store.Close();
            }

            return(null);
        }
Пример #7
0
        /// <summary>
        /// Gets the X.509 certificate based on the selector.
        /// </summary>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override Org.BouncyCastle.X509.X509Certificate GetCertificate(IX509Selector selector)
        {
            var storeNames = new StoreName[] { StoreName.My, StoreName.AddressBook, StoreName.TrustedPeople, StoreName.Root };

            foreach (var storeName in storeNames)
            {
                var store = new X509Store(storeName, StoreLocation);

                store.Open(OpenFlags.ReadOnly);

                try {
                    foreach (var certificate in store.Certificates)
                    {
                        var cert = DotNetUtilities.FromX509Certificate(certificate);
                        if (selector == null || selector.Match(cert))
                        {
                            return(cert);
                        }
                    }
                } finally {
                    store.Close();
                }
            }

            return(null);
        }
		/// <summary>
		/// Gets the X.509 certificate based on the selector.
		/// </summary>
		/// <returns>The certificate on success; otherwise <c>null</c>.</returns>
		/// <param name="selector">The search criteria for the certificate.</param>
		protected override X509Certificate GetCertificate (IX509Selector selector)
		{
			foreach (var certificate in keychain.GetCertificates ((CssmKeyUse) 0)) {
				if (selector.Match (certificate))
					return certificate;
			}

			return null;
		}
		/// <summary>
		/// Gets the private key based on the provided selector.
		/// </summary>
		/// <returns>The private key on success; otherwise <c>null</c>.</returns>
		/// <param name="selector">The search criteria for the private key.</param>
		protected override AsymmetricKeyParameter GetPrivateKey (IX509Selector selector)
		{
			foreach (var signer in keychain.GetAllCmsSigners ()) {
				if (selector.Match (signer.Certificate))
					return signer.PrivateKey;
			}

			return null;
		}
Пример #10
0
        /// <summary>
        /// Gets an enumerator of matching X.509 certificates based on the specified selector.
        /// </summary>
        /// <remarks>
        /// Gets an enumerator of matching X.509 certificates based on the specified selector.
        /// </remarks>
        /// <returns>The matching certificates.</returns>
        /// <param name="selector">The match criteria.</param>
        public IEnumerable <X509Certificate> GetMatches(IX509Selector selector)
        {
            foreach (var certificate in certificates)
            {
                if (selector == null || selector.Match(certificate))
                {
                    yield return(certificate);
                }
            }

            yield break;
        }
Пример #11
0
		/// <summary>
		/// Gets the X.509 certificate based on the selector.
		/// </summary>
		/// <returns>The certificate on success; otherwise <c>null</c>.</returns>
		/// <param name="selector">The search criteria for the certificate.</param>
		protected override X509Certificate GetCertificate (IX509Selector selector)
		{
			if (selector == null && certificates.Count > 0)
				return certificates[0];

			foreach (var certificate in certificates) {
				if (selector.Match (certificate))
					return certificate;
			}

			return null;
		}
Пример #12
0
        /// <summary>
        /// Gets the private key based on the provided selector.
        /// </summary>
        /// <returns>The private key on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the private key.</param>
        protected override AsymmetricKeyParameter GetPrivateKey(IX509Selector selector)
        {
            foreach (var signer in keychain.GetAllCmsSigners())
            {
                if (selector.Match(signer.Certificate))
                {
                    return(signer.PrivateKey);
                }
            }

            return(null);
        }
Пример #13
0
        /// <summary>
        /// Gets the X.509 certificate based on the selector.
        /// </summary>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override X509Certificate GetCertificate(IX509Selector selector)
        {
            foreach (var certificate in keychain.GetCertificates((CssmKeyUse)0))
            {
                if (selector.Match(certificate))
                {
                    return(certificate);
                }
            }

            return(null);
        }
Пример #14
0
        /// <summary>
        /// Gets the X.509 certificate based on the selector.
        /// </summary>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override X509Certificate GetCertificate(IX509Selector selector)
        {
            foreach (var certificate in certificates)
            {
                if (selector.Match(certificate))
                {
                    return(certificate);
                }
            }

            return(null);
        }
Пример #15
0
        /// <summary>
        /// Gets a collection of matching X.509 certificates based on the specified selector.
        /// </summary>
        /// <remarks>
        /// Gets a collection of matching X.509 certificates based on the specified selector.
        /// </remarks>
        /// <returns>The matching certificates.</returns>
        /// <param name="selector">The match criteria.</param>
        ICollection IX509Store.GetMatches(IX509Selector selector)
        {
            var matches = new List <X509Certificate> ();

            foreach (var certificate in certs)
            {
                if (selector == null || selector.Match(certificate))
                {
                    matches.Add(certificate);
                }
            }

            return(matches);
        }
Пример #16
0
        /// <summary>
        /// Gets the X.509 certificate based on the selector.
        /// </summary>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override Org.BouncyCastle.X509.X509Certificate GetCertificate(IX509Selector selector)
        {
            foreach (var certificate in CertificateStore.Certificates)
            {
                var cert = DotNetUtilities.FromX509Certificate(certificate);

                if (selector.Match(cert))
                {
                    return(cert);
                }
            }

            return(null);
        }
Пример #17
0
        public IEnumerable <X509CertificateRecord> Find(IX509Selector selector, bool trustedOnly, X509CertificateRecordFields fields)
        {
            var certs = this.GetCerts();

            foreach (var certificate in certs)
            {
                if (selector.Match(certificate))
                {
                    var record = new X509CertificateRecord(certificate);
                    return(new SingletonList <X509CertificateRecord>(record));
                }
            }

            return(new List <X509CertificateRecord>());
        }
Пример #18
0
        public ICollection GetMatches(IX509Selector selector)
        {
            var list  = new Collection <X509Certificate>();
            var certs = this.GetCerts();

            foreach (var cert in certs)
            {
                if (selector.Match(cert))
                {
                    list.Add(cert);
                    return(list);
                }
            }

            return(list);
        }
Пример #19
0
		/// <summary>
		/// Gets the private key based on the provided selector.
		/// </summary>
		/// <returns>The private key on success; otherwise <c>null</c>.</returns>
		/// <param name="selector">The search criteria for the private key.</param>
		protected override AsymmetricKeyParameter GetPrivateKey (IX509Selector selector)
		{
			foreach (var certificate in certificates) {
				AsymmetricKeyParameter key;

				if (!keys.TryGetValue (certificate, out key))
					continue;

				if (selector != null && !selector.Match (certificate))
					continue;

				return key;
			}

			return null;
		}
Пример #20
0
        public ICollection GetMatches(IX509Selector selector)
        {
            if (selector == null)
            {
                return(Platform.CreateArrayList(this._local));
            }
            IList list = Platform.CreateArrayList();

            foreach (object current in this._local)
            {
                if (selector.Match(current))
                {
                    list.Add(current);
                }
            }
            return(list);
        }
Пример #21
0
    public ICollection GetMatches(IX509Selector selector)
    {
        if (selector == null)
        {
            return(Platform.CreateArrayList(_local));
        }
        IList list = Platform.CreateArrayList();

        foreach (object item in _local)
        {
            if (selector.Match(item))
            {
                list.Add(item);
            }
        }
        return(list);
    }
		/**
		 * Return the matches in the collection for the passed in selector.
		 *
		 * @param selector the selector to match against.
		 * @return a possibly empty collection of matching objects.
		 */
		public ICollection GetMatches(
			IX509Selector selector)
		{
			if (selector == null)
			{
				return new ArrayList(_local);
			}

			IList result = new ArrayList();
			foreach (object obj in _local)
			{
				if (selector.Match(obj))
					result.Add(obj);
			}

			return result;
		}
Пример #23
0
        /// <summary>
        /// Gets the X.509 certificate matching the specified selector.
        /// </summary>
        /// <remarks>
        /// Gets the first certificate that matches the specified selector.
        /// </remarks>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override X509Certificate GetCertificate(IX509Selector selector)
        {
            if (selector == null && certificates.Count > 0)
            {
                return(certificates[0]);
            }

            foreach (var certificate in certificates)
            {
                if (selector.Match(certificate))
                {
                    return(certificate);
                }
            }

            return(null);
        }
Пример #24
0
        public ICollection GetMatches(IX509Selector selector)
        {
            if (selector == null)
            {
                return(win);
            }

            IList result = new ArrayList();

            for (int i = 0; i < win.Count; i++)
            {
                if (selector.Match(bc[i]))
                {
                    result.Add(win[i]);
                }
            }
            return(result);
        }
Пример #25
0
        /**
         * Return the matches in the collection for the passed in selector.
         *
         * @param selector the selector to match against.
         * @return a possibly empty collection of matching objects.
         */

        public ICollection GetMatches(IX509Selector selector)
        {
            if (selector == null)
            {
                return(Platform.CreateArrayList(_local));
            }

            IList result = Platform.CreateArrayList();

            foreach (object obj in _local)
            {
                if (selector.Match(obj))
                {
                    result.Add(obj);
                }
            }

            return(result);
        }
Пример #26
0
        /**
         * Return the matches in the collection for the passed in selector.
         *
         * @param selector the selector to match against.
         * @return a possibly empty collection of matching objects.
         */
        public ICollection GetMatches(
            IX509Selector selector)
        {
            if (selector == null)
            {
                return(BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList(_local));
            }

            IList result = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList();

            foreach (object obj in _local)
            {
                if (selector.Match(obj))
                {
                    result.Add(obj);
                }
            }

            return(result);
        }
Пример #27
0
        /// <summary>
        /// Gets the private key based on the provided selector.
        /// </summary>
        /// <returns>The private key on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the private key.</param>
        protected override AsymmetricKeyParameter GetPrivateKey(IX509Selector selector)
        {
            foreach (var certificate in CertificateStore.Certificates)
            {
                if (!certificate.HasPrivateKey)
                {
                    continue;
                }

                var cert = DotNetUtilities.FromX509Certificate(certificate);

                if (selector.Match(cert))
                {
                    var pair = DotNetUtilities.GetKeyPair(certificate.PrivateKey);
                    return(pair.Private);
                }
            }

            return(null);
        }
Пример #28
0
        /// <summary>
        /// Finds the certificates matching the specified selector.
        /// </summary>
        /// <remarks>
        /// Searches the database for certificates matching the selector, returning all
        /// matching certificates.
        /// </remarks>
        /// <returns>The matching certificates.</returns>
        /// <param name="selector">The match selector or <c>null</c> to return all certificates.</param>
        public IEnumerable <X509Certificate> FindCertificates(IX509Selector selector)
        {
            using (var command = GetSelectCommand(selector, false, false, X509CertificateRecordFields.Certificate)) {
                using (var reader = command.ExecuteReader()) {
                    var parser = new X509CertificateParser();
                    var buffer = new byte[4096];

                    while (reader.Read())
                    {
                        var record = LoadCertificateRecord(reader, parser, ref buffer);
                        if (selector == null || selector.Match(record.Certificate))
                        {
                            yield return(record.Certificate);
                        }
                    }
                }
            }

            yield break;
        }
Пример #29
0
        /// <summary>
        /// Gets the private key for the certificate matching the specified selector.
        /// </summary>
        /// <remarks>
        /// Gets the private key for the first certificate that matches the specified selector.
        /// </remarks>
        /// <returns>The private key on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the private key.</param>
        protected override AsymmetricKeyParameter GetPrivateKey(IX509Selector selector)
        {
            foreach (var certificate in certificates)
            {
                AsymmetricKeyParameter key;

                if (!keys.TryGetValue(certificate, out key))
                {
                    continue;
                }

                if (selector != null && !selector.Match(certificate))
                {
                    continue;
                }

                return(key);
            }

            return(null);
        }
Пример #30
0
            public ICollection GetMatches(IX509Selector selector)
            {
                if (selector == null)
                {
                    return win;
                }

                IList result = new ArrayList();
                for (int i = 0; i < win.Count; i++)
                {
                    if (selector.Match(bc[i]))
                        result.Add(win[i]);
                }
                return result;
            }
Пример #31
0
		/// <summary>
		/// Finds the certificates matching the specified selector.
		/// </summary>
		/// <remarks>
		/// Searches the database for certificates matching the selector, returning all
		/// matching certificates.
		/// </remarks>
		/// <returns>The matching certificates.</returns>
		/// <param name="selector">The match selector or <c>null</c> to return all certificates.</param>
		public IEnumerable<X509Certificate> FindCertificates (IX509Selector selector)
		{
			using (var command = GetSelectCommand (selector, false, false, X509CertificateRecordFields.Certificate)) {
				var reader = command.ExecuteReader ();

				try {
					var parser = new X509CertificateParser ();
					var buffer = new byte[4096];

					while (reader.Read ()) {
						var record = LoadCertificateRecord (reader, parser, ref buffer);
						if (selector == null || selector.Match (record.Certificate))
							yield return record.Certificate;
					}
				} finally {
#if COREFX
					reader.Dispose ();
#else
					reader.Close ();
#endif
				}
			}

			yield break;
		}
Пример #32
0
        /// <summary>
        /// Gets the X.509 certificate based on the selector.
        /// </summary>
        /// <returns>The certificate on success; otherwise <c>null</c>.</returns>
        /// <param name="selector">The search criteria for the certificate.</param>
        protected override X509Certificate GetCertificate(IX509Selector selector)
        {
            foreach (var certificate in certificates) {
                if (selector.Match (certificate))
                    return certificate;
            }

            return null;
        }
		/// <summary>
		/// Gets the X.509 certificate based on the selector.
		/// </summary>
		/// <remarks>
		/// Gets the X.509 certificate based on the selector.
		/// </remarks>
		/// <returns>The certificate on success; otherwise <c>null</c>.</returns>
		/// <param name="selector">The search criteria for the certificate.</param>
		protected override Org.BouncyCastle.X509.X509Certificate GetCertificate (IX509Selector selector)
		{
			var storeNames = new [] { StoreName.My, StoreName.AddressBook, StoreName.TrustedPeople, StoreName.Root };

			foreach (var storeName in storeNames) {
				var store = new X509Store (storeName, StoreLocation);

				store.Open (OpenFlags.ReadOnly);

				try {
					foreach (var certificate in store.Certificates) {
						var cert = DotNetUtilities.FromX509Certificate (certificate);
						if (selector == null || selector.Match (cert))
							return cert;
					}
				} finally {
					store.Close ();
				}
			}

			return null;
		}
		/// <summary>
		/// Gets the private key based on the provided selector.
		/// </summary>
		/// <remarks>
		/// Gets the private key based on the provided selector.
		/// </remarks>
		/// <returns>The private key on success; otherwise <c>null</c>.</returns>
		/// <param name="selector">The search criteria for the private key.</param>
		protected override AsymmetricKeyParameter GetPrivateKey (IX509Selector selector)
		{
			var store = new X509Store (StoreName.My, StoreLocation);

			store.Open (OpenFlags.ReadOnly);

			try {
				foreach (var certificate in store.Certificates) {
					if (!certificate.HasPrivateKey)
						continue;

					var cert = DotNetUtilities.FromX509Certificate (certificate);

					if (selector == null || selector.Match (cert)) {
						var pair = DotNetUtilities.GetKeyPair (certificate.PrivateKey);
						return pair.Private;
					}
				}
			} finally {
				store.Close ();
			}

			return null;
		}
Пример #35
0
		/// <summary>
		/// Finds the certificate records matching the specified selector.
		/// </summary>
		/// <remarks>
		/// Searches the database for certificate records matching the selector, returning all
		/// of the matching records populated with the desired fields.
		/// </remarks>
		/// <returns>The matching certificate records populated with the desired fields.</returns>
		/// <param name="selector">The match selector or <c>null</c> to match all certificates.</param>
		/// <param name="trustedOnly"><c>true</c> if only trusted certificates should be returned.</param>
		/// <param name="fields">The desired fields.</param>
		public IEnumerable<X509CertificateRecord> Find (IX509Selector selector, bool trustedOnly, X509CertificateRecordFields fields)
		{
			using (var command = GetSelectCommand (selector, trustedOnly, false, fields | X509CertificateRecordFields.Certificate)) {
				var reader = command.ExecuteReader ();

				try {
					var parser = new X509CertificateParser ();
					var buffer = new byte[4096];

					while (reader.Read ()) {
						var record = LoadCertificateRecord (reader, parser, ref buffer);

						if (selector == null || selector.Match (record.Certificate))
							yield return record;
					}
				} finally {
					reader.Close ();
				}
			}

			yield break;
		}
Пример #36
0
		/// <summary>
		/// Finds the private keys matching the specified selector.
		/// </summary>
		/// <remarks>
		/// Searches the database for certificate records matching the selector, returning the
		/// private keys for each matching record.
		/// </remarks>
		/// <returns>The matching certificates.</returns>
		/// <param name="selector">The match selector or <c>null</c> to return all private keys.</param>
		public IEnumerable<AsymmetricKeyParameter> FindPrivateKeys (IX509Selector selector)
		{
			using (var command = GetSelectCommand (selector, false, true, PrivateKeyFields)) {
				var reader = command.ExecuteReader ();

				try {
					var parser = new X509CertificateParser ();
					var buffer = new byte[4096];

					while (reader.Read ()) {
						var record = LoadCertificateRecord (reader, parser, ref buffer);

						if (selector == null || selector.Match (record.Certificate))
							yield return record.PrivateKey;
					}
				} finally {
					reader.Close ();
				}
			}

			yield break;
		}
Пример #37
0
		/// <summary>
		/// Gets an enumerator of matching X.509 certificates based on the specified selector.
		/// </summary>
		/// <remarks>
		/// Gets an enumerator of matching X.509 certificates based on the specified selector.
		/// </remarks>
		/// <returns>The matching certificates.</returns>
		/// <param name="selector">The match criteria.</param>
		public IEnumerable<X509Certificate> GetMatches (IX509Selector selector)
		{
			foreach (var certificate in certs) {
				if (selector == null || selector.Match (certificate))
					yield return certificate;
			}

			yield break;
		}
Пример #38
0
		/// <summary>
		/// Gets a collection of matching X.509 certificates based on the specified selector.
		/// </summary>
		/// <remarks>
		/// Gets a collection of matching X.509 certificates based on the specified selector.
		/// </remarks>
		/// <returns>The matching certificates.</returns>
		/// <param name="selector">The match criteria.</param>
		ICollection IX509Store.GetMatches (IX509Selector selector)
		{
			var matches = new List<X509Certificate> ();

			foreach (var certificate in certs) {
				if (selector == null || selector.Match (certificate))
					matches.Add (certificate);
			}

			return matches;
		}