Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

ProbeTlsChain

function ProbeTlsChain(const aAddress: string; aPort: Integer; aExplicitTLS: Boolean; aTimeoutMS: Cardinal = 10000): tChainProbe;
Connects to aAddress:aPort, runs the handshake far enough for the server to present its certificates, keeps them, and closes.

aAddress may be a host name or an IP literal. A NAME additionally supplies the SNI server_name, without which a virtual-hosted server answers with its default certificate - see the note at the call site.

aExplicitTLS SAYS WHETHER THE PORT MUST BE UPGRADED before TLS begins:

False the port speaks TLS from the first octet (443, 465, 993, 995, 990)
True the port opens in cleartext and is upgraded (587, 143, 21, ...)

IT IS A PARAMETER AND NOT A GUESS. This function never looks at the port number to decide - a probe that inferred the protocol from the port would be wrong on every server that does not use the conventional one, and wrong silently, which is the failure mode this whole unit exists to remove. The caller decides; IsExplicitTLS below is offered for callers that want the conventional answer, and calling it is THEIR choice.

WHEN aExplicitTLS IS True THE UPGRADE IS DISCOVERED, NOT CONFIGURED. The probe reads the server's greeting and recognises the dialect from what the SERVER said - SMTP, IMAP, POP3, FTP and NNTP all announce themselves in their first line. So the caller still does not name a protocol, and a server running SMTP on 12345 is upgraded correctly while a caller who wrongly claimed 443 needs an upgrade gets a clear refusal rather than a hang.

NEVER RAISES. Every failure - name resolution, connect, timeout, an upgrade the server refused, a server that presents nothing - comes back as fOK=False with fError set, because a diagnostic that throws is one the caller has to wrap before it can report.

aTimeoutMS bounds each wait for data, not the whole call.