TGPuttyLib SFTP Client DLL based on PuTTY

 
The new TGPuttyLib SFTP Library is a DLL conversion of the psftp program from the well-known PuTTY suite by Simon Tatham.

It allows developers to transfer files with the highest possible transfer rates. Some buffer sizes have been increased to achieve this.

TGPuttyLib Build 2 is based on PuTTY Release 0.73. Ready-to-use classes are currently available for Delphi and Free Pascal. A C/C++ version can easily be made, please ask for it.

The library is currently available for Windows. MacOS and Linux adaptations will follow around the end of 2019.

View this project on GitHub: github.com/superflexible/TGPuttyLib

Or download from here:
Download tgputtylib.dll with source and demos (Build 2, 32 and 64 bit)
Or Download the Windows GUI demo only:
Demo Build 2, 64 bit   Demo build 2, 32 bit

Some bullet points:

  • The PuTTY DLL is 100% thread-safe and can handle a great number of simultaneous connections and transfers. Each connection, and each thread, must have its own TTGPuttySFTP instance.
  • Source code changes have been carefully done in a minimalistic fashion so as to ensure easy adoption of changes in future PuTTY releases.
  • You can choose between the TTGPuttySFTP class and the TTGPuttySFTPClient component. If you choose the class, it must be created completely in source code. The class uses 8-bit strings, whereas the component is Unicode (assuming UTF-8 encoding is expected by the SFTP server). Callbacks (events) will be called in the same thread in which a TTGPuttySFTP method was called – not in the main thread.
  • So far the class and the component have only the methods and properties that I needed. They will become more feature-rich over time. Feel free to send your requests.
  • SSH shell and SCP features will probably be added in a future version.
  • Various demos are included, in particular a fully working SFTP client with GUI (Delphi only), plus a few command line tools written in Delphi and Free Pascal.
  • You can transfer files from file names or streams. You can also open a file directly and obtain a file handle, and implement your own upload loop using the xfer_* functions. That way, you have random access to the file, but the xfer_* functions need to be used in a specific way. There is currently no Pascal example for that, so you need to take a look at the sftp_put_file function in psftp.c.
  • Proxy support is currently missing but I will make all features available that can be found in PuTTY.
  • I compiled the C code with assertions enabled, but they are implemented as Delphi exceptions via a #define and a callback function. I fully intend to leave assertions and exceptions enabled in all release versions.
  • The DLL might save some registry keys in the same location where PuTTY does. This needs to be examined.
  • Contributions, requests and other types of feedback are welcome, please send to my name @ gmail . com (my name is tobiasgiesen)
  • The TGPuttyLib license is the same as the PuTTY license, so it can be used in both open source and commercial projects.

You can find more about PuTTY on the PuTTY Homepage.

The dynamic library modifications and Pascal code are copyright 2019 Tobias Giesen.
They are distributed under the same license as the original PuTTY, see below.

PuTTY License
PuTTY is copyright 1997-2019 Simon Tatham.

Portions copyright Robert de Bath, Joris van Rantwijk, Delian Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus Kuhn, Colin Watson, Christopher Staite, Lorenz Diener, Christian Brabandt, Jeff Smith, Pavel Kryukov, Maxim Kuznetsov, Svyatoslav Kuzmich, Nico Williams, Viktor Dukhovni, and CORE SDI S.A.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.