本文整理汇总了VB.NET中System.IdentityModel.Selectors.X509CertificateValidator类的典型用法代码示例。如果您正苦于以下问题:VB.NET X509CertificateValidator类的具体用法?VB.NET X509CertificateValidator怎么用?VB.NET X509CertificateValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了X509CertificateValidator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyX509CertificateValidator
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