X509CertificateValidator 클래스

정의

X.509 인증서의 유효성을 검사합니다.

public ref class X509CertificateValidator abstract
public ref class X509CertificateValidator abstract : System::IdentityModel::Configuration::ICustomIdentityConfiguration
public abstract class X509CertificateValidator
public abstract class X509CertificateValidator : System.IdentityModel.Configuration.ICustomIdentityConfiguration
type X509CertificateValidator = class
type X509CertificateValidator = class
    interface ICustomIdentityConfiguration
Public MustInherit Class X509CertificateValidator
Public MustInherit Class X509CertificateValidator
Implements ICustomIdentityConfiguration
상속
X509CertificateValidator
파생
구현

예제

public class MyX509CertificateValidator : X509CertificateValidator
{
    string allowedIssuerName;
    public MyX509CertificateValidator(string allowedIssuerName)
    {
        if (allowedIssuerName == null)
        {
            throw new ArgumentNullException("allowedIssuerName");
        }

        this.allowedIssuerName = allowedIssuerName;
    }
    public override void Validate(X509Certificate2 certificate)
    {
        // Check that there is a certificate.
        if (certificate == null)
        {
            throw new ArgumentNullException("certificate");
        }

        // Check that the certificate issuer matches the configured issuer
        if (allowedIssuerName != certificate.IssuerName.Name)
        {
            throw new SecurityTokenValidationException
              ("Certificate was not issued by a trusted issuer");
        }
    }
}

Public Class MyX509CertificateValidator
    Inherits X509CertificateValidator
    Private allowedIssuerName As String

    Public Sub New(ByVal allowedIssuerName As String)
        If allowedIssuerName Is Nothing Then
            Throw New ArgumentNullException("allowedIssuerName")
        End If

        Me.allowedIssuerName = allowedIssuerName

    End Sub

    Public Overrides Sub Validate(ByVal certificate As X509Certificate2)
        ' Check that there is a certificate.
        If certificate Is Nothing Then
            Throw New ArgumentNullException("certificate")
        End If

        ' Check that the certificate issuer matches the configured issuer
        If allowedIssuerName <> certificate.IssuerName.Name Then
            Throw New SecurityTokenValidationException("Certificate was not issued by a trusted issuer")
        End If

    End Sub
End Class

설명

클래스를 X509CertificateValidator 사용하여 X.509 인증서가 유효한 것으로 간주되는 방법을 지정합니다. 이 작업은 에서 X509CertificateValidator 클래스를 파생하고 메서드를 재정의 Validate 하여 수행할 수 있습니다.

생성자

X509CertificateValidator()

X509CertificateValidator 클래스의 새 인스턴스를 초기화합니다.

속성

ChainTrust

신뢰 체인을 사용하여 X.509 인증서의 유효성을 검사하는 유효성 검사기를 가져옵니다.

None

X.509 인증서의 유효성을 검사하지 않는 유효성 검사기를 가져옵니다. 따라서 X.509 인증서는 항상 유효한 것으로 간주됩니다.

PeerOrChainTrust

인증서가 TrustedPeople 인증서 저장소에 있는지 확인하거나 인증서 신뢰 체인을 만들어 확인하는 유효성 검사기를 가져옵니다. 두 확인 방법 중 하나를 통과하는 인증서는 신뢰됩니다.

PeerTrust

인증서가 TrustedPeople 인증서 저장소에 있는지 확인하는 유효성 검사기를 가져옵니다.

메서드

CreateChainTrustValidator(Boolean, X509ChainPolicy)

신뢰 체인을 만들고 확인하는 데 사용되는 체인 정책과 컨텍스트를 지정하여 X.509 인증서를 확인하는 유효성 검사기를 가져옵니다.

CreatePeerOrChainTrustValidator(Boolean, X509ChainPolicy)

인증서가 TrustedPeople 인증서 저장소에 있는지 확인하거나 인증서 신뢰 체인을 만드는 데 사용되는 체인 정책과 컨텍스트를 지정하여 확인하는 유효성 검사기를 가져옵니다. 두 확인 방법 중 하나를 통과하는 인증서는 신뢰됩니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
LoadCustomConfiguration(XmlNodeList)

파생 클래스에서 재정의되는 경우 XML에서 사용자 지정 구성을 로드합니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Validate(X509Certificate2)

파생 클래스에서 재정의되는 경우 X.509 인증서의 유효성을 검사합니다.

적용 대상