Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim socket As New ChilkatSocket

'  Connect to the server using TLS.
Dim bTls As Long
bTls = 1
Dim maxWaitMs As Long
maxWaitMs = 5000
success = socket.Connect("example.com",5000,bTls,maxWaitMs)
If (success = 0) Then
    Debug.Print 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 Long
numCAs = socket.NumSslAcceptableClientCAs
Dim i As Long
For i = 0 To numCAs - 1
    Dim caDn As String
    caDn = socket.GetSslAcceptableClientCaDn(i)
    If (socket.LastMethodSuccess = 0) Then
        Debug.Print socket.LastErrorText
        Exit Sub
    End If

    Debug.Print caDn
Next