Recent

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

snorkel

  • Hero Member
  • *****
  • Posts: 810
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
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 2.06 and FPC 3.0.4
OS: Windows 10 64 bit

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning 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
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

ludob

  • Hero Member
  • *****
  • Posts: 1173
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: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning 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 :)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

snorkel

  • Hero Member
  • *****
  • Posts: 810
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***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 2.06 and FPC 3.0.4
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 810
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/
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 2.06 and FPC 3.0.4
OS: Windows 10 64 bit

ludob

  • Hero Member
  • *****
  • Posts: 1173
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

  • Hero Member
  • *****
  • Posts: 810
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.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 2.06 and FPC 3.0.4
OS: Windows 10 64 bit

ludob

  • Hero Member
  • *****
  • Posts: 1173
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: 1173
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

  • Hero Member
  • *****
  • Posts: 810
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?
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 2.06 and FPC 3.0.4
OS: Windows 10 64 bit

ludob

  • Hero Member
  • *****
  • Posts: 1173
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.

sebastiaanv

  • Newbie
  • Posts: 4
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #12 on: August 02, 2015, 11:10:45 pm »
Hi there, i compiled with success the examples for ssh with synapse. But when i try it out on a suse linux box it does not work with the example code. In the linux box logging i notice the following error: dispatch_protocol_error: type 90 seq 4 [preauth]

Does anyone have an idea what would be the cause?

eny

  • Hero Member
  • *****
  • Posts: 1597
All posts based on: Win10 (Win64); Lazarus 1.8.0 'stable' (#56594 win64) unless specified otherwise...

Thaddy

  • Hero Member
  • *****
  • Posts: 10289
Re: SSH DLL (w-putty-cd) could we use this in Lazarus?
« Reply #14 on: August 03, 2015, 07:52:09 am »
Does anyone have an idea what would be the cause?
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3Try the New Topic button.
http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

That means either:
- the  server doesn't allow password logins(and if you weren't trying that:)
- the certificate is not properly installed.

Can also be a case of obsolete encryption: ssl2, ssl3 tls1.0 but my first point is more likely.

At least your program works on suse ;)
« Last Edit: August 03, 2015, 07:57:33 am by Thaddy »
I am more like donkey than shrek

 

TinyPortal © 2005-2018