KnownHostsVerifier

class KnownHostsVerifier(file: File, hostname: String, port: Int = 22) : HostKeyVerifier(source)

A host key verifier that reads from an OpenSSH-style known_hosts file.

Currently supports:

  • Plain hostnames (no hashed hosts yet)

  • Wildcards (* and ?) in hostnames

  • Multiple keys per host

  • Certificate authorities (@cert-authority) and revoked keys (@revoked)

  • Negated hostname patterns and optional KRL revocation snapshots

Parameters

file

The known_hosts file to read.

Constructors

Link copied to clipboard
constructor(file: File, hostname: String, port: Int = 22)
constructor(file: File, hostname: String, port: Int, revocations: SshKeyRevocationList)

Use an application-loaded KRL snapshot in addition to known_hosts revocations.

constructor(file: File, hostname: String, revocations: SshKeyRevocationList)

Functions

Link copied to clipboard
open suspend fun addKeys(keys: List<PublicKey>)

Persist the supported keys advertised by an authenticated server after every requested proof of private-key possession has been verified. Runs outside packet routing. Read-only verifiers may keep the default implementation.

Link copied to clipboard
open suspend fun removeKeys(keys: List<PublicKey>)

Retire the authenticated key when omitted from the advertisement, after addKeys returns successfully. Other stored keys are not enumerated or removed.

Link copied to clipboard
open suspend override fun verify(key: PublicKey): Boolean

Verify the server's host key.