com.jcraft.jsch.HostKeyRepository Interface Reference

A repository for known host keys. More...

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

List of all members.

Public Member Functions

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

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.

Package Attributes

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

Detailed Description

A repository for known host keys.

This will be used when connecting remote servers to check that their public keys are the same as we think they should be.

The library contains an KnownHosts implementation} based on the OpenSSH known Hosts file format - this will be the default implementation if no other is given explicitely.

An application might want to implement this class to provide an alternative repository of valid server keys to use.

See also:
JSch.setHostKeyRepository

Definition at line 48 of file HostKeyRepository.java.


Member Function Documentation

void com.jcraft.jsch.HostKeyRepository.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.

Implemented in com.jcraft.jsch.KnownHosts.

Referenced by com.jcraft.jsch.Session.checkHost().

int com.jcraft.jsch.HostKeyRepository.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).

Implemented in com.jcraft.jsch.KnownHosts.

Referenced by com.jcraft.jsch.Session.checkHost().

void com.jcraft.jsch.HostKeyRepository.remove ( String  host,
String  type 
)

Removes all keys of a host from the repository.

Implemented in com.jcraft.jsch.KnownHosts.

Referenced by com.jcraft.jsch.Session.checkHost().


Member Data Documentation

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().

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]

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().


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

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1