3

As I am working on a .NET C# project which uses WinSCP .NET assembly, for SFTP password less connection. By far I have made an UI where we have to provide SSH key fingerprint, paraphrase, and path of .ppk file.

My question is that, is there any way to get "SSH key fingerprint" automatically through code, if the user gives its .ppk file path only?

1 Answer 1

5

The .ppk is a key pair of your account and you specify that using the SessionOptions.SshPrivateKeyPath.

While the host key for SessionOptions.SshHostKeyFingerprint is for key pair of the server (= host). It's not a public key of your key pair.

These key pairs have nothing in common. You cannot extract one from another.

For details, see Understanding SSH key pairs.

See also Where do I get SSH host key fingerprint to authorize the server?


If you want to allow the user to verify the host key manually, use the Session.ScanFingerprint method to retrieve the fingerprint for verification. Once verified, assign the verified fingerprint to the SessionOptions.SshHostKeyFingerprint.

For an example, see Implementing SSH host key cache (known hosts).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.