Example #1
0
        /// <summary>Returns a value indicating whether the key identifier for this instance is equal to the specified key identifier.</summary>
        /// <param name="keyIdentifierClause">An <see cref="T:System.IdentityModel.Tokens.SecurityKeyIdentifierClause" /> to compare to this instance.</param>
        /// <returns>
        /// <see langword="true" /> if <paramref name="keyIdentifierClause" /> is one of the <see cref="T:System.IdentityModel.Tokens.X509SubjectKeyIdentifierClause" />, <see cref="T:System.IdentityModel.Tokens.X509ThumbprintKeyIdentifierClause" />, <see cref="T:System.IdentityModel.Tokens.X509IssuerSerialKeyIdentifierClause" />, or <see cref="T:System.IdentityModel.Tokens.X509RawDataKeyIdentifierClause" /> types and the key identifier clauses match; otherwise, <see langword="false" />.</returns>
        public override bool MatchesKeyIdentifierClause(SecurityKeyIdentifierClause keyIdentifierClause)
        {
            this.ThrowIfDisposed();
            X509SubjectKeyIdentifierClause identifierClause1 = keyIdentifierClause as X509SubjectKeyIdentifierClause;

            if (identifierClause1 != null)
            {
                return(identifierClause1.Matches(this.certificate));
            }
            X509ThumbprintKeyIdentifierClause identifierClause2 = keyIdentifierClause as X509ThumbprintKeyIdentifierClause;

            if (identifierClause2 != null)
            {
                return(identifierClause2.Matches(this.certificate));
            }
            X509IssuerSerialKeyIdentifierClause identifierClause3 = keyIdentifierClause as X509IssuerSerialKeyIdentifierClause;

            if (identifierClause3 != null)
            {
                return(identifierClause3.Matches(this.certificate));
            }
            X509RawDataKeyIdentifierClause identifierClause4 = keyIdentifierClause as X509RawDataKeyIdentifierClause;

            if (identifierClause4 != null)
            {
                return(identifierClause4.Matches(this.certificate));
            }
            return(base.MatchesKeyIdentifierClause(keyIdentifierClause));
        }
Example #2
0
        /// <summary>Returns a value that indicates whether the key identifier for this instance matches the specified key identifier.</summary>
        /// <param name="keyIdentifierClause">A <see cref="T:System.IdentityModel.Tokens.SecurityKeyIdentifierClause" /> to compare to this instance.</param>
        /// <returns>
        /// <see langword="true" /> if <paramref name="keyIdentifierClause" /> is a <see cref="T:System.IdentityModel.Tokens.X509IssuerSerialKeyIdentifierClause" /> type and the key identifier clauses match; otherwise, <see langword="false" />.</returns>
        public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
        {
            X509IssuerSerialKeyIdentifierClause identifierClause = keyIdentifierClause as X509IssuerSerialKeyIdentifierClause;

            if (this == identifierClause)
            {
                return(true);
            }
            if (identifierClause != null)
            {
                return(identifierClause.Matches(this.issuerName, this.issuerSerialNumber));
            }
            return(false);
        }