Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Remi Tavernier

Thanks a lot for your help,

you can mark this post as Resolved
martin

Remi Tavernier wrote:

The first time you connect using WinSCP, it ask you if you want to accept the public key host? If you had it to the cache, it will not ask you again.

I just want it to work the same way like the linked exemple show.

Is it bad ? Should I let the user always click on something to accept the connection ?

That's fine. You just need to get the user involved on every new or changed hostkey.
Remi Tavernier

The first time you connect using WinSCP, it ask you if you want to accept the public key host? If you had it to the cache, it will not ask you again.

I just want it to work the same way like the linked exemple show.

Is it bad ? Should I let the user always click on something to accept the connection ?
Remi Tavernier

Ok, thank you I really misunderstood this line.

So I must learn the server public key the first time I try to connect to it.

Here there is a guide to implement ssh host key cache.
Using the C# exemple it is prety easy to do a vb.net Code.

I will try to write a small sample of code to make it work.

https://winscp.net/eng/docs/library_example_known_hosts

Thanks
martin

Re: SFTP Decrypt Public Key using PPK file and password

The SshHostKeyFingerprint has nothing to do with private/public key of your account. It's your server's public key.

To understand, see:
https://winscp.net/eng/docs/ssh_keys
Remi Tavernier

SFTP Decrypt Public Key using PPK file and password

Hi,

I'm currently programming in vb.net a software that needs to connect to an SFTP server.

I have a .ppk file with my public en private key in it (encoded). I also know my user name and password to connect to the server.

If I connect using Winscp application directly using the ppk file and the passwords I know, I can connect fine.
From there I can generate the code to connect directly using the assembly.

I manage to connect using the assembly, there is no problem about that.

My only problem is that the ".SshHostKeyFingerprint" variable from the sessionoptions that I use is hardwritten.

I would like to be able to generate the ".SshHostKeyFingerprint" directly using my ".SshPrivateKeyPath" and the password linked to it. Thus I need to decrypt the public key in the ppk file using the password I suppose.

Can anyone help me on that?

Cordialy,

Tavernier Rémi