PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Socket
integer li_BTls
integer li_MaxWaitMs
integer li_NumCAs
integer i
string ls_CaDn
li_Success = 0
loo_Socket = create oleobject
li_rc = loo_Socket.ConnectToNewObject("Chilkat.Socket")
if li_rc < 0 then
destroy loo_Socket
MessageBox("Error","Connecting to COM object failed")
return
end if
// Connect to the server using TLS.
li_BTls = 1
li_MaxWaitMs = 5000
li_Success = loo_Socket.Connect("example.com",5000,li_BTls,li_MaxWaitMs)
if li_Success = 0 then
Write-Debug loo_Socket.LastErrorText
destroy loo_Socket
return
end if
// After connecting to a server that requests a client certificate, enumerate the certificate-
// authority distinguished names the server advertised as acceptable.
li_NumCAs = loo_Socket.NumSslAcceptableClientCAs
for i = 0 to li_NumCAs - 1
ls_CaDn = loo_Socket.GetSslAcceptableClientCaDn(i)
if loo_Socket.LastMethodSuccess = 0 then
Write-Debug loo_Socket.LastErrorText
destroy loo_Socket
return
end if
Write-Debug ls_CaDn
next
destroy loo_Socket