How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
karmacomposer
Posts: 11
Joined: Mon 02 Aug 2021 21:57

How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by karmacomposer » Mon 02 Aug 2021 22:01

We purchased the Securebridge product with source code and need to program SSH in our applications.

I loaded the sbridge10 package file and compiled it. I do not see any new additions to Lazarus. I also do not see any demos specifically for Lazarus/Free Pascal.

Could you please lead me to the demos and any guidance on successfully installing and using SSH and/or SFTP in Lazarus Free Pascal current version. Thank you.

Also, is there any problems using this with DCrypt library?

Thanks.

Mike

karmacomposer
Posts: 11
Joined: Mon 02 Aug 2021 21:57

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by karmacomposer » Mon 02 Aug 2021 22:22

I was able to install the components. However, I would very much appreciate demos for Lazarus/Free Pascal.

Are there demos or code fragments/examples?

Thank you.

Mike


YanishevskiyVI
Devart Team
Posts: 70
Joined: Wed 02 Jun 2021 09:30

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by YanishevskiyVI » Fri 06 Aug 2021 10:53

Hi Mike,

There is no speciefic use-case provided for Lazarus.
SecureBridge works on Lazarus totally in the same manner as it works on Delphi.

The Demos provided for Delphi can be easily imported into a Lazarus with menu command:

Tools\Delphi Conversion>\Convert Delphi Project to Lazarus project...

Note: there is known issues with Lazarus convertor behavior, such as:
  • missing and adding incorrect references in uses clause
  • incorrect methods renaming
In such case, you need to deal with it locally.

We plan to add demos directly for Lazarus in the future.

Regards,
Vitaliy

karmacomposer
Posts: 11
Joined: Mon 02 Aug 2021 21:57

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by karmacomposer » Mon 09 Aug 2021 16:37

Thank you. I tried converting a Delphi project (SFTP) to Lazarus and it resulted in errors in two units.

I will have to re-unzip the demos since Lazarus deleted the originals. I would tell you which units failed, but I cannot remember them now - I'll have to try again and write down the two offending units.

In the meantime, which controls do I need to drag to a form to utilize SFTP send and receive. That is all I want to do. Send a file to a server IP address and receive a file from a server IP address. If anyone could provide a tiny code example of how to program simply sending and receiving SFTP using securebridge and which controls must be on the form - that would help me tons.

Thank you.

Mike

YanishevskiyVI
Devart Team
Posts: 70
Joined: Wed 02 Jun 2021 09:30

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by YanishevskiyVI » Wed 11 Aug 2021 07:04

Hi Mike!

Thank you for your reply!

Please, try to place TScSFTPClient https://www.devart.com/sbridge/docs/ind ... client.htm

Code: Select all

ScSFTPClient1.SSHClient := ScSSHClient1; 
ScSFTPClient1.Initialize; 
... 
ScSFTPClient1.DownloadFile(RemoteFileName, LocalFileName, OverwriteEnable); 
ScSFTPClient1.UploadFile(LocalFileName, RemoteFileName, OverwriteEnable);
Should you have any other questions, do not hesitate to ask!

Regards,
Vitaliy

karmacomposer
Posts: 11
Joined: Mon 02 Aug 2021 21:57

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by karmacomposer » Thu 26 Aug 2021 02:46

Thank you. How do I reference the SFTP control (TScSFTPClient) from a non-form unit?

I need to reference it in the uses clause.

Thank you.

YanishevskiyVI
Devart Team
Posts: 70
Joined: Wed 02 Jun 2021 09:30

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by YanishevskiyVI » Thu 26 Aug 2021 10:20

Hi Mike,

TScSFTPClient is defined in unit ScSFTPClient
There are several ways how to check:

- if you have SecureBridge installed, just type anywhere in the IDE Code editor TScSFTPClient, and press F1
- take a look on our online documentation: https://www.devart.com/sbridge/docs/

Regards,
Vitaliy

karmacomposer
Posts: 11
Joined: Mon 02 Aug 2021 21:57

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by karmacomposer » Fri 08 Oct 2021 16:46

Thank you. We are now using Delphi Rad Studio Architect.

We bought securebridge, so we are using the commercial licensed version. I have yet to get anything working.

The above documentation links give 404 errors.

I figured out how to change the port, but I am getting a SHA error when I try to connect.

This is all very complex for a simple procedure. I just want to send and receive files through an ssh tunnel (hence the sftp).

I do not understand the relationship between the filestore, ssh client and sftp client. I know you need all 3 on the form, but how do you set them up to SFTP a file?

Right now, I have this code:

Code: Select all

ScFileStorage := TScFileStorage.Create(nil);
ScSSHClient := TScSSHClient.Create(nil);
ScSSHClient.KeyStorage := ScFileStorage;
ScSSHClient.Port := 522;
//ScSSHClient.OnServerKeyValidate := ScSSHClientServerKeyValidate;
ScSSHClient.HostName := serverHostName;
ScSSHClient.User := serverUsername;
ScSSHClient.Password := serverPassword;
ScSSHClient.Connect;

ScSFTPClient := TScSFTPClient.Create(nil);
ScSFTPClient.SSHClient := ScSSHClient;
ScSFTPClient.Initialize;
ScSFTPClient1.UploadFile(varUploadFile, varServerFile, True);
//ScSFTPClient.DownloadFile(varDownloadFile, varDownloadFile, False);
ScSSHClient.Disconnect;
When I tried to include this, it gave me an undeclared identifier error for ScSSHClientServerKeyValidate:

Code: Select all

procedure TfrmRubidexCoreTechDemo.ScSSHClientServerKeyValidate(Sender: TObject; NewServerKey: TScKey; var Accept: Boolean);
begin
  Accept := True;
end;
So I deleted it.

As a result, I commented out this line because it gave me errors:

//ScSSHClient.OnServerKeyValidate := ScSSHClientServerKeyValidate;

I get a sha256 error when I run this (yes, the port is correct). The variables (serverHostName, serverUsername, serverPassword, etc) are filled in above this code and are correct.

I have not defined any keys because I do not understand that part. I do not understand how a server should have a key and then it should match in the program. In other languages, I would just use ssh commands and they would just work. Yours seems to require too much configuration just to get started.

Is there an easy way to simply send and receive files through ssh?

Mike

YanishevskiyVI
Devart Team
Posts: 70
Joined: Wed 02 Jun 2021 09:30

Re: How do you install the purchased version of Securebridge on Free Pascal Lazarus?

Post by YanishevskiyVI » Thu 21 Oct 2021 13:48

Hi Mike,

Thank you for your reply!

The answer has already been provided to your question in your duplicate forum request, you can also check it there:
viewtopic.php?p=200714#p200714

I will also resend it here for your convenience:
YanishevskiyVI wrote: Wed 20 Oct 2021 13:52 Hi Mike,
karmacomposer wrote: The above documentation links give 404 errors.
Yes that's right we have expirience some technical difficulties, here is a correct link

Code: Select all

https://www.devart.com/sbridge/docs/
Please be informed, we provide offline help, included into a distributive. You may use in in a general way, by pressing F1 (WinHlp32 need to be installed)
karmacomposer wrote:I do not understand the relationship between the filestore, ssh client and sftp client. I know you need all 3 on the form, but how do you set them up to SFTP a file?
Yes, they are necessary.
  • TScSSHClient create and maintain SSH connection
  • TScFileStorage used for connection data storing (such as keys and certificates, but NOT files from remote file system, don't be confused!) it is mandatory for TScSSHClient.
  • TScSFTPClient perform file operations thru secure connection, created by TScSSHClient.
karmacomposer wrote: Right now, I have this code:

Code: Select all

...
When I tried to include this, it gave me an undeclared identifier error for ScSSHClientServerKeyValidate:
Please add ScBridge to your uses clause, it must help. Other portion of code is perfect.
karmacomposer wrote:I have not defined any keys because I do not understand that part. I do not understand how a server should have a key and then it should match in the program. In other languages, I would just use ssh commands and they would just work. Yours seems to require too much configuration just to get started.
Other languages uses external libraries, and executing step-by-step by series of calls. TScSSHClient perform desired actions automatically, thus, previously need to be properly configured. That's a difference.

A typical connection scenario looks like this:
  • TScSSHClient connects to Server;
  • The Server sends its Key;
  • The TScSSHClient performs Validation of this Key: searches in the TScStorage, and if it is not there, generates a OnServerKeyValidation event, where it is necessary to decide whether to accept the Key or not (this is what the event is for, so implementing as Accept := True it's not a good idea);
  • If the Key is accepted, it is storing into a TScStorage (thus next time stored Key will be found and OnServerKeyValidation will not occur) and the connection is established;
  • Now TScSFTPClient is able to perform file operations on the Server.
Regards,
Vitaliy


In case of any further questions, feel free to reply to this thread in order not to confuse between the topics to avoid any information missing!

Post Reply