TsgcWebSocketHTTPServer › Properties › SSLOptions
保存 TLS 监听器的证书路径、TLS 版本选择和 OpenSSL 调整选项。
property SSLOptions: TsgcWSSSL_Options read FSSLOptions write SetSSLOptions;
Version=tlsUndefined,VerifyCertificate=False
在激活服务器之前,当 SSL 为 True 时提供证书材料:RootCertFile、CertFile 和 KeyFile 指向 PEM 文件(当文件包含完整链时,所有三个使用相同路径),且仅在私钥加密时需要 Password。将 VerifyCertificate 设置为 True 以请求和验证客户端证书(子选项 FailIfNoCertificate 和 VerifyClientOnce 细化检查),VerifyDepth 控制链长度。Version 选择特定的 TLS 版本(tls1_0、tls1_1、tls1_2、tls1_3)或保持协商开放(tlsUndefined)。OpenSSL_Options 公开低级选项:APIVersion(oslAPI_1_0/oslAPI_1_1/oslAPI_3_0)、用于定位 OpenSSL 二进制文件的 LibPath/LibPathCustom、UnixSymLinks、ECDHE、CipherList、CurveList、MinVersion 以及用于主机名/IP 验证的 X509Checks。
oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.SSL := true;
oServer.SSLOptions.CertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.KeyFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.RootCertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.Version := tls1_3;
oServer.SSLOptions.OpenSSL_Options.MinVersion := tls1_2;
oServer.SSLOptions.Port := 443;
oServer.Active := true;