Sample code for 30+ languages & platforms
Lua

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

Lua
local chilkat = require("chilkat")

local socket = chilkat.Socket.new()

-- Connect to the server using TLS.
local bTls = true
local maxWaitMs = 5000
local success = socket:connect("example.com", 5000, bTls, maxWaitMs)
if not success then
    print(socket.last_error_text)
    return
end

-- After connecting to a server that requests a client certificate, enumerate the certificate-
-- authority distinguished names the server advertised as acceptable.
local numCAs = socket.num_ssl_acceptable_client_cas
for i = 0, numCAs - 1 do
    local caDn = socket:get_ssl_acceptable_client_ca_dn(i)
    if not socket.last_method_success then
        print(socket.last_error_text)
        return
    end

    print(caDn)
end