edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing
Click or drag to resize

KnownHostsManagerAddKnownHost Method (String, String)

Add a hostname/public key pair to the known hosts data.

Namespace:  EnterpriseDT.Net.Ftp.Ssh
Assembly:  edtFTPnetPRO (in edtFTPnetPRO.dll) Version: 12.3.0.0
Syntax
public void AddKnownHost(
	string host,
	string publicKeyFile
)

Parameters

host
Type: SystemString
hostname
publicKeyFile
Type: SystemString
public key file for host
Remarks
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 using this method. SSH public key files have two standard formats - OpenSSH and SECSH. Both these public key formats are supported. Formats can be recognized by their first line as shown below:
  1. OpenSSH (DSA) - OpenSSH format as a DSA public key. The first line begins with "ssh-dss AAAAB3NzaC1kc3MAA ...".
  2. OpenSSH (RSA) - OpenSSH format as a DSA public key. The first line begins with "ssh-rsa AAAAB3NzaC1yc2EAA ...".
  3. SECSH - SECSH format. The first line begins with "---- BEGIN SSH2 PUBLIC KEY ----"
You can convert between OpenSSH and SECSH formats using OpenSSH's ssh-keygen utility (which by default generates OpenSSH keys).
See Also