QuickStart
Rebuild, then reach TLS 1.3
The first tab is what your existing project already looks like. The second is the one new line worth adding. The third proves you are on sgcIndy and not on stock Indy.
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL,
IdSSLOpenSSL, IdSSLOpenSSLHeaders, StdCtrls;
Your existing project already looks like this, which is the point. There is no sgcIdTCPClient and no TsgcIdSSLIOHandlerSocketOpenSSL, because no unit and no class in the library carries an sgc prefix. Install, rebuild, done.
procedure TFRMHttpClient.btnGoToClick(Sender: TObject);
var
oStream: TStringStream;
begin
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.APIVersion := sslvAPI_3_0;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method := sslvTLSv1_3;
oStream := TStringStream.Create('');
try
IdHTTP1.Get(txtURL.Text, oStream);
finally
FreeAndNil(oStream);
end;
end;
TIdSSLAPIVersion has the members sslvAPIDefault, sslvAPI_1_0, sslvAPI_1_1 and sslvAPI_3_0. Neither the type nor the property exists in stock Indy, which makes this snippet a compile-time proof of which library you are building against.
procedure TfrmTCPClient.btnConnectClick(Sender: TObject);
begin
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.APIVersion := sslvAPI_3_0;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method := sslvTLSv1_3;
IdTCPClient1.Host := txtHost.Text;
IdTCPClient1.Port := StrToInt(txtPort.Text);
IdSSLIOHandlerSocketOpenSSL1.PassThrough := False;
IdTCPClient1.Connect;
end;
procedure TfrmTCPClient.btnDisconnectClick(Sender: TObject);
begin
IdTCPClient1.Disconnect;
end;
Same components, same properties, same palette page. PassThrough := False is what turns the plain socket into a TLS one, exactly as it does in stock Indy. Reading is IdTCPClient1.IOHandler.ReadLn, writing is IOHandler.Write, unchanged.