The TGPuttyLib SFTP Library is a library 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 is based on PuTTY Release 0.74. Ready-to-use classes are currently available for C++, Delphi and Free Pascal.
The library is currently available for Windows, macOS and Linux.
View this project on GitHub: github.com/superflexible/TGPuttyLib
(The macOS libraries and some Linux libraries for additional CPU types are currently only on GitHub, not in the downloads below.)
Some bullet points:
- In Delphi, please consider consider just using the TTGPuttySFTP class in tgputtysftp.pas rather than the TTGPuttySFTPClient component in tgputtysftpclient.pas. See our recommendation on GitHub for details.
- 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.
- 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 C++, 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 has been available since build 8.
- 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 no longer uses any of PuTTY’s registry keys.
- 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-2020 Tobias Giesen.
They are distributed under the same license as the original PuTTY, see below.
PuTTY is copyright 1997-2020 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.