1

I'm trying to send files using SFTP with public/private keys. I've found examples in C# but very few in VB. Trying to convert, I've got this far, but get an error at the first line despite being sure the key file is ok (works via FileZilla)

openssh key type: ssh-rsa is not supported

Here's what I have:

Dim PKF As New PrivateKeyFile("C:\Users\jonfi\.ssh\id_rsa")
Dim PrivateKeyAuth = New PrivateKeyAuthenticationMethod(My.Settings.SFTPUser, PKF)
Dim ConnectionInfo As New ConnectionInfo(My.Settings.ServerAddress,_ 
    My.Settings.ServerPort, My.Settings.SFTPUser, PrivateKeyAuth)
 
Dim client As New Renci.SshNet.SftpClient(ConnectionInfo)

client.Connect()

' ...etc.

Note: I've hard coded the key path just for clarity. Any help, much appreciated.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Jon Fisher
  • 11
  • 2

0 Answers0