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;
        }
        /// <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;
        }
        /// <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;
		}
        /// <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;
        }
        /// <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;
		}