Esempio n. 1
0
 public void addHostKey(byte[] key) throws JSchException {
   HostKeyRepository hkr = this.jsch.getHostKeyRepository();
   HostKey hk = new HostKey(this.host, key);
   UserInfo userInfo = new MyUserInfo();
   hkr.add(hk, userInfo);
   log.info("hostkey added");
 }
Esempio n. 2
0
 public void listKnownHosts() {
   HostKeyRepository hkr = this.jsch.getHostKeyRepository();
   HostKey[] hks = hkr.getHostKey();
   if (hks != null) {
     System.out.println("Host keys in " + hkr.getKnownHostsRepositoryID());
     for (int i = 0; i < hks.length; i++) {
       HostKey hk = hks[i];
       System.out.println(hk.getHost() + " " + hk.getType() + " " + hk.getFingerPrint(jsch));
     }
     System.out.println("");
   }
 }