Skip to content

IndySecOpenSSL using OpenSSL 3.6.0 does not connect with "CompleteFTP Server" #4

@JPeterMugaas

Description

@JPeterMugaas

I'm having problems using IndySecOpenSSL with OpenSSL 3.6.0, TIdFTP, with a "Complete FTP" Server.

I get the following exception:

Project ftp.exe raised exception class EOpenSSLUnderlyingCryptoError with message 'Error connecting with SSL.
error:0A000126:SSL routines::unexpected eof while reading'.

The problem appears whenever using OpenSSL 3.x but funny enough, the program does work with OpenSSL 1.1.1w. The test program is below:

program ftp;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  Classes,
  IdExplicitTLSClientServerBase,
  IdFTP,
  IdFTPCommon,
  IdSecOpenSSL,
  IdSecOpenSSLAPI,
  IdSecOpenSSLOptions,
  System.SysUtils;


procedure TestLocalHostCompleteFTP;
var
  LSec : TIdSecIOHandlerSocketOpenSSL;
  LFTP : TIdFTP;
  LDir : TStrings;
  i : Integer;
begin
  LFTP := TIdFTP.Create(nil);
  try
    LSec :=  TIdSecIOHandlerSocketOpenSSL.Create(nil);
    try
      LSec.SSLOptions.SSLVersions := DEF_SSLVERSIONS;
      LSec.SSLOptions.Mode := sslmClient;
      LFTP.IOHandler := LSec;
      LFTP.UseTLS := utUseExplicitTLS;
      LFTP.Host := 'localhost';
      LFTP.Username := '****';
      LFTP.Password := '****';
      LFTP.DataPortProtection := ftpdpsPrivate;
      LFTP.Connect;
      try
        LDir := TStringList.Create;
        try
          LFTP.List(LDir);
          for i := 0 to LDir.Count -1 do
          begin
            WriteLn(LDir[i]);
          end;
        finally
          FreeAndNil(LDir);
        end;
      finally
        LFTP.Disconnect;
      end;
    finally
      FreeAndNil(LSec);
    end;
  finally
    FreeAndNil(LFTP);
  end;
end;

begin
  try
    { TODO -oUser -cConsole Main : Insert code here }
    if OpenSSL_Using_Dynamic_Library_Load then
    begin
      WriteLn('Use Dynamic loading');
    end;
    WriteLn(OpenSSLVersion);
    TestLocalHostCompleteFTP;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  ReadLn;
end.

Here is the packet capture from Wireshark:

indysec-openssl-completeftp.zip

Funny enough, this issue also appears with TaurusTLS.
TaurusTLS-Developers/TaurusTLS#131

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions