ddn.net.ssh.known_hosts
known_hosts parsing and host trust matching.
Parses the OpenSSH known_hosts format - plain and hashed host patterns, wildcard and negated patterns, markers, comments - and answers whether a presented host key is trusted, unknown, changed, or revoked for a target (host, port) plus optional caller aliases.
Policy notes:
- Parsing is strict: a malformed file throws instead of being
silently skipped, so trust decisions fail closed.
- Entries whose key type has no enabled public-data parser -
ecdsa-sha2-nistp384/nistp521, certificate, and security-key types - are skipped the way OpenSSH ignores key types it does not use; the enabled profile never negotiates them, so they cannot match a presented key.
- A matched
@revokedentry marks the host revoked andoverrides everything else.
@cert-authorityentries never act as plain trustedkeys; they surface as a distinct unsupported outcome while certificate validation is out of scope.
- The file is never modified; there is no accept-new
behaviour here.
Types 5
Outcome of a known_hosts lookup for a presented key.
known_hosts limits from the support matrix.
One parsed known_hosts entry.
bool revokedTrue when marked @revokedbool certAuthorityTrue when marked @cert-authoritystring[] patternsHost pattern field items, negation flags includedstring keyTypeKey-format name from the lineconst(ubyte)[] keyBlobDecoded key blobA parsed known_hosts database.
SshKnownHostsResult check(string host, ushort port,
const(ubyte)[] keyBlob, string[] aliases = null) const @safeLooks up a presented key for a target host.this(SshKnownHostsEntry[] entries)