Secure iNet Factory

com.jscape.inet.ssh.util
Class SshHostKeys

java.lang.Object
  extended by com.jscape.inet.ssh.util.SshHostKeys
All Implemented Interfaces:
java.io.Serializable

public class SshHostKeys
extends java.lang.Object
implements java.io.Serializable

Associative host keys store. Contains host addresses with associated host keys as one-to-one map. Supports serialization for simplifying physical save/restore process. Methods of this class are not thread-safe. All methods throw NullPointerException if some object parameter is null and IllegalArgumentException if some parameter doesn't correspond to the method contract.

Author:
Alex
See Also:
Serialized Form

Constructor Summary
SshHostKeys()
           
SshHostKeys(java.util.Map<java.net.InetAddress,java.util.Set<java.lang.String>> keys)
           
SshHostKeys(SshHostKeys that)
           
 
Method Summary
 void addKey(java.net.InetAddress host, java.lang.String keyFingerprint)
          Adds a new key entry to the store.
 void clear()
          Clears the store contents.
 java.util.Iterator getHosts()
          Returns current hosts collection contained in the store.
 java.util.Iterator<java.lang.String> getKeys(java.net.InetAddress host)
          Returns keys iterator for the specified host.
 boolean isKnownKey(java.net.InetAddress host, java.lang.String keyFingerprint)
          Checks if the store contains the specified host key.
 void removeKey(java.net.InetAddress host, java.lang.String keyFingerprint)
          Removes the key entry for the specified host.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SshHostKeys

public SshHostKeys(java.util.Map<java.net.InetAddress,java.util.Set<java.lang.String>> keys)

SshHostKeys

public SshHostKeys()

SshHostKeys

public SshHostKeys(SshHostKeys that)
Method Detail

addKey

public void addKey(java.net.InetAddress host,
                   java.lang.String keyFingerprint)
Adds a new key entry to the store.

Parameters:
host - the host address
keyFingerprint - host key fingerprint string

removeKey

public void removeKey(java.net.InetAddress host,
                      java.lang.String keyFingerprint)
Removes the key entry for the specified host.

Parameters:
host - target host
keyFingerprint - key fingerprint to remove

clear

public void clear()
Clears the store contents.


getHosts

public java.util.Iterator getHosts()
Returns current hosts collection contained in the store.

Returns:
current hosts collection

getKeys

public java.util.Iterator<java.lang.String> getKeys(java.net.InetAddress host)
Returns keys iterator for the specified host.

Parameters:
host - target host
Returns:
host key iterator

isKnownKey

public boolean isKnownKey(java.net.InetAddress host,
                          java.lang.String keyFingerprint)
Checks if the store contains the specified host key.

Parameters:
host - host
keyFingerprint - host key fingerprint
Returns:
true if the store contains the specified key; false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved