Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
 /// <summary>Returns a value that indicates whether the key identifier for this instance is equivalent to the specified X.509 certificate.</summary>
 /// <param name="certificate">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> that contains the X.509 certificate to compare.</param>
 /// <returns>
 /// <see langword="true" /> if <paramref name="certificate" /> has the raw data that matches the current instance; otherwise, <see langword="false" />.</returns>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="certificate" /> is <see langword="null" />.</exception>
 public bool Matches(X509Certificate2 certificate)
 {
     if (certificate == null)
     {
         return(false);
     }
     return(this.Matches(X509RawDataKeyIdentifierClause.GetRawData((X509Certificate)certificate)));
 }
Ejemplo n.º 3
0
 /// <summary>Initializes a new instance of the <see cref="T:System.IdentityModel.Tokens.X509RawDataKeyIdentifierClause" /> class using the specified X.509 certificate. </summary>
 /// <param name="certificate">An <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> that contains the X.509 certificate.</param>
 /// <exception cref="T:System.ArgumentNullException">
 /// <paramref name="certificate" /> is <see langword="null" />.</exception>
 public X509RawDataKeyIdentifierClause(X509Certificate2 certificate)
     : this(X509RawDataKeyIdentifierClause.GetRawData((X509Certificate)certificate), false)
 {
     this.certificate = certificate;
 }