Home | History | Annotate | Download | only in ssh2
      1 /*
      2  * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
      3  * Please refer to the LICENSE.txt for licensing details.
      4  */
      5 package ch.ethz.ssh2;
      6 
      7 /**
      8  * A callback interface used to implement a client specific method of checking
      9  * server host keys.
     10  *
     11  * @author Christian Plattner
     12  * @version 2.50, 03/15/10
     13  */
     14 
     15 public interface ServerHostKeyVerifier
     16 {
     17 	/**
     18 	 * The actual verifier method, it will be called by the key exchange code
     19 	 * on EVERY key exchange - this can happen several times during the lifetime
     20 	 * of a connection.
     21 	 * <p>
     22 	 * Note: SSH-2 servers are allowed to change their hostkey at ANY time.
     23 	 *
     24 	 * @param hostname the hostname used to create the {@link Connection} object
     25 	 * @param port the remote TCP port
     26 	 * @param serverHostKeyAlgorithm the public key algorithm (<code>ssh-rsa</code> or <code>ssh-dss</code>)
     27 	 * @param serverHostKey the server's public key blob
     28 	 * @return if the client wants to accept the server's host key - if not, the
     29 	 *         connection will be closed.
     30 	 * @throws Exception Will be wrapped with an IOException, extended version of returning false =)
     31 	 */
     32 	public boolean verifyServerHostKey(String hostname, int port, String serverHostKeyAlgorithm, byte[] serverHostKey)
     33 			throws Exception;
     34 }
     35