Class HostKeyHelper
java.lang.Object
hudson.plugins.sshslaves.verifiers.HostKeyHelper
Helper 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.
- Since:
- 1.13
- Author:
- Michael Clarke
-
Method Summary
Modifier and TypeMethodDescriptiongetHostKey
(Computer host) Retrieve the currently trusted host key for the requested computer, or null if no key is currently trusted.static HostKeyHelper
void
saveHostKey
(Computer host, HostKey hostKey) Persists an SSH key to disk for the requested host.
-
Method Details
-
getInstance
-
getHostKey
Retrieve the currently trusted host key for the requested computer, or null if no key is currently trusted.- Parameters:
host
- the Computer to retrieve the key for.- Returns:
- the currently trusted key for the requested host, or null if no key is trusted.
- Throws:
IOException
- if the host key can not be read from storage
-
saveHostKey
Persists 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.- Parameters:
host
- the host the key is being saved forhostKey
- the key to be saved as the trusted key for this host- Throws:
IOException
- on failure saving the key for the host
-