title: JSch - How to let user confirm host fingerprint?
body: <p>In an Android app, I am attempting to connect to an SSH server using the JSch library.  The remote server is specified by the user, so I don't know the remote fingerprint in advance.  At the same time I don't want to set <code>StrictHostKeyChecking</code> to no as I see in so many examples. </p>
  
  <p>I'd like to get the remote server fingerprint, show it to the user for acceptance.  Is this possible either with JSch or regular Java, perhaps with sockets?</p>
  
  <p>Here's an example you can try, just paste it in the <code>onCreate</code> of an Android activity:</p>
  
  <pre><code>new Thread(new Runnable() {
      @Override
      public void run() {
  
          com.jcraft.jsch.Session session;
          JSch jsch;
          try {
              jsch = new JSch();
              jsch.setLogger(new MyLogger());
  
              session = jsch.getSession("git", "github.com", 22);
              session.setPassword("hunter2");
  
              Properties prop = new Properties();
              prop.put("StrictHostKeyChecking", "yes");
              session.setConfig(prop);
  
              //**Get a host key and show it to the user**
  
              session.connect();  // reject HostKey: github.com
          }
          catch (Exception e){
              LOG.error("Could not JSCH", e);
          }
      }
  }).start();
  </code></pre>