At this point, your boss asks you to send a file over to a vendor's [S]FTP server. After you do some research and figure out that he really means SSH File Transfer Protocol, the battle is half won. You can simply send that file using most ftp programs available. I had no idea. I personally use CoreFTP and was pleasantly surprised to find a nice little SSH/SFTP checkbox in the bottom right corner of the connection screen.

Now you want an api. SharpSSH is such a library that does SFTP along with a host of other things. Download demos and source files here.
Here is how simple it is to encrypt a file by using PGP. I decided to go with the open source route. Gnu Privacy Guard provides a simple wrapper class that makes it easy to encrypt/decrypt messages:
StreamReader reader = new StreamReader(readFromFile);
StreamWriter writer = new StreamWriter(writeToFile);
string output = "";
// Begin encryption
GnuPGWrapper wrapper = new GnuPGWrapper();
wrapper.homedirectory = "C:\\gnupg";
wrapper.passphrase = "";
wrapper.originator = "";
wrapper.recipient = "blah@blah.com";
wrapper.command = Commands.Encrypt;
wrapper.verbose = VerboseLevel.VeryVerbose;
wrapper.ExecuteCommand(reader.ReadToEnd(), out output);
writer.Write(output);
All the other SFTP libraries that I have seen are way overpriced. This is a good one:
ReplyDeletehttps://www.kellermansoftware.com/p-41-net-sftp-library.aspx