com.jcraft.jsch.KnownHosts Class Reference

Usually not to be used by applications. More...

Inheritance diagram for com.jcraft.jsch.KnownHosts:
Inheritance graph
[legend]
Collaboration diagram for com.jcraft.jsch.KnownHosts:
Collaboration graph
[legend]

List of all members.

Classes

class  HashedHostKey

Public Member Functions

String getKnownHostsRepositoryID ()
int check (String host, byte[] key)
 Checks whether some host has a given key.
void add (HostKey hostkey, UserInfo userinfo)
 Adds a hostname-key-pair to the repository.
HostKey[] getHostKey ()
HostKey[] getHostKey (String host, String type)
void remove (String host, String type)
 Removes all keys of a host from the repository.
void remove (String host, String type, byte[] key)

Public Attributes

final int NOT_INCLUDED = 1
 Constant for the result of check: The host does not exist yet in the list.
final int CHANGED = 2
 Constant for the result of check: The host has another key.

Protected Member Functions

void sync () throws IOException
synchronized void sync (String foo) throws IOException

Package Functions

 KnownHosts (JSch jsch)
void setKnownHosts (String foo) throws JSchException
void setKnownHosts (InputStream foo) throws JSchException
String getKnownHostsFile ()
void dump (OutputStream out) throws IOException
HostKey createHashedHostKey (String host, byte[]key) throws JSchException

Package Attributes

final int OK = 0
 Constant for the result of check: The host has the given key.

Private Member Functions

void addInvalidLine (String line) throws JSchException
int getType (byte[] key)
String deleteSubString (String hosts, String host)
synchronized MAC getHMACSHA1 ()

Private Attributes

JSch jsch = null
String known_hosts = null
java.util.Vector pool = null
MAC hmacsha1 = null

Static Private Attributes

static final String _known_hosts = "known_hosts"
static final byte[] space = {(byte)0x20}
static final byte[] cr = Util.str2byte("\n")

Detailed Description

Usually not to be used by applications.

The default implementation of HostKeyRepository, using a local file to store the keys.

I see no reason this class has to be public.

See also:
JSch.setKnownHosts(String)
JSch.setKnownHosts(InputStream)

Definition at line 46 of file KnownHosts.java.


Constructor & Destructor Documentation

com.jcraft.jsch.KnownHosts.KnownHosts ( JSch  jsch  )  [package]

Definition at line 61 of file KnownHosts.java.

References com.jcraft.jsch.KnownHosts.pool.


Member Function Documentation

void com.jcraft.jsch.KnownHosts.add ( HostKey  hostkey,
UserInfo  ui 
)

Adds a hostname-key-pair to the repository.

Parameters:
hostkey the key to add
ui an UserInfo object which may be used to ask the user whether to create the file (and directory), or other similar questions, if necessary.

Implements com.jcraft.jsch.HostKeyRepository.

Definition at line 225 of file KnownHosts.java.

References com.jcraft.jsch.HostKey.getHost(), com.jcraft.jsch.KnownHosts.getKnownHostsRepositoryID(), com.jcraft.jsch.HostKey.isMatched(), com.jcraft.jsch.HostKey.key, com.jcraft.jsch.KnownHosts.pool, com.jcraft.jsch.KnownHosts.sync(), and com.jcraft.jsch.HostKey.type.

void com.jcraft.jsch.KnownHosts.addInvalidLine ( String  line  )  throws JSchException [private]
int com.jcraft.jsch.KnownHosts.check ( String  host,
byte[]  key 
)

Checks whether some host has a given key.

Parameters:
host the host name to check
key the public key the remote host uses.
Returns:
one of the constants OK (this host is known to use this key), NOT_INCLUDED (the host is unknown) or CHANGED (the host is known to use another key).

Implements com.jcraft.jsch.HostKeyRepository.

Definition at line 193 of file KnownHosts.java.

References com.jcraft.jsch.HostKeyRepository.CHANGED, com.jcraft.jsch.KnownHosts.getType(), com.jcraft.jsch.HostKey.isMatched(), com.jcraft.jsch.HostKey.key, com.jcraft.jsch.HostKeyRepository.NOT_INCLUDED, com.jcraft.jsch.HostKeyRepository.OK, com.jcraft.jsch.KnownHosts.pool, and com.jcraft.jsch.HostKey.type.

HostKey com.jcraft.jsch.KnownHosts.createHashedHostKey ( String  host,
byte[]  key 
) throws JSchException [package]

Definition at line 429 of file KnownHosts.java.

References com.jcraft.jsch.KnownHosts.HashedHostKey.hash.

String com.jcraft.jsch.KnownHosts.deleteSubString ( String  hosts,
String  host 
) [private]

Definition at line 396 of file KnownHosts.java.

Referenced by com.jcraft.jsch.KnownHosts.remove().

void com.jcraft.jsch.KnownHosts.dump ( OutputStream  out  )  throws IOException [package]
synchronized MAC com.jcraft.jsch.KnownHosts.getHMACSHA1 (  )  [private]
HostKey [] com.jcraft.jsch.KnownHosts.getHostKey ( String  host,
String  type 
)
HostKey [] com.jcraft.jsch.KnownHosts.getHostKey (  ) 

Definition at line 291 of file KnownHosts.java.

String com.jcraft.jsch.KnownHosts.getKnownHostsFile (  )  [package]

Definition at line 190 of file KnownHosts.java.

References com.jcraft.jsch.KnownHosts.known_hosts.

String com.jcraft.jsch.KnownHosts.getKnownHostsRepositoryID (  ) 

Definition at line 191 of file KnownHosts.java.

References com.jcraft.jsch.KnownHosts.known_hosts.

Referenced by com.jcraft.jsch.KnownHosts.add().

int com.jcraft.jsch.KnownHosts.getType ( byte[]  key  )  [private]

Definition at line 391 of file KnownHosts.java.

Referenced by com.jcraft.jsch.KnownHosts.check().

void com.jcraft.jsch.KnownHosts.remove ( String  host,
String  type,
byte[]  key 
)
void com.jcraft.jsch.KnownHosts.remove ( String  host,
String  type 
)

Removes all keys of a host from the repository.

Implements com.jcraft.jsch.HostKeyRepository.

Definition at line 321 of file KnownHosts.java.

void com.jcraft.jsch.KnownHosts.setKnownHosts ( InputStream  foo  )  throws JSchException [package]
void com.jcraft.jsch.KnownHosts.setKnownHosts ( String  foo  )  throws JSchException [package]

Definition at line 67 of file KnownHosts.java.

References com.jcraft.jsch.KnownHosts.known_hosts.

synchronized void com.jcraft.jsch.KnownHosts.sync ( String  foo  )  throws IOException [protected]

Definition at line 355 of file KnownHosts.java.

References com.jcraft.jsch.KnownHosts.dump().

void com.jcraft.jsch.KnownHosts.sync (  )  throws IOException [protected]

Member Data Documentation

final String com.jcraft.jsch.KnownHosts._known_hosts = "known_hosts" [static, private]

Definition at line 47 of file KnownHosts.java.

final int com.jcraft.jsch.HostKeyRepository.CHANGED = 2 [inherited]

Constant for the result of check: The host has another key.

(This could be indicating a man-in-the-middle attack.)

Definition at line 67 of file HostKeyRepository.java.

Referenced by com.jcraft.jsch.KnownHosts.check().

final byte [] com.jcraft.jsch.KnownHosts.cr = Util.str2byte("\n") [static, private]

Definition at line 363 of file KnownHosts.java.

Definition at line 59 of file KnownHosts.java.

Referenced by com.jcraft.jsch.KnownHosts.getHMACSHA1().

Definition at line 55 of file KnownHosts.java.

Referenced by com.jcraft.jsch.KnownHosts.getHMACSHA1().

String com.jcraft.jsch.KnownHosts.known_hosts = null [private]

Constant for the result of check: The host does not exist yet in the list.

Definition at line 60 of file HostKeyRepository.java.

Referenced by com.jcraft.jsch.KnownHosts.check().

final int com.jcraft.jsch.HostKeyRepository.OK = 0 [package, inherited]

Constant for the result of check: The host has the given key.

Definition at line 54 of file HostKeyRepository.java.

Referenced by com.jcraft.jsch.KnownHosts.check().

java.util.Vector com.jcraft.jsch.KnownHosts.pool = null [private]
final byte [] com.jcraft.jsch.KnownHosts.space = {(byte)0x20} [static, private]

Definition at line 362 of file KnownHosts.java.

Referenced by com.jcraft.jsch.KnownHosts.dump().


The documentation for this class was generated from the following file:

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1