다음을 통해 공유


X509CertificateValidator.Validate(X509Certificate2) 메서드

정의

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

public:
 abstract void Validate(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate);
public abstract void Validate (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);
abstract member Validate : System.Security.Cryptography.X509Certificates.X509Certificate2 -> unit
Public MustOverride Sub Validate (certificate As X509Certificate2)

매개 변수

certificate
X509Certificate2

유효성을 검사할 X.509 인증서를 나타내는 X509Certificate2입니다.

예제

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 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

설명

메서드를 재정의 Validate 하여 X.509 인증서의 유효성을 검사하는 방법을 지정합니다.

매개 변수에 certificate 전달된 X.509 인증서가 유효성 검사를 통과하지 못하면 을 throw합니다 SecurityTokenValidationException.

적용 대상