1 package net.sf.jftp.net; 2 3 import net.sf.jftp.system.logging.Log; 4 5 import com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification; 6 import com.sshtools.j2ssh.transport.InvalidHostFileException; 7 import com.sshtools.j2ssh.transport.TransportProtocolException; 8 import com.sshtools.j2ssh.transport.publickey.SshPublicKey; 9 10 11 public class SftpVerification extends AbstractKnownHostsKeyVerification 12 { 13 public SftpVerification(String tmp) throws InvalidHostFileException 14 { 15 super(tmp); 16 } 17 18 public void onDeniedHost(final String host) 19 throws TransportProtocolException 20 { 21 Log.debug("Access to '" + host + 22 "' is denied.\nVerify the access granted/denied in the allowed hosts file."); 23 } 24 25 public void onHostKeyMismatch(final String host, 26 SshPublicKey recordedFingerprint, 27 SshPublicKey actualFingerprint) 28 throws TransportProtocolException 29 { 30 try 31 { 32 allowHost(host, actualFingerprint, false); 33 } 34 catch(Exception ex) 35 { 36 Log.debug("Error: " + ex); 37 } 38 } 39 40 public void onUnknownHost(final String host, SshPublicKey fingerprint) 41 throws TransportProtocolException 42 { 43 try 44 { 45 allowHost(host, fingerprint, false); 46 } 47 catch(Exception ex) 48 { 49 Log.debug("Error: " + ex); 50 } 51 } 52 53 private void showExceptionMessage(Exception ex) 54 { 55 Log.debug("Error: " + ex); 56 } 57 } 58 | Popular Tags |