Search found 4 matches

by xDBInformatique
Tue 13 Sep 2022 17:13
Forum: SecureBridge
Topic: Object name Missing
Replies: 1
Views: 7025

Re: Object name Missing

I'm back,

When I use the Demo sFTPClient Devart I get a message asking me to validate a key.
I then find myself with a .Key file present in the application directory!
If I place my application in the same directory it works !!! So I guess my application uses this .key file

What I don't understand is why with my application the .key file is not created and gives me an "Object name missing" error, yet I'm answering the same question as in the DEVART Demo project!!

Thanks for your help
by xDBInformatique
Tue 13 Sep 2022 16:16
Forum: SecureBridge
Topic: Object name Missing
Replies: 1
Views: 7025

Object name Missing

Hello,

I'm having trouble connecting to an sFTP server. Message is
Object name missing
This happens in the OnServerKeyValidation procedure

Code: Select all

procedure TFGestionPackingList.DoServerKeyValidate(FileStorage: TScFileStorage;
  const HostKeyName: string; NewServerKey: TScKey; var Accept: Boolean);
var
  Key: TScKey;
  fp, msg: string;
begin
  Key := FileStorage.Keys.FindKey(HostKeyName);
  showmessage('1');
  if (Key = nil) or not Key.Ready then begin
    NewServerKey.GetFingerPrint(haMD5, fp);
    msg := 'The authenticity of server can not be verified.'#13#10 +
           'Fingerprint for the key received from server: ' + fp + '.'#13#10 +
           'Key length: ' + IntToStr(NewServerKey.BitCount) + ' bits.'#13#10 +
           'Are you sure you want to continue connecting?';

    if MessageDlg(msg, mtConfirmation, [mbOk, mbCancel], 0) = mrOk then begin
       Key := TScKey.Create(nil);
        showmessage('2');
      try
        Key.Assign(NewServerKey);
        showmessage('3');
        Key.KeyName := HostKeyName;
       showmessage('4');
        [color=#FF0000][b]FileStorage.Keys.Add(Key);  <<== ERROR
        showmessage('5');
      except
        Key.Free;
        raise;
      end;

      Accept := True;
    end;
  end;
end;
I can't understand, because if I use the demo it works, if I use Filezilla it works..
This software is used directly on the server as an administrator

Could you help me ?

Cordially.
by xDBInformatique
Mon 05 Sep 2022 21:56
Forum: SecureBridge
Topic: SSH Into Windows Service
Replies: 1
Views: 7227

Re: SSH Into Windows Service

I found what was missing. I added a procedure DOServerKeyvalidfate.

It's really very complicated Devart.

I continue my investigations.

Thx
by xDBInformatique
Mon 05 Sep 2022 21:24
Forum: SecureBridge
Topic: SSH Into Windows Service
Replies: 1
Views: 7227

SSH Into Windows Service

Hello Everyone,

I have been using another sFTP component for a few years, which I have to replace because downloading a lot of files was a problem for me.

I chose Devart, first of all I find it very difficult to use, when it comes to downloading several files in the same directory... Forced to fill out a list and then go through it!! It's a consumer of neurons...

I encounter a difficulty that I cannot solve. I can't use it in a Windows service! That's where I'm at..

Code: Select all

Function TServiceCde.DownLoadCSV:Integer;
Var
 SSH : TScSSHClient;
  SFTPClient : TScSFTPClient;
  FileStorage : TScFileStorage;
  Handle : TScSFTPFileHandle;
  RootDir : string;
begin
  SSH := TScSSHClient.Create(nil);
  FileStorage := TScFileStorage(nil);
  Try
    Try
      SSH.KeyStorage := FileStorage;
      SSH.HostName := FTPHost;
      SSH.Port := FTPPort;
      SSH.User := FTPLogin;
      SSH.Authentication := atPassword;
      SSH.Password := FTPPassword;
      SSH.HostKeyAlgorithms.AsString :='ssh-rsa,ssh-dss';
      SSH.OnServerKeyValidate := ScSSHClientServerKeyValidate;

      Log('1: configuration connexion SSH');
      SSH.Connect;

      SFTPClient := TScSFTPClient.Create(nil);
      Try
        Try
          SFTPClient.SSHClient := SSH;
          SFTPClient.Initialize;

          Log('3: SFTP initié');

          if FTPRepertoire1 <> '' then
          begin
            RootDir := SFTPClient.RetrieveAbsolutePath(Trim(FTPRepertoire1));
            Handle := SFTPClient.OpenDirectory(RootDir);
            if FTPRepertoire2 <> '' then
            begin
              RootDir := SFTPClient.RetrieveAbsolutePath(Trim(FTPRepertoire2));
              Handle := SFTPClient.OpenDirectory(RootDir);
              if FTPRepertoire3 <> '' then
              begin
                RootDir := SFTPClient.RetrieveAbsolutePath(Trim(FTPRepertoire3));
                Handle := SFTPClient.OpenDirectory(RootDir);
                if FTPRepertoire4 <> '' then
                begin
                  RootDir := SFTPClient.RetrieveAbsolutePath(Trim(FTPRepertoire4));
                  Handle := SFTPClient.OpenDirectory(RootDir);
                end;
              end;
            end;
          end;
          Log('4: Chemin daccès attribué');

          iCompteurFtpDevart := 0; SetLength(FileDownLoadsFtp,iCompteurFtpDevart);
          While not SFTPClient.EOF(Handle) do
            SFTPClient.ReadDirectory(Handle);

// just for view
          for i := Low(FileDownLoadsFtp) to High(FileDownLoadsFtp) do
            Log(' file : ' + FileDownLoadsFtp[i].NameFile + ' - taille : ' + IntToStr(FileDownLoadsFtp[i].TailleFile));

        Except
          ON E:Exception do
          begin
            Log('  ***  Erreur : sFTPClient ');
            Log('  ***  Erreur : Message '+ E.Message);
          end;
        End;
      Finally
        SFTPClient.Disconnect;
        if Assigned(SFTPClient) then FreeAndNil(SFTPClient);
      end;
    Except
      ON E:Exception do
      begin
        Log('  ***  Erreur : Connexion sur le serveur '+FTPHost);
        Log('  ***  Erreur : Message '+ E.Message);
      end;
    End;
  Finally
    SSH.Disconnect;
    if Assigned(SSH) then FreeAndNil(SSH);
  End;
end;

Code: Select all

procedure TServiceCde.ScSSHClientServerKeyValidate(Sender: TObject;
  NewServerKey: TScKey; var Accept: Boolean);
begin
  Accept:=True;
end;
The problem is that I always have this error (LOG file extract)

*** Erreur : Connexion sur le serveur xx.xxx.xxx.xxx
*** Erreur : Message Storage is no set

Aucun fichier à récupérer.
Surely I must be using TscFileStorage incorrectly?

Thank you for your help