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


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") |
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.
Definition at line 46 of file KnownHosts.java.
| com.jcraft.jsch.KnownHosts.KnownHosts | ( | JSch | jsch | ) | [package] |
Definition at line 61 of file KnownHosts.java.
References com.jcraft.jsch.KnownHosts.pool.
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. |
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] |
Definition at line 186 of file KnownHosts.java.
References com.jcraft.jsch.KnownHosts.pool.
Referenced by com.jcraft.jsch.KnownHosts.setKnownHosts().
| int com.jcraft.jsch.KnownHosts.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. |
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] |
Definition at line 364 of file KnownHosts.java.
References com.jcraft.jsch.HostKey.getHost(), com.jcraft.jsch.HostKey.getKey(), com.jcraft.jsch.HostKey.getType(), com.jcraft.jsch.KnownHosts.pool, and com.jcraft.jsch.KnownHosts.space.
Referenced by com.jcraft.jsch.KnownHosts.sync().
| synchronized MAC com.jcraft.jsch.KnownHosts.getHMACSHA1 | ( | ) | [private] |
Definition at line 416 of file KnownHosts.java.
References com.jcraft.jsch.KnownHosts.hmacsha1, and com.jcraft.jsch.KnownHosts.jsch.
Referenced by com.jcraft.jsch.KnownHosts.HashedHostKey.hash(), and com.jcraft.jsch.KnownHosts.HashedHostKey.isMatched().
| HostKey [] com.jcraft.jsch.KnownHosts.getHostKey | ( | String | host, | |
| String | type | |||
| ) |
Definition at line 294 of file KnownHosts.java.
References com.jcraft.jsch.HostKey.getType(), com.jcraft.jsch.HostKey.isMatched(), com.jcraft.jsch.KnownHosts.pool, and com.jcraft.jsch.HostKey.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 | |||
| ) |
Definition at line 324 of file KnownHosts.java.
References com.jcraft.jsch.KnownHosts.deleteSubString(), com.jcraft.jsch.HostKey.getHost(), com.jcraft.jsch.HostKey.getType(), com.jcraft.jsch.HostKey.host, com.jcraft.jsch.HostKey.isMatched(), com.jcraft.jsch.HostKey.key, com.jcraft.jsch.KnownHosts.pool, and com.jcraft.jsch.KnownHosts.sync().
| 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] |
Definition at line 76 of file KnownHosts.java.
References com.jcraft.jsch.KnownHosts.addInvalidLine(), and com.jcraft.jsch.KnownHosts.pool.
| 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] |
Definition at line 351 of file KnownHosts.java.
References com.jcraft.jsch.KnownHosts.known_hosts.
Referenced by com.jcraft.jsch.KnownHosts.add(), and com.jcraft.jsch.KnownHosts.remove().
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.
MAC com.jcraft.jsch.KnownHosts.hmacsha1 = null [private] |
Definition at line 59 of file KnownHosts.java.
Referenced by com.jcraft.jsch.KnownHosts.getHMACSHA1().
JSch com.jcraft.jsch.KnownHosts.jsch = null [private] |
Definition at line 55 of file KnownHosts.java.
Referenced by com.jcraft.jsch.KnownHosts.getHMACSHA1().
String com.jcraft.jsch.KnownHosts.known_hosts = null [private] |
Definition at line 56 of file KnownHosts.java.
Referenced by com.jcraft.jsch.KnownHosts.getKnownHostsFile(), com.jcraft.jsch.KnownHosts.getKnownHostsRepositoryID(), com.jcraft.jsch.KnownHosts.setKnownHosts(), and com.jcraft.jsch.KnownHosts.sync().
final int com.jcraft.jsch.HostKeyRepository.NOT_INCLUDED = 1 [inherited] |
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] |
Definition at line 57 of file KnownHosts.java.
Referenced by com.jcraft.jsch.KnownHosts.add(), com.jcraft.jsch.KnownHosts.addInvalidLine(), com.jcraft.jsch.KnownHosts.check(), com.jcraft.jsch.KnownHosts.dump(), com.jcraft.jsch.KnownHosts.getHostKey(), com.jcraft.jsch.KnownHosts.KnownHosts(), com.jcraft.jsch.KnownHosts.remove(), and com.jcraft.jsch.KnownHosts.setKnownHosts().
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().
1.6.1