com.jscape.inet.ssh.util

## Class SshHostKeys

- java.lang.Object
- - 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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SshHostKeys.Entry` A store entry.
    `static class` | `SshHostKeys.Fingerprint`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SshHostKeys(SshHostKeys.Entry... entries)` Creates a new store instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `SshHostKeys` | `addKey(java.net.InetAddress host, java.lang.String keyFingerprint)` Deprecated. use put()
    `void` | `clear()` Clears the store contents.
    `boolean` | `contains(java.net.InetAddress host, java.security.PublicKey key)` Checks if specified key is already known.
    `java.util.Collection<SshHostKeys.Entry>` | `entriesOf(java.net.InetAddress host)` Returns a collection of known key entries for specified host.
    `java.util.List<java.lang.String>` | `fingerprintsOf(java.net.InetAddress host)` Returns a collection of known key fingerprints for specified host.
    `java.util.Iterator` | `getHosts()` Deprecated. use hosts()
    `java.util.Iterator<java.lang.String>` | `getKeys(java.net.InetAddress host)` Deprecated. use entriesOf()
    `java.util.Collection<java.net.InetAddress>` | `hosts()` Returns known server hosts.
    `java.util.List<java.security.PublicKey>` | `keysOf(java.net.InetAddress host)` Returns a collection of known keys for specified host.
    `SshHostKeys` | `put(java.net.InetAddress host, java.security.PublicKey key)` Puts a key to the store.
    `SshHostKeys` | `put(java.net.InetAddress host, java.lang.String keyFingerprint)` Puts a key to the store.
    `SshHostKeys` | `remove(java.net.InetAddress host, java.security.PublicKey key)` Removes a key from the store.
    `SshHostKeys` | `remove(java.net.InetAddress host, java.lang.String keyFingerprint)` Removes a key from the store.
    `void` | `removeKey(java.net.InetAddress host, java.lang.String keyFingerprint)` Deprecated. use remove()
    `SshHostKeys` | `set(SshHostKeys.Entry... entries)` Sets the store entries.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SshHostKeys

          public SshHostKeys(SshHostKeys.Entry... entries)

      Creates a new store instance.
      Parameters:
        `entries` -

  - ### Method Detail

    - #### set

          public SshHostKeys set(SshHostKeys.Entry... entries)

      Sets the store entries.
      Parameters:
        `entries` - entries
      Returns:
        current store instance

    - #### put

          public SshHostKeys put(java.net.InetAddress host,
                                 java.security.PublicKey key)

      Puts a key to the store.
      Parameters:
        `host` - a server host
        `key` - a server key
      Returns:
        current store instance

    - #### put

          public SshHostKeys put(java.net.InetAddress host,
                                 java.lang.String keyFingerprint)

      Puts a key to the store.
      Parameters:
        `host` - a server host
        `keyFingerprint` - a key fingerprint
      Returns:
        current store instance

    - #### addKey

          public SshHostKeys addKey(java.net.InetAddress host,
                                    java.lang.String keyFingerprint)

      Deprecated. use put()
      Adds a new key entry to the store.
      Parameters:
        `host` - the host address
        `keyFingerprint` - host key fingerprint string

    - #### remove

          public SshHostKeys remove(java.net.InetAddress host,
                                    java.security.PublicKey key)

      Removes a key from the store.
      Parameters:
        `host` - a server host
        `key` - a server key
      Returns:
        current store instance

    - #### remove

          public SshHostKeys remove(java.net.InetAddress host,
                                    java.lang.String keyFingerprint)

      Removes a key from the store.
      Parameters:
        `host` - a server host
        `keyFingerprint` - a key fingerprint
      Returns:
        current store instance

    - #### removeKey

          public void removeKey(java.net.InetAddress host,
                                java.lang.String keyFingerprint)

      Deprecated. use remove()
      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.

    - #### hosts

          public java.util.Collection<java.net.InetAddress> hosts()

      Returns known server hosts.
      Returns:
        known server hosts

    - #### getHosts

          public java.util.Iterator getHosts()

      Deprecated. use hosts()
      Returns current hosts collection contained in the store.
      Returns:
        current hosts collection

    - #### entriesOf

          public java.util.Collection<SshHostKeys.Entry> entriesOf(java.net.InetAddress host)

      Returns a collection of known key entries for specified host.
      Parameters:
        `host` - a server host
      Returns:
        a collection of known key entries

    - #### getKeys

          public java.util.Iterator<java.lang.String> getKeys(java.net.InetAddress host)

      Deprecated. use entriesOf()
      Returns keys iterator for the specified host.
      Parameters:
        `host` - target host
      Returns:
        host key iterator

    - #### keysOf

          public java.util.List<java.security.PublicKey> keysOf(java.net.InetAddress host)

      Returns a collection of known keys for specified host.
      Parameters:
        `host` - a server host
      Returns:
        a collection of known keys

    - #### fingerprintsOf

          public java.util.List<java.lang.String> fingerprintsOf(java.net.InetAddress host)

      Returns a collection of known key fingerprints for specified host.
      Parameters:
        `host` - a server host
      Returns:
        a collection of known key fingerprints

    - #### contains

          public boolean contains(java.net.InetAddress host,
                                  java.security.PublicKey key)

      Checks if specified key is already known.
      Parameters:
        `host` - a server host
        `key` - a server key
      Returns:
        `true` if key is known; `false` otherwise

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

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