Assembly: edtFTPnetPRO (in edtFTPnetPRO.dll) Version: 188.8.131.52
public class KnownHostsManager
Public Class KnownHostsManager
public ref class KnownHostsManager
The known_hosts file contains a list of approved servers and their public keys. Setting ServerValidation to Automatic instructs the client to use this list to validate the servers that it connects to. Setting ServerValidation to AutomaticNoNameCheck is similar, however the server name is ignored in the validation process.
A single line in a known_hosts file looks like this:
edtmobile,10.0.0.3 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAt60CtjBMxiOO qgqfFtKZHY3g99uZpuh5E143FTO4dw+EHWNKemoWq59FMFMIZfSLyUpWmsjVT3PP1bc zOXP1OSn967kxLB/w7Xr84B1ZrTLwuR/ilq73HpgO7A8pdEJN7ybprzhs5CBEgaLQo2 pOxfqRYyc8TO2ADnZ1WwtjW48=
The first field is the hostname, i.e. the SSH server. The IP address is also listed - a number of comma separated hostnames and IP addresses can be listed. The second field is the applicable public key algorithm -"ssh-rsa" (for RSA key pairs) or "ssh-dss" (for DSA key pairs). The third field is the public key encoded using base 64.
The known_hosts file normally consists of multiple lines, one for each of the hosts that the client may wish to connect to. It is quite typical for a host to have entries in two lines, so that both RSA and DSA public keys can be listed.
The path of the known_hosts file should be assigned to the KnownHostsFile property to load the known hosts in that file into the manager. If another known_hosts file is subsequently assigned to this property, its contents will be added to the current list of known hosts. Use ClearKnownHosts()()()() to clear the current list.
Server public keys can also be maintained in their own key file and be used for server validation without adding them to the known_hosts file. The KnownHostsManager supports explicitly adding server public keys in this manner, via AddKnownHost(String, String).
Use WriteKnownHosts(String) to write the current contents of the known hosts lists to a file. If hosts are loaded via the KnownHostsFile and also by AddKnownHost(String, String), the combined list can be merged into one known_hosts file by using WriteKnownHosts(String).