public final class HostKeyHelper extends ObjectHelper methods to allow loading and saving of host keys for a computer. Verifiers don't have a reference to the Node or Computer that they're running for at the point they're created, so can only load the existing key to run comparisons against at the point the verifier is invoked during the connection attempt.
- Michael Clarke, M Ramon Leon
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
getHostKey(Computer host)Retrieve the currently trusted host key for the requested computer, or null if no key is currently trusted.
saveHostKey(Computer host, HostKey hostKey)Persists an SSH key to disk for the requested host.
public static HostKeyHelper getInstance()
public HostKey getHostKey(Computer host) throws IOException
host- the Computer to retrieve the key for.
- the currently trusted key for the requested host, or null if no key is trusted.
IOException- if the host key can not be read from storage
public void saveHostKey(Computer host, HostKey hostKey) throws IOExceptionPersists an SSH key to disk for the requested host. This effectively marks the requested key as trusted for all future connections to the host, until any future save attempt replaces this key.
host- the host the key is being saved for
hostKey- the key to be saved as the trusted key for this host
IOException- on failure saving the key for the host