Solved

.net Sftp request.EnableSsl

Posted on 2014-03-28
4
1,259 Views
Last Modified: 2014-06-10
Looking for a code snip that will retrieve a file and dir listing from a SFTP server.

Found a couple of examples on-line look promising but keep getting an error:

"System.Net.WebException: The remote server returned an error: 234 SSL enabled... start negotiation . ---> System.IO.IOException: The handshake failed due to an unexpected packet format.  ..."

    Dim request As System.Net.FtpWebRequest = DirectCast(WebRequest.Create(New Uri("ftp://sftp.domain.com/myFile.txt")), System.Net.FtpWebRequest)
    request.Method = WebRequestMethods.Ftp.DownloadFile
    request.EnableSsl = True
    request.Credentials = New Net.NetworkCredential("username", "password")
    request.UsePassive = True
    Dim response As System.Net.FtpWebResponse = DirectCast(request.GetResponse(), System.Net.FtpWebResponse)

Open in new window


Any help is appreciated.
0
Comment
Question by:sidwelle
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39962832
SFTP uses SSH, not SSL/TLS.  They are not the same or even compatible encryption methods.  You will have to find an SSH/SFTP library to make that connection.
0
 

Author Comment

by:sidwelle
ID: 39963175
I see a lot of examples using the "SharpSSH" library, are there any others ?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39963184
0
 

Author Closing Comment

by:sidwelle
ID: 40124185
Dazve, thanks for the help.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question