* * *

Author Topic: SSH DLL (w-putty-cd) could we use this in Lazarus?  (Read 1336 times)

snorkel

  • New member
  • *
  • Posts: 38
SSH DLL (w-putty-cd) could we use this in Lazarus?
« on: February 02, 2012, 04:47:57 pm »
Anyone good at converting C header files?
If we could get this converted we could finally have a nice way to do SSH in Lazarus without having to use Cryptlib.

http://www.winputty.com/Docs/docs.html

BigChimp

  • Hero Member
  • *****
  • Posts: 1012
    • CheckRide remote control and other open source projects
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #1 on: February 05, 2012, 07:48:49 pm »
I think I'd rather use cryptlib; seems like that project is not very active, and with cryptlib one would have cross-platform support (I hope)...

Regards,
BigChimp
CheckRide remote control and other open source projects:
https://bitbucket.org/reiniero/

ludob

  • Hero Member
  • *****
  • Posts: 623
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #2 on: February 05, 2012, 09:07:32 pm »
cryptlib is multi platform but has a difficult licence:
Quote
cryptlib is distributed under a dual license that allows free, open-source use under a GPL-like license (aka the “Sleepycat” license) and closed-source use under a standard commercial license. In addition, cryptlib is often free for use in low-cost, non-open-source applications such as shareware, and for personal and research use.

Winputty seems to be limited in that it uses putty in interactive mode only. It is basically the putty application embedded in a dll. Not sure how this is going to interact with the LCL and no possibility to use it in a secure tunnel type of service or console application.

I believe http://www.libssh.org/ and http://www.libssh2.org/ are better candidates for fpc integration. Both have linux and windows binaries available and both can use openssl for the crypto stuff.

BigChimp

  • Hero Member
  • *****
  • Posts: 1012
    • CheckRide remote control and other open source projects
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #3 on: February 05, 2012, 10:07:39 pm »
cryptlib is multi platform but has a difficult licence:
Yep, IIRC, if you make more than $5,000 out of your product, you'll have to cough up money for cryptlib....

I believe http://www.libssh.org/ and http://www.libssh2.org/ are better candidates for fpc integration. Both have linux and windows binaries available and both can use openssl for the crypto stuff.
Agreed. And I like BSD licenses, so libssh2 looks good :)
CheckRide remote control and other open source projects:
https://bitbucket.org/reiniero/

snorkel

  • New member
  • *
  • Posts: 38
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #4 on: February 07, 2012, 11:02:53 pm »
I wasn't aware of the libssh2 project, and do agree that would be a better candidate.
The problem with cryptlib as already stated is the license.

It would be great to have a SSH option for Lazarus that worked on win32/64 and Linux.

snorkel

  • New member
  • *
  • Posts: 38
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #5 on: February 07, 2012, 11:10:06 pm »
looks like someone has already translated the header files:
https://bitbucket.org/ZeljkoMarjanovic/libssh2-delphi/src/9f079e7ddfca/src/

ludob

  • Hero Member
  • *****
  • Posts: 623
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #6 on: February 08, 2012, 09:58:57 am »
looks like someone has already translated the header files:
https://bitbucket.org/ZeljkoMarjanovic/libssh2-delphi/src/9f079e7ddfca/src/
Downloaded the files but couldn't find any copyright info regarding the delphi port. The author left the original copyright and added '// **zm ** translated to pascal'.  Presumable he uses the same license as libssh2 but I asked for confirmation on bitbucket.
The translation seems complete at first sight but it is version 1.2.6 while latest libssh2 is 1.4.0. Don't know if this is a real problem since the libssh2 team puts forward the stability of their API when comparing to libssh. The cryptlib header is also a few revisions behind and we all know that the API changes with virtually every release.
I'll give it a shot in modifying the code for fpc and linux.

snorkel

  • New member
  • *
  • Posts: 38
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #7 on: February 08, 2012, 04:19:21 pm »
I also found a Python binding for libssh2, and while it's not pascal, it does give a general overview of how it would work in Pascal.
(http://www.no-ack.org/2010/11/python-bindings-for-libssh2.html)
It would seem that it should work similar to the Synapse bindings for cryptlib.  I may get on the Synapse mailing list and see if Lucas has
any interest in supporting libssh2 from synapse.

ludob

  • Hero Member
  • *****
  • Posts: 623
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #8 on: February 08, 2012, 04:59:28 pm »
I ported the code to freepascal and got a simple console program replacing ssh (without -X, no certificate authorisation) working on both windows and linux. As long as the copyright question is pending I can't upload it here. I'll give the author of the Delphi port another few weeks to react and, if no or positive reaction, publish the code. In the mean time, if interested, you can send me your e-mail address in PM and I'll send you the code on the promise that it is for testing only and will not be distributed further.

ludob

  • Hero Member
  • *****
  • Posts: 623
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #9 on: February 09, 2012, 09:04:19 am »
Got the green light from Zjelko.

Attached the libssh2 bindings and a small test program. Compile it and run from console: testssh username host. The program will prompt for the password. The program is tested with libssh2.so build from the latest (1.4.0) and libssh2.dll downloaded from http://www.libssh2.org/mail/libssh2-devel-archive-2010-04/0043.shtml (rename libssh2-1.dll to libssh2.dll).

snorkel

  • New member
  • *
  • Posts: 38
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #10 on: February 10, 2012, 05:10:49 pm »
Wow, nice job.  I will check it out as soon as I can.
What socket library did you use for the test?

ludob

  • Hero Member
  • *****
  • Posts: 623
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #11 on: February 10, 2012, 05:48:02 pm »
What socket library did you use for the test?
Synapse.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads