コード例 #1
0
        /// <summary>
        /// Decides if the given certificate pair should be selected. If
        /// <c>obj</c> is not a <code>X509CertificatePair</code>, this method
        /// returns <code>false</code>.
        /// </summary>
        /// <param name="obj">The <code>X509CertificatePair</code> to be tested.</param>
        /// <returns><code>true</code> if the object matches this selector.</returns>
        public bool Match(
            object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            X509CertificatePair pair = obj as X509CertificatePair;

            if (pair == null)
            {
                return(false);
            }

            if (certPair != null && !certPair.Equals(pair))
            {
                return(false);
            }

            if (forwardSelector != null && !forwardSelector.Match(pair.Forward))
            {
                return(false);
            }

            if (reverseSelector != null && !reverseSelector.Match(pair.Reverse))
            {
                return(false);
            }

            return(true);
        }