0 votes
by (120 points)
edited

In my project , the "SshSession.Fingerprint" property what I have received from the server is not the exact what is present in the server.

Can any one help me or give more information about "SshSession.Fingerprint" property? Is any alternative is there for this or how to get public key from the server usibg rebex?

Regards, Srivatsa

1 Answer

0 votes
by (148k points)
edited

Server fingerprint, a hash of the server's public key, depends on:

1. The negotiated host key algorithms (most servers support at least two algortihms (RSA and DSA), it's up to the client which one it selects and each uses a different public key.

Rebex SFTP and Rebex SSH use DSA by default, but many other clients prefer RSA, leading to different fingerprints. To prefer RSA as well, set SshParameters.PreferredHostKeyAlgorithm to SshHostKeyAlgorithm.RSA (check out this tutorial for information on setting SSH parameters).

2. The hash algorithm used to calculate the key.

Sftp and Ssh object's Fingerprint property always return an MD5 hash of the server's public key, but SshSession object offers more - its Fingerprint property is an SshFingerprint object whose ToString method accepts an argument, making it possible to get a fingerprint calculated using another hash algorithms. To get an SHA-256 fingerprint from a connected Sftp object, use the following code:

string fingerprint = sftp.Session.Fingerprint.ToString(SignatureHashAlgorithm.SHA256);

It's not currently possible to get the server public key, but the next release already has this feature. It will be released very soon, but if you would like to try a beta, please let me know.

...