On my current project we had a requirement to drop a file onto an SFTP server. SharpSSH seems to the only free and open source option around for .NET
Some of the pain points of SharpSSH
- SharpSSH was written in older version of .NET and relies on algorithms in Org.Mentalis.Security.Cryptography for encryption and hashing which is now natively supported by System.Security.Cryptograph so using SharpSSH as is does not seem right
- Sftp implementation does not support deleting a file (although it is very simple to add that!)
- Not complied with a Strong name key
Making above changes looked easy enough, so here is the download of SharpSSH – SFTP component for .NET which:
- Uses algorithms in System.Security.Cryptograph instead of Org.Mentalis.Security.Cryptography
- Compiled using .NET 3.5 with strong name and Project converted to Visual Studio 2008
- Supports Deleting a file, directory and renaming over SFTP
Open-sourceness of SharpSSH is it’s only benefit. This is an incomplete port of some Java libraries. As such, it’s not supported, doesn’t contain many of features that you will need one day in SFTP and so on. It doesn’t even work right with many servers.
Agree it’s not the “Rolls-Royce” solution but it was perfect more my basic needs, Just sharing the source code changes that I did in the spirit of Open Source
I have been using the SharpSSH without too many issues. One issue the original has is it does not work on 64 bit because I believe org.mentalis.security does not work with 64 bit. Has anyone confirmed the enhanced version works on 64 bit ?
This one does not use org.mentalis.security, it is using .NET’s classes instead
Yes this works on 64bit
I don’t think SFTP in x64 works with this library either. At least I get the same exact error as with the original Tamir SharSSH project. “BAD DATA” There appears to be something broken with connect()
Hi,
I just started using SharpSSH, I need to connect the sftp server and download a file. I get the same error in SharpSSH and in your new version.
My problem is in this method (in ChanelSftp):
private String remoteAbsolutePath(String path)
{
if(path.charAt(0)==’/’) return path;
if(cwd.endsWith(“/”)) return cwd+path;
return cwd+”/”+path;
}
the problem is that cwd is null, this variable should contain the result of a pwd, apparently in the start() method this variable should be populated. I am missing something?
Thanks.
Thanks very much for making your updates and making these changes. I needed a library that was strongly typed so I could register in the GAC and call from a C# Script Task within SSIS. I simply needed to be able to get a listing of files, download one of them, then delete it from the server. I was able to get this up and running very quickly with your help. Thanks again!
Thanks for the project, this was exactly what we needed to implement an SFTP feature in a utility.
I do have a question. It seems that there is a built-in Diffie-Hellman key generation in .NET 4.0. Is the Mentalis Diffie-Hellman library still required for this SharpSSH project? Could the Enhanced SharpSSH project be changed to use the .NET library? I’m not a cryptography expert, so please let me know if you have any insight.
Thank you.
You are probably right, Mentalis Diffie-Hellman library was used as SharpSSH was done in older version of .NET
Hi, thanks for the quick reply. My company had me looking into the encryption library used, and I appreciate the information.
Hi,
why is there an “String Name Key File” in /SolutionItems?
Didn’t see this in the oriignal project, so whats this for?
Best Regards,
Patrick
That is to give the assembly a strong name as I needed dll to be in GAC
Thank you very much for this little enhanced version. I needed delete functionality and this works perfectly!
Thank you for your enhanced version. It solved my sftp.connect(22) issue with .Net 4.
Hi, I am quite new to .net. Can you guys please tell me how you got this working. Did you create an executable or dll from this new source? I am trying to figure out how I can use this new source.
never mind. I figured it out. Thanks
Download link not working. Shows file not found error. It will be very helpful to me if getting this advanced version. Can you please help for the download.
File in place now
file zip not found 😦 ,anyone have this project to share?
Sorry forgot to move the files to the new hosting account, all in place now. You should be able to download the zip file
Yes, now getting the downloads. Thank you very much.
I appreciate your work and will probably use it and build upon it.
Is there a reason you have not added this to the SourceForge Project at http://sourceforge.net/projects/sharpssh/ ?
If I add anything, like the size and modified date of the remote file that I’d like to have, I’ll add it to the project (assuming I can).
Thanks!
Thank you very much. A signed version was exactly what I needed! Much appreciated!
Not be able to download updated zip file.
sorry looks like the hosting account is defunct hence cannot access the files!