01: package net.sf.jftp.net;
02:
03: import net.sf.jftp.system.logging.Log;
04:
05: import com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification;
06: import com.sshtools.j2ssh.transport.InvalidHostFileException;
07: import com.sshtools.j2ssh.transport.TransportProtocolException;
08: import com.sshtools.j2ssh.transport.publickey.SshPublicKey;
09:
10: public class SftpVerification extends AbstractKnownHostsKeyVerification {
11: public SftpVerification(String tmp) throws InvalidHostFileException {
12: super (tmp);
13: }
14:
15: public void onDeniedHost(final String host)
16: throws TransportProtocolException {
17: Log
18: .debug("Access to '"
19: + host
20: + "' is denied.\nVerify the access granted/denied in the allowed hosts file.");
21: }
22:
23: public void onHostKeyMismatch(final String host,
24: SshPublicKey recordedFingerprint,
25: SshPublicKey actualFingerprint)
26: throws TransportProtocolException {
27: try {
28: allowHost(host, actualFingerprint, false);
29: } catch (Exception ex) {
30: Log.debug("Error: " + ex);
31: }
32: }
33:
34: public void onUnknownHost(final String host,
35: SshPublicKey fingerprint) throws TransportProtocolException {
36: try {
37: allowHost(host, fingerprint, false);
38: } catch (Exception ex) {
39: Log.debug("Error: " + ex);
40: }
41: }
42:
43: private void showExceptionMessage(Exception ex) {
44: Log.debug("Error: " + ex);
45: }
46: }
|