Logo Search packages:      
Sourcecode: jenkins-trilead-ssh2 version File versions  Download package

Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

com::trilead::ssh2::KnownHosts Class Reference

Collaboration diagram for com::trilead::ssh2::KnownHosts:
Collaboration graph

List of all members.


class  KnownHostsEntry

Public Member Functions

void addHostkey (String hostnames[], String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
void addHostkeys (char[] knownHostsData) throws IOException
void addHostkeys (File knownHosts) throws IOException
String[] getPreferredServerHostkeyAlgorithmOrder (String hostname)
 KnownHosts (char[] knownHostsData) throws IOException
 KnownHosts (File knownHosts) throws IOException
int verifyHostkey (String hostname, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException

Static Public Member Functions

static final void addHostkeyToFile (File knownHosts, String[] hostnames, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
static final String createBubblebabbleFingerprint (String keytype, byte[] publickey)
static final String createHashedHostname (String hostname)
static final String createHexFingerprint (String keytype, byte[] publickey)

Static Public Attributes

static final int HOSTKEY_HAS_CHANGED = 2
static final int HOSTKEY_IS_NEW = 1
static final int HOSTKEY_IS_OK = 0

Private Member Functions

final boolean checkHashed (String entry, String hostname)
int checkKey (String remoteHostname, Object remoteKey)
Vector getAllKeys (String hostname)
final boolean hostnameMatches (String[] hostpatterns, String hostname)
void initialize (char[] knownHostsData) throws IOException
void initialize (File knownHosts) throws IOException
final boolean matchKeys (Object key1, Object key2)
final boolean pseudoRegex (char[] pattern, int i, char[] match, int j)
String[] recommendHostkeyAlgorithms (String hostname)

Static Private Member Functions

static final byte[] hmacSha1Hash (byte[] salt, String hostname)
static final byte[] rawFingerPrint (String type, String keyType, byte[] hostkey)
static final String rawToBubblebabbleFingerprint (byte[] raw)
static final String rawToHexFingerprint (byte[] fingerprint)

Private Attributes

LinkedList publicKeys = new LinkedList()

Detailed Description

The KnownHosts class is a handy tool to verify received server hostkeys based on the information in known_hosts files (the ones used by OpenSSH).

It offers basically an in-memory database for known_hosts entries, as well as some helper functions. Entries from a known_hosts file can be loaded at construction time. It is also possible to add more keys later (e.g., one can parse different known_hosts files).

It is a thread safe implementation, therefore, you need only to instantiate one KnownHosts for your whole application.

Christian Plattner, plattner@trilead.com
KnownHosts.java,v 1.1 2007/10/15 12:49:56 cplattne Exp

Definition at line 45 of file KnownHosts.java.

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

Generated by  Doxygen 1.6.0   Back to index