verinec.util
Class J2sshProcess.SingleKnownHostsKeyVerification
java.lang.Object
verinec.util.J2sshProcess.SingleKnownHostsKeyVerification
- All Implemented Interfaces:
- com.sshtools.j2ssh.transport.HostKeyVerification
- Enclosing class:
- J2sshProcess
public static class J2sshProcess.SingleKnownHostsKeyVerification
- extends Object
- implements com.sshtools.j2ssh.transport.HostKeyVerification
Used if the fingerprint of the target host is specified.
It can only verify if the specified host has the specified fingerprint.
If hostname or fingerprint do not match, connection will be refused.
Warning: j2ssh hangs when the key is refused...
|
Method Summary |
boolean |
verifyHost(String host,
com.sshtools.j2ssh.transport.publickey.SshPublicKey pk)
Check if the public key fingerprint and the hostname match the
parameters given in the constructor. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
hostname
private String hostname
fingerprint
private String fingerprint
J2sshProcess.SingleKnownHostsKeyVerification
public J2sshProcess.SingleKnownHostsKeyVerification(String host,
String fingerprint)
- Initialize hostname and fingerprint.
The fingerprint format should be the same as OpenSsh use, but it is not.
- Parameters:
host - The host name of target hostfingerprint - The fingerprint of target hosts certificate
verifyHost
public boolean verifyHost(String host,
com.sshtools.j2ssh.transport.publickey.SshPublicKey pk)
- Check if the public key fingerprint and the hostname match the
parameters given in the constructor.
- Specified by:
verifyHost in interface com.sshtools.j2ssh.transport.HostKeyVerification
- Parameters:
host - Hostname to be checkedpk - Public key of that host, its fingerprint will be compared to the parameter.
- Returns:
- whether the hostname and fingerprint match.