A repository for known host keys. More...
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. |
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.
Definition at line 48 of file HostKeyRepository.java.
Adds a hostname-key-pair to the repository.
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.
host | the host name to check | |
key | the public key the remote host uses. |
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().
final int com.jcraft.jsch.HostKeyRepository.CHANGED = 2 |
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 int com.jcraft.jsch.HostKeyRepository.NOT_INCLUDED = 1 |
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().