com.mindbright.ssh2
public class SSH2HostKeyVerifier extends SSH2TransportEventAdapter
SSH2TransportEventHandler
.SSH2TransportEventHandler
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
fingerprint |
protected java.security.PublicKey |
publickey |
Constructor and Description |
---|
SSH2HostKeyVerifier(java.security.PublicKey publickey)
Create an instance which will verify that the hostkey matches
the given public key.
|
SSH2HostKeyVerifier(java.lang.String fingerprint)
Create an instance which will verify that the hostkey matches
a public key with the given fingerprint.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
compareFingerprints(java.lang.String fingerprint,
SSH2Signature serverHostKey)
Static utility function which can be used to compare a server key
against a fingerprint.
|
static boolean |
comparePublicKeys(java.security.PublicKey p1,
java.security.PublicKey p2)
Static utility functions which can compare two public keys.
|
boolean |
kexAuthenticateHost(SSH2Transport tp,
SSH2Signature serverHostKey)
Perform the authenticate host stage of key exchange.
|
fatalDisconnect, gotConnectInfoText, gotPeerVersion, kexAgreed, kexComplete, kexStart, msgDebug, msgIgnore, msgUnimplemented, normalDisconnect, peerDisconnect, peerSentUnknownMessage
protected java.lang.String fingerprint
protected java.security.PublicKey publickey
public SSH2HostKeyVerifier(java.security.PublicKey publickey)
publickey
- The public key to verify against.public SSH2HostKeyVerifier(java.lang.String fingerprint)
fingerprint
- The fingerprint which should match the public key.public boolean kexAuthenticateHost(SSH2Transport tp, SSH2Signature serverHostKey)
kexAuthenticateHost
in interface SSH2TransportEventHandler
kexAuthenticateHost
in class SSH2TransportEventAdapter
tp
- Indentifies the SSH2Transport
object
handling the connection.serverHostKey
- Signature object which holds the server keys.public static boolean compareFingerprints(java.lang.String fingerprint, SSH2Signature serverHostKey)
fingerprint
- The fingerprint to check.serverHostKey
- Signature object which holds the server keys.public static boolean comparePublicKeys(java.security.PublicKey p1, java.security.PublicKey p2)
p1
- Public key to compare.p2
- Public key to compare.