Package com.jcraft.jsch
Class KnownHosts
java.lang.Object
com.jcraft.jsch.KnownHosts
- All Implemented Interfaces:
HostKeyRepository
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final byte[]
private MAC
private JSch
private String
private Vector
private static final byte[]
Fields inherited from interface com.jcraft.jsch.HostKeyRepository
CHANGED, NOT_INCLUDED, OK
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a host keyhostkey
private void
addInvalidLine
(String line) int
Checks ifhost
is included with thekey
.(package private) HostKey
createHashedHostKey
(String host, byte[] key) private String
deleteSubString
(String hosts, String host) (package private) void
dump
(OutputStream out) private MAC
HostKey[]
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.(package private) String
Returns id of this repository.void
Removes a host key if there exists mached key withhost
,type
.void
Removes a host key if there exists a matched key withhost
,type
andkey
.(package private) void
setKnownHosts
(InputStream input) (package private) void
setKnownHosts
(String filename) protected void
sync()
protected void
-
Field Details
-
_known_hosts
- See Also:
-
jsch
-
known_hosts
-
pool
-
hmacsha1
-
space
private static final byte[] space -
cr
private static final byte[] cr
-
-
Constructor Details
-
KnownHosts
KnownHosts(JSch jsch)
-
-
Method Details
-
setKnownHosts
- Throws:
JSchException
-
setKnownHosts
- Throws:
JSchException
-
addInvalidLine
- Throws:
JSchException
-
getKnownHostsFile
String getKnownHostsFile() -
getKnownHostsRepositoryID
Description copied from interface:HostKeyRepository
Returns id of this repository.- Specified by:
getKnownHostsRepositoryID
in interfaceHostKeyRepository
- Returns:
- identity in String
-
check
Description copied from interface:HostKeyRepository
Checks ifhost
is included with thekey
.- Specified by:
check
in interfaceHostKeyRepository
- Returns:
- #NOT_INCLUDED, #OK or #CHANGED
- See Also:
-
add
Description copied from interface:HostKeyRepository
Adds a host keyhostkey
- Specified by:
add
in interfaceHostKeyRepository
- Parameters:
hostkey
- a host key to be addeduserinfo
- a user interface for showing messages or promping inputs.- See Also:
-
getHostKey
Description copied from interface:HostKeyRepository
Retuns a list for host keys managed in this repository.- Specified by:
getHostKey
in interfaceHostKeyRepository
- See Also:
-
getHostKey
Description copied from interface:HostKeyRepository
Retuns a list for host keys managed in this repository.- Specified by:
getHostKey
in interfaceHostKeyRepository
- Parameters:
host
- a hostname used in searching host keys. Ifnull
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". Ifnull
is given, a key type type will not be ignored.
-
remove
Description copied from interface:HostKeyRepository
Removes a host key if there exists mached key withhost
,type
.- Specified by:
remove
in interfaceHostKeyRepository
- See Also:
-
remove
Description copied from interface:HostKeyRepository
Removes a host key if there exists a matched key withhost
,type
andkey
.- Specified by:
remove
in interfaceHostKeyRepository
-
sync
- Throws:
IOException
-
sync
- Throws:
IOException
-
dump
- Throws:
IOException
-
deleteSubString
-
getHMACSHA1
-
createHashedHostKey
- Throws:
JSchException
-