Table of Contents

Method Add

Namespace
SshSharp.Config
Assembly
SshSharp.dll

Add(string, int, SshPublicKey, bool, string?, KnownHostsMarker)

Appends an entry for a host's key, as Add(string, int, string, ReadOnlySpan<byte>, bool, string?, KnownHostsMarker) does with its type and blob. The key's own Comment is not written; pass comment for one.

public KnownHostsEntry Add(string host, int port, SshPublicKey key, bool hash = false, string? comment = null, KnownHostsMarker marker = KnownHostsMarker.None)

Parameters

host string

The host name or address.

port int

The port.

key SshPublicKey

The host's key.

hash bool

Whether to store the host hashed (HashKnownHosts).

comment string

An optional comment.

marker KnownHostsMarker

An optional marker.

Returns

KnownHostsEntry

Add(string, int, string, ReadOnlySpan<byte>, bool, string?, KnownHostsMarker)

Appends an entry for a host.

public KnownHostsEntry Add(string host, int port, string keyType, ReadOnlySpan<byte> publicKey, bool hash = false, string? comment = null, KnownHostsMarker marker = KnownHostsMarker.None)

Parameters

host string

The host name or address.

port int

The port.

keyType string

The key type, for example ssh-ed25519.

publicKey ReadOnlySpan<byte>

The public key blob.

hash bool

Whether to store the host hashed (HashKnownHosts).

comment string

An optional comment.

marker KnownHostsMarker

An optional marker.

Returns

KnownHostsEntry