Package hudson.plugins.ec2.ssh.verifiers
Class HostKeyHelper
- java.lang.Object
-
- hudson.plugins.ec2.ssh.verifiers.HostKeyHelper
-
public final class HostKeyHelper extends Object
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:
- TODO
- Author:
- Michael Clarke, M Ramon Leon
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HostKey
getHostKey(Computer host)
Retrieve the currently trusted host key for the requested computer, or null if no key is currently trusted.static HostKeyHelper
getInstance()
void
saveHostKey(Computer host, HostKey hostKey)
Persists an SSH key to disk for the requested host.
-
-
-
Method Detail
-
getInstance
public static HostKeyHelper getInstance()
-
getHostKey
public HostKey getHostKey(Computer host) throws IOException
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
public void saveHostKey(Computer host, HostKey hostKey) throws IOException
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
-
-