Once the client has connected to the secure server, you can request information about which TLS version is being used (TLS 1.2, TLS 1.3, etc.), the cipher used, strength, and more.
Call the function GetInfo of the SChannel Handler to access this info. You can access the SSL Handler using the method OnSSLAfterCreateHandler, which is called after the SChannel Handler is created. After the client connects to the server, if the SSL Handler is assigned, call the function GetInfo and if successful, will return the connection data.
usessgcIdSSL, sgcSSL_SChannel_Indy, sgcSSL_SChannel;var SSL: TsgcIdSSLIOHandlerSocketSChannel; oClient := TsgcWebSocketClient.Create(nil); oClient.URL := 'wss://www.esegece.com:2053'; oClient.TLSOptions.Version := tls1_2; oClient.TLSOptions.IOHandler := iohSChannel; oClient.OnSSLAfterCreateHandler := OnSSLAfterCreateHandlerEvent; oClient.OnConnect := OnConnectEvent; oClient.Active := True; procedure OnSSLAfterCreateHandlerEvent(Sender: TObject; aType: TwsSSLHandler; aSSLHandler: TIdSSLIOHandlerSocketBase); begin if aSSLHandler.ClassType = TsgcIdSSLIOHandlerSocketSChannel then SSL := TsgcIdSSLIOHandlerSocketSChannel(aSSLHandler); end; procedure OnConnectEvent(Connection: TsgcWSConnection); var oInfo: TsgcSChannelConnectionInfo; begin if Assigned(SSL) then begin oInfo := SSL.GetInfo; if (oInfo.Protocol != tls1_2) then raise Exception.Create('Client cannot connect using TLS 1.2'); end; end;