com.jcraft.jsch
Class KnownHosts

java.lang.Object
  extended by com.jcraft.jsch.KnownHosts
All Implemented Interfaces:
HostKeyRepository

public class KnownHosts
extends Object
implements HostKeyRepository


Field Summary
 
Fields inherited from interface com.jcraft.jsch.HostKeyRepository
CHANGED, NOT_INCLUDED, OK
 
Method Summary
 void add(HostKey hostkey, UserInfo userinfo)
          Adds a host key hostkey
 int check(String host, byte[] key)
          Checks if host is included with the key.
 HostKey[] getHostKey()
          Retuns a list for host keys managed in this repository.
 HostKey[] getHostKey(String host, String type)
          Retuns a list for host keys managed in this repository.
 String getKnownHostsRepositoryID()
          Returns id of this repository.
 void remove(String host, String type)
          Removes a host key if there exists mached key with host, type.
 void remove(String host, String type, byte[] key)
          Removes a host key if there exists a matched key with host, type and key.
protected  void sync()
           
protected  void sync(String foo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getKnownHostsRepositoryID

public String getKnownHostsRepositoryID()
Description copied from interface: HostKeyRepository
Returns id of this repository.

Specified by:
getKnownHostsRepositoryID in interface HostKeyRepository
Returns:
identity in String

check

public int check(String host,
                 byte[] key)
Description copied from interface: HostKeyRepository
Checks if host is included with the key.

Specified by:
check in interface HostKeyRepository
Returns:
#NOT_INCLUDED, #OK or #CHANGED
See Also:
HostKeyRepository.NOT_INCLUDED, HostKeyRepository.OK, HostKeyRepository.CHANGED

add

public void add(HostKey hostkey,
                UserInfo userinfo)
Description copied from interface: HostKeyRepository
Adds a host key hostkey

Specified by:
add in interface HostKeyRepository
Parameters:
hostkey - a host key to be added
userinfo - a user interface for showing messages or promping inputs.
See Also:
UserInfo

getHostKey

public HostKey[] getHostKey()
Description copied from interface: HostKeyRepository
Retuns a list for host keys managed in this repository.

Specified by:
getHostKey in interface HostKeyRepository
See Also:
HostKeyRepository.getHostKey(String host, String type)

getHostKey

public HostKey[] getHostKey(String host,
                            String type)
Description copied from interface: HostKeyRepository
Retuns a list for host keys managed in this repository.

Specified by:
getHostKey in interface HostKeyRepository
Parameters:
host - a hostname used in searching host keys. If null is given, every host key will be listed.
type - a key type used in searching host keys, and it should be "ssh-dss" or "ssh-rsa". If null is given, a key type type will not be ignored.

remove

public void remove(String host,
                   String type)
Description copied from interface: HostKeyRepository
Removes a host key if there exists mached key with host, type.

Specified by:
remove in interface HostKeyRepository
See Also:
HostKeyRepository.remove(String host, String type, byte[] key)

remove

public void remove(String host,
                   String type,
                   byte[] key)
Description copied from interface: HostKeyRepository
Removes a host key if there exists a matched key with host, type and key.

Specified by:
remove in interface HostKeyRepository

sync

protected void sync()
             throws IOException
Throws:
IOException

sync

protected void sync(String foo)
             throws IOException
Throws:
IOException


Copyright © 2014 JCraft,Inc.. All Rights Reserved.