Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
7.7k views
in .NET FTP by (240 points)
Hi,

I am new to SFTP and do not get the .NET-examples to work.

All I have is the url of the sftp-server the server port and the contents of a PuTTY-User-Key-File-2

I was trying a lot of different things but I didn't get it to work.

I think my main problem is that I don't know how to use the information of the putty-file.

Can please somebody help me?
Here comes the putty file for the test-server:
----------------------------------------------------------------------------------------------------------
PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: lsdpc
Public-Lines: 4
AAAAB3NzaC1yc2EAAAABJQAAAIEAwJOxKVUPNschU0+pd6bSCEEaL3cZfPZXW4KI
zBAhTTRlyaNLMewYewzZed29cDRkX4z0hBtsG92TJNhaR2SLe4ttvhEO8y+YsLSo
SGEexJ0MB294HTqTk9/kvGEeINAWqw7WhUdSiEbwFsBoFkap5ZgqvOupKEh/YmZb
gZtfqJM=
Private-Lines: 8
kD0ejzPvAWYhMh4qFhQ7IpXcxutX1vf+8K9WCdHFIMu08KQdEE9caVumGUViCVkY
zWVMRXc4mlFmDRl1C47BlciZ7eH4iV3pDqL43lO2XLcQNFReZiK9G5GsATXI9W85
fs6CtwuQb0o+KrfI5kIx6+/Yxyd0yvjT456tE0bBCvDKbtPUOUqbp+HmB7E4b9Ed
rv8Fu5LQua4rVIXbkZ9uymOUyBGxySAD9X+icnqktU7NYtglJd4ko+ip2AdiMZR/
/crylQV28ZyGj6+podhcXot0aLfh9Vyil/8KSom8f9fv0Jp223IPlg0L1mjMy8rL
YMNLVEpe5YLHCb9sRuiFAnbhoZhPSf7VCuwGGmyPI6O+CTRCr2YXecG7K+aWAkfi
wfhgRVHpHwebsKJdiFXXVlNJIZOmy2pOolw0t98dixe52kX8oyaf+D2DeShTbx2B
DaX7FCEEtfOXOSTzbX+oRg==
Private-MAC: edec32778e911830b20f78c1844e3e3d01b4ebdf
----------------------------------------------------------------------------------------------------------

5 Answers

0 votes
by (162k points)
Putty keys are a proprietary format that we don't support.

It is very easy to convert your Putty private key (similarly for public keys) into either of the formats supported (OpenSSH and SSH.com).

Simply download PuttyGEN:

http://www.chiark.greenend.org.uk/~sgta ... nload.html

Just grab the PuTTYgen.exe from there and run it.

There's a File->Load menu item to load your private key.

Then use Conversions -> Export OpenSSH key to export it in OpenSSH format.

There's more details in the Developer's Guide.
0 votes
by (240 points)
Dear Bruce,

thank you for yor quick reply!

I feel a little bit stupid because I don't get it to work...

If I export the key to OpenSSH Key I get somthing like this:

-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQDAk7EpVQ82xyFTT6l3ptIIQRovdxl89ldbgojMECFNNGXJo0sx
[...]
fN935De2dHQ81AzdAkEA71FXg3vY/UaUaR5mE73UOp3jkZjANCEyYuS7BlFtZduQ
f1yUvzByuEWFc5s5w6niOPUpd0mcV5/6COpee2Syrw==
-----END RSA PRIVATE KEY-----

I tried a lot of different things but how do I have to change the file for edtFTPnet?
0 votes
by (240 points)
Hi,

I found the solution....

here it comes:

ftpConnection.ServerAddress = serverAddress
ftpConnection.ServerPort = serverPort
ftpConnection.UserName = userName
ftpConnection.Password = password

' select SFTP
ftpConnection.Protocol = FileTransferProtocol.SFTP

' turn on server validation and set the public key for the host
ftpConnection.ServerValidation = SecureFTPServerValidationType.None

ftpConnection.AuthenticationMethod = AuthenticationType.PublicKey

ftpConnection.ClientPrivateKeyFile = publicKeyFile

ftpConnection.Connect()
0 votes
by (162k points)
It looks like you need the public key rather than the private key. Have you converted the Putty public key into OpenSSH?
0 votes
by (240 points)
It looks like you need the public key rather than the private key. Have you converted the Putty public key into OpenSSH?


Hi Bruce,

yes, I converted it into openSSH

It works wenn I add these lines to my code....

ftpConnection.ServerValidation = SecureFTPServerValidationType.None
ftpConnection.AuthenticationMethod = AuthenticationType.PublicKey
ftpConnection.ClientPrivateKeyFile = publicKeyFile

thanks for your help!
As I solved the base-problems I think its time to purchase the pro-version :-)

Chris

Categories

...