Sample code for 30+ languages & platforms
AutoIt

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

AutoIt
Local $bSuccess = False

$oSocket = ObjCreate("Chilkat.Socket")

;  Connect to the server using TLS.
Local $bTls = True
Local $iMaxWaitMs = 5000
$bSuccess = $oSocket.Connect("example.com",5000,$bTls,$iMaxWaitMs)
If ($bSuccess = False) Then
    ConsoleWrite($oSocket.LastErrorText & @CRLF)
    Exit
EndIf

;  After connecting to a server that requests a client certificate, enumerate the certificate-
;  authority distinguished names the server advertised as acceptable.
Local $iNumCAs = $oSocket.NumSslAcceptableClientCAs
Local $i
For $i = 0 To $iNumCAs - 1
Local $sCaDn = $oSocket.GetSslAcceptableClientCaDn($i)
    If ($oSocket.LastMethodSuccess = False) Then
        ConsoleWrite($oSocket.LastErrorText & @CRLF)
        Exit
    EndIf

    ConsoleWrite($sCaDn & @CRLF)
Next