Delphi Intraweb ISAPI DLL 无法使用 TLS/SSL 与服务器连接

我有一个使用 ISAPI DLL 托管在 IIS 上的 Delphi Intraweb 应用程序。此应用程序通过 IndyClient 在内部与 Windows 服务应用程序连接。 Windows 服务充当应用服务器,并用 Delphi 本身编写。

我想通过 TLS/SSL 保护 IndyClientIndyServer(在 Windows 服务端)之间执行的通信。为此,我在客户端使用 TIdSSLIOHandlerSocketOpenSSL,在服务端使用 TIdServerIOHandlerSSLOpenSSL。下面的代码已经写在服务端 -

IdServerIOHandlerSSLOpenSSL1.SSLOptions.CertFile := Config.ServerCertificate; 
IdServerIOHandlerSSLOpenSSL1.SSLOptions.KeyFile := Config.ServerKey;

IdServerIOHandlerSSLOpenSSL1.SSLOptions.Mode := sslmServer;
IdServerIOHandlerSSLOpenSSL1.SSLOptions.VerifyMode := [];
IdServerIOHandlerSSLOpenSSL1.SSLOptions.VerifyDepth  := 0;
IdServerIOHandlerSSLOpenSSL1.SSLOptions.SSLVersions := [sslvTLSv1_2];

IndyServer.IOHandler := IdServerIOHandlerSSLOpenSSL1;
IndyServer.OnConnect := ServerConnect;

// Config object gets the correct path for certificate and key file

// Code for ServerConnect event 
if (AContext.Connection.IOHandler is TIdSSLIOHandlerSocketBase) then
   TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThrough := False;

下面的代码写在 ISAPI DLL 中以连接 IndyServer

  IdSSLIOHandler.SSLOptions.VerifyMode := [];
  IdSSLIOHandler.SSLOptions.VerifyDepth := 0;
  IdSSLIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2];
  IdSSLIOHandler.SSLOptions.Mode := sslmClient;
  IndyClient.IOHandler := IdSSLIOHandler;
  TIdSSLIOHandlerSocketBase(IndyClient.IOHandler).PassThrough := False;

当我在 IIS 上托管 ISAPI DLL 并尝试连接 Windows 服务时,在 Windows 服务端代码中收到以下错误消息 -

EIdOSSLacceptError with message 'Error accepting connection with SSL.EOF was observed that violates the protocol'

我有一个桌面客户端应用程序,它使用在客户端编写的相同代码成功连接到同一个 Windows 服务。

我正在使用自签名证书并尝试将 IIS 配置为也使用 HTTPS。我的 Delphi 版本是 Delphi 10.2 Tokyo

LLY941020 回答:Delphi Intraweb ISAPI DLL 无法使用 TLS/SSL 与服务器连接

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/37546.html

大家都在问