VB.NET
VB.NET
Enumerate Server-Advertised Acceptable Client CAs
See more Socket/SSL/TLS Examples
Demonstrates Socket.GetSslAcceptableClientCaDn, which returns a certificate-authority distinguished name advertised by a TLS server when it requests a client certificate.
Background. Valid indexes range from 0 through
NumSslAcceptableClientCAs minus one. A client can use these names to select an appropriate client certificate.Chilkat VB.NET Downloads
Dim success As Boolean = False
Dim socket As New Chilkat.Socket
' Connect to the server using TLS.
Dim bTls As Boolean = True
Dim maxWaitMs As Integer = 5000
success = socket.Connect("example.com",5000,bTls,maxWaitMs)
If (success = False) Then
Debug.WriteLine(socket.LastErrorText)
Exit Sub
End If
' After connecting to a server that requests a client certificate, enumerate the certificate-
' authority distinguished names the server advertised as acceptable.
Dim numCAs As Integer = socket.NumSslAcceptableClientCAs
Dim i As Integer
For i = 0 To numCAs - 1
Dim caDn As String = socket.GetSslAcceptableClientCaDn(i)
If (socket.LastMethodSuccess = False) Then
Debug.WriteLine(socket.LastErrorText)
Exit Sub
End If
Debug.WriteLine(caDn)
Next