Rebex SFTP API connection usage

ayadhalalayadhalal AEMember ✭✭

Hello ,

Im using Xamarin/iOS to build a mobile app and Im testing Rebex API component to connect to an SFTP site .Im using the below code in C# in order to connect to a normal FTP site and get a stream object .

var ftp_request = FtpWebRequest.Create (“ftp://ftp_site" + path);

         var ftp_credentials = new NetworkCredential (“username", “password");

         ftp_request.Credentials = ftp_credentials;


         using (FtpWebResponse response = (FtpWebResponse)ftp_request.GetResponse ())
         using (Stream stream = response.GetResponseStream()) {
                 MemoryStream m = new MemoryStream ();
                 stream.CopyTo (m);

                 return m.ToArray ();
             } 

The sftp site Im trying to connect is on amazon and it uses .ppk and .pem file in order to connect to the SFTP site .

My inquiry is how can I connect to the SFTP using the .ppk or .pem in away similar to the above code and do I need a password ? The admin says there is no password required but looking at the Rebex documentation in below ,It requires a password in order to connect to the sftp site .

// connect to a server and verify fingerprint
var client = new Sftp();
client.Connect(hostname);

// load the private key
SshPrivateKey privateKey = new SshPrivateKey("my_key.ppk", "key_password");

// log in
client.Login(username, privateKey);

Regards
Ayad

Tagged:
Sign In or Register to comment.