Constructor KnownHostsEntry
KnownHostsEntry(string, string, ReadOnlyMemory<byte>, KnownHostsMarker, string?)
Creates an entry.
public KnownHostsEntry(string hostPatterns, string keyType, ReadOnlyMemory<byte> publicKey, KnownHostsMarker marker = KnownHostsMarker.None, string? comment = null)
Parameters
hostPatternsstringComma-separated host patterns, or a single hashed host (
|1|salt|hash).keyTypestringThe key type, for example
ssh-ed25519.publicKeyReadOnlyMemory<byte>The public key blob (the decoded base64 field).
markerKnownHostsMarkerThe optional marker.
commentstringThe optional trailing comment.
Exceptions
- ArgumentException
hostPatternsorkeyTypeis empty or contains white space or control characters,hostPatternsstarts with@or#(the line would be read as a marker line or a comment), orcommentcontains control characters other than a tab. Any of them would let ToLine() write extra fields or extra lines (a@cert-authorityline, say) intoknown_hosts.
KnownHostsEntry(string, SshPublicKey, KnownHostsMarker, string?)
Creates an entry for key, with its type and blob. The key's own Comment is not used.
public KnownHostsEntry(string hostPatterns, SshPublicKey key, KnownHostsMarker marker = KnownHostsMarker.None, string? comment = null)
Parameters
hostPatternsstringComma-separated host patterns, or a single hashed host (HashHost(string, int, ReadOnlySpan<byte>)).
keySshPublicKeyThe key.
markerKnownHostsMarkerThe optional marker.
commentstringThe optional trailing comment.