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 証明書の検証方法を指定します。

X.509 証明書を certificate パラメーターに渡すと検証は失敗し、SecurityTokenValidationException がスローされます。

適用対象